summaryrefslogtreecommitdiff
path: root/extra/sysklogd/sysklogd-1.4.1-caen-owl-syslogd-bind.diff
diff options
context:
space:
mode:
Diffstat (limited to 'extra/sysklogd/sysklogd-1.4.1-caen-owl-syslogd-bind.diff')
-rw-r--r--extra/sysklogd/sysklogd-1.4.1-caen-owl-syslogd-bind.diff104
1 files changed, 104 insertions, 0 deletions
diff --git a/extra/sysklogd/sysklogd-1.4.1-caen-owl-syslogd-bind.diff b/extra/sysklogd/sysklogd-1.4.1-caen-owl-syslogd-bind.diff
new file mode 100644
index 000000000..e79a67d0b
--- /dev/null
+++ b/extra/sysklogd/sysklogd-1.4.1-caen-owl-syslogd-bind.diff
@@ -0,0 +1,104 @@
+diff -ur sysklogd-1.4.1.orig/sysklogd.8 sysklogd-1.4.1/sysklogd.8
+--- sysklogd-1.4.1.orig/sysklogd.8 Sun Mar 11 22:35:51 2001
++++ sysklogd-1.4.1/sysklogd.8 Mon Oct 8 07:20:31 2001
+@@ -15,6 +15,9 @@
+ .I config file
+ ]
+ .RB [ " \-h " ]
++.RB [ " \-i "
++.I IP address
++]
+ .RB [ " \-l "
+ .I hostlist
+ ]
+@@ -103,8 +106,15 @@
+ Specifying this switch on the command line will cause the log daemon to
+ forward any remote messages it receives to forwarding hosts which have been
+ defined.
+ This can cause syslog loops that fill up hard disks quite fast and
+ thus needs to be used with caution.
++.TP
++.BI "\-i " "IP address"
++If
++.B syslogd
++is configured to accept log input from a UDP port, specify an IP address
++to bind to, rather than the default of INADDR_ANY. The address must be in
++dotted quad notation, DNS host names are not allowed.
+ .TP
+ .BI "\-l " "hostlist"
+ Specify a hostname that should be logged only with its simple hostname
+diff -ur sysklogd-1.4.1.orig/syslogd.c sysklogd-1.4.1/syslogd.c
+--- sysklogd-1.4.1.orig/syslogd.c Sun Mar 11 22:40:10 2001
++++ sysklogd-1.4.1/syslogd.c Mon Oct 8 07:24:41 2001
+@@ -736,6 +736,8 @@
+ int NoHops = 1; /* Can we bounce syslog messages through an
+ intermediate host. */
+
++char *bind_addr = NULL; /* bind UDP port to this interface only */
++
+ extern int errno;
+
+ /* Function prototypes. */
+@@ -829,7 +831,7 @@
+ funix[i] = -1;
+ }
+
+- while ((ch = getopt(argc, argv, "a:dhf:l:m:np:rs:v")) != EOF)
++ while ((ch = getopt(argc, argv, "a:dhf:i:l:m:np:rs:v")) != EOF)
+ switch((char)ch) {
+ case 'a':
+ if (nfunix < MAXFUNIX)
+@@ -846,9 +848,17 @@
+ case 'h':
+ NoHops = 0;
+ break;
++ case 'i':
++ if (bind_addr) {
++ fprintf(stderr, "Only one -i argument allowed, "
++ "the first one is taken.\n");
++ break;
++ }
++ bind_addr = optarg;
++ break;
+ case 'l':
+ if (LocalHosts) {
+- fprintf (stderr, "Only one -l argument allowed," \
++ fprintf(stderr, "Only one -l argument allowed, "
+ "the first one is taken.\n");
+ break;
+ }
+@@ -1175,7 +1185,7 @@
+ int usage()
+ {
+ fprintf(stderr, "usage: syslogd [-drvh] [-l hostlist] [-m markinterval] [-n] [-p path]\n" \
+- " [-s domainlist] [-f conffile]\n");
++ " [-s domainlist] [-f conffile] [-i IP address]\n");
+ exit(1);
+ }
+
+@@ -1217,15 +1227,22 @@
+ int fd, on = 1;
+ struct sockaddr_in sin;
+
++ memset(&sin, 0, sizeof(sin));
++ sin.sin_family = AF_INET;
++ sin.sin_port = LogPort;
++ if (bind_addr) {
++ if (!inet_aton(bind_addr, &sin.sin_addr)) {
++ logerror("syslog: not a valid IP address to bind to.");
++ return -1;
++ }
++ }
++
+ fd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (fd < 0) {
+ logerror("syslog: Unknown protocol, suspending inet service.");
+ return fd;
+ }
+
+- memset(&sin, 0, sizeof(sin));
+- sin.sin_family = AF_INET;
+- sin.sin_port = LogPort;
+ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, \
+ (char *) &on, sizeof(on)) < 0 ) {
+ logerror("setsockopt(REUSEADDR), suspending inet");