To allow the same source address to be used regardless of the egress
interface taken, an option is added for an address to bind the datagram
socket to. Similarly to imudp, it is necessary to add an ipfreebind
option which is set by default, so as to avoid an excess of errors at
startup before the network interface has come up. This enhancement
allows a usecase on networking devices, by which a source interface
that is typically a loopback is specified, on which an address to bind
to is configured. This is so that the same source address is used for
all packets from rsyslog. Support for the TCP case can be added later.
Signed-off-by: Mike Manning <mmanning@att.com>
as it looks, some compiler versions (e.g. gcc 7) seem to be rather
picky on the position where this attribute is applied. So this
commit moves them to the position where they are properly detected.
We also add missing attributes. Some are missing due to conditional
compilation what we did not detect in our regular development
environments. This now comes up as we have enabled the corresponding
warning globally, and so they now also show up on those platforms.
When a message larger than supported by the UDP stack is to be sent,
EMSGSIZE is returned, but not specifically handled. That in turn
will lead to action suspension. However, this does not make sense
because messages over the UDP max message size simply cannot be sent.
This patch truncates the message in question and reports an error
message with the condition.
closes https://github.com/rsyslog/rsyslog/issues/1654
when omfwd is used with the $streamdriverpermittedpeers legacy
parameter, a memory corruption can occur. This depends on the
length of the provided strings and probably the malloc subsystem.
Once config parsing succeeds, no problem can happen.
Thanks to Brent Douglas for initially reporting this issue and
providing great analysis.
Thanks to github user bwdoll for analyzing this bug and providing
a suggested fix (which is almost what this commit includes).
closes https://github.com/rsyslog/rsyslog/issues/1408
closes https://github.com/rsyslog/rsyslog/issues/1474
In many cases, no error message were emitted when omfwd
went into action suspension, which was confusing for end
users. This patch enables explicit error messages in all
those cases.
closes https://github.com/rsyslog/rsyslog/issues/782
Generally improved udp-related error messages (e.g. they now contain the
socket number, which makes it easier to related them to errors reported by
net.c subsystem).
We also depricated (removed) the "maxerrormessages" configuration parameters.
It provided some very rough rate-limiting capabilities and was introduced
before we had native rate-limiters. The default was that only the first 5
error messages were actually reported. For long-running instances, that
meant that in many cases no errors were ever reported. We now use the default
internal message rate limter, which works far better and ensures that also
long-running instances will be able to emit error messages after prolonged
runtime. In contrast, this also means that users will see more error
messages from rsyslog, but that should actually improve the end user
experience.
Network namespaces are part of the linux kernel since v2.6.24. This
enables forwarding output into a configurable network namespace. E.g.,
action(type="omfwd" networknamespace="my_ns" target="192.168.1.23"
port="10514")
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Add support for bind-to-device option to omfwd and imudp modules.
Configured using device="name". Only new syntax format is supported.
e.g.,
input(type="imudp" port=["10514"] device="eth0" name="udp")
action(type="omfwd" Target="192.168.1.23" Port="10514" Device="eth0")
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
doTryResume uses bIsConnected to know if socket initializations need
to be done. It should only be set if pWrkrData->pSockArray is non-NULL
meaning create_udp_socket succeeded. As it stands the re-init is
attempted only once and if it fails never tried again.
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
due to being inconsistently spelled. This lead to an internal
program error, which unfortunately was only reported to the
debug log.
This patch both fixes the problem and also emits the internal
program error message to the regular log stream (in case a similar
problem re-occurs in the future). A testbench test is also added.
closes https://github.com/rsyslog/rsyslog/issues/916
those starting at column 0 are temporary debug aids during development.
Some of them I intend to keep in for a version or two. Some of them
I tend to forget later. This is a cleanup of those. Most are removed,
some are promoted to be permanently there - now indicated by proper
indention.
unfortunately, there is no real "fix" for this border case. It
is unlikely to cause real trouble, but we now at least emit an
indictor message to the debug log. If for some reason a real
fix is needed, we need to redesign the core action API.
The general question remains if it is good practice to use
const for dynamically allocted memory (as free takes a non-const
and, in a sense, modifies the object).
In this case, no harm can happen from that.
It now contains the errno as numerical value in order to be
able to more precisely nail down the problem cause. The
strerror() generated message sometimes seems to be a bit
questionable.
Also refactored error processing a bit to take advantage of
the improved error reporting subsystem.