summaryrefslogtreecommitdiffstats
path: root/plugins/omudpspoof/omudpspoof.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-11-13 10:00:23 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2009-11-13 10:00:23 +0100
commit2a3c25a5c68db66ec35c155f7ecbe65079aed0e0 (patch)
treeb899a3cd256d60f3415753aa925c66fc0504373e /plugins/omudpspoof/omudpspoof.c
parentadb880f17bee807df6058ab3772eed3d35bd8d37 (diff)
parent8b246de2a587454f9260ff91192d27a2e168ea2d (diff)
downloadrsyslog-2a3c25a5c68db66ec35c155f7ecbe65079aed0e0.tar.gz
rsyslog-2a3c25a5c68db66ec35c155f7ecbe65079aed0e0.tar.xz
rsyslog-2a3c25a5c68db66ec35c155f7ecbe65079aed0e0.zip
Begin new beta branch
Merge branch 'master' into beta Conflicts: ChangeLog tests/Makefile.am
Diffstat (limited to 'plugins/omudpspoof/omudpspoof.c')
-rw-r--r--plugins/omudpspoof/omudpspoof.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/omudpspoof/omudpspoof.c b/plugins/omudpspoof/omudpspoof.c
index 8eb63c73..50bc6c9a 100644
--- a/plugins/omudpspoof/omudpspoof.c
+++ b/plugins/omudpspoof/omudpspoof.c
@@ -72,6 +72,7 @@
#include "errmsg.h"
#include "dirty.h"
#include "unicode-helper.h"
+#include "debug.h"
#include <libnet.h>
@@ -180,7 +181,8 @@ ENDdbgPrintInstInfo
/* Send a message via UDP
* rgehards, 2007-12-20
*/
-static rsRetVal UDPSend(instanceData *pData, uchar *pszSourcename, char *msg, size_t len)
+static inline rsRetVal
+UDPSend(instanceData *pData, uchar *pszSourcename, char *msg, size_t len)
{
struct addrinfo *r;
int lsent = 0;
@@ -207,9 +209,10 @@ static rsRetVal UDPSend(instanceData *pData, uchar *pszSourcename, char *msg, si
for (r = pData->f_addr; r; r = r->ai_next) {
tempaddr = (struct sockaddr_in *)r->ai_addr;
libnet_clear_packet(libnet_handle);
+ /* note: libnet does need ports in host order NOT in network byte order! -- rgerhards, 2009-11-12 */
udp = libnet_build_udp(
- pData->sourcePort, /* source port */
- tempaddr->sin_port, /* destination port */
+ ntohs(pData->sourcePort),/* source port */
+ ntohs(tempaddr->sin_port),/* destination port */
LIBNET_UDP_H + len, /* packet length */
0, /* checksum */
(u_char*)msg, /* payload */
@@ -339,13 +342,13 @@ CODESTARTdoAction
* hard-coded but this may be changed to a config parameter.
* rgerhards, 2006-11-30
*/
- if(pData->compressionLevel && (l > MIN_SIZE_FOR_COMPRESS)) {
+ if(pData->compressionLevel && (l > CONF_MIN_SIZE_FOR_COMPRESS)) {
Bytef *out;
uLongf destLen = iMaxLine + iMaxLine/100 +12; /* recommended value from zlib doc */
uLong srcLen = l;
int ret;
/* TODO: optimize malloc sequence? -- rgerhards, 2008-09-02 */
- CHKmalloc(out = (Bytef*) malloc(destLen));
+ CHKmalloc(out = (Bytef*) MALLOC(destLen));
out[0] = 'z';
out[1] = '\0';
ret = compress2((Bytef*) out+1, &destLen, (Bytef*) psz,