]>
Commit | Line | Data |
---|---|---|
cd1a2927 MT |
1 | diff -ur sysklogd-1.4.1.orig/sysklogd.8 sysklogd-1.4.1/sysklogd.8 |
2 | --- sysklogd-1.4.1.orig/sysklogd.8 Sun Mar 11 22:35:51 2001 | |
3 | +++ sysklogd-1.4.1/sysklogd.8 Mon Oct 8 07:20:31 2001 | |
4 | @@ -2,7 +2,7 @@ | |
5 | .\" May be distributed under the GNU General Public License | |
6 | .\" Sun Aug 30 11:35:55 MET: Martin Schulze: Updates | |
7 | .\" | |
8 | -.TH SYSKLOGD 8 "12 October 1998" "Version 1.3" "Linux System Administration" | |
9 | +.TH SYSKLOGD 8 "8 October, 2001" "Version 1.4.1+CAEN/OW" "Linux System Administration" | |
10 | .SH NAME | |
11 | sysklogd \- Linux system logging utilities. | |
12 | .SH SYNOPSIS | |
13 | @@ -15,6 +15,9 @@ | |
14 | .I config file | |
15 | ] | |
16 | .RB [ " \-h " ] | |
17 | +.RB [ " \-i " | |
18 | +.I IP address | |
19 | +] | |
20 | .RB [ " \-l " | |
21 | .I hostlist | |
22 | ] | |
23 | @@ -103,6 +106,13 @@ | |
24 | Specifying this switch on the command line will cause the log daemon to | |
25 | forward any remote messages it receives to forwarding hosts which have been | |
26 | defined. | |
27 | +.TP | |
28 | +.BI "\-i " "IP address" | |
29 | +If | |
30 | +.B syslogd | |
31 | +is configured to accept log input from a UDP port, specify an IP address | |
32 | +to bind to, rather than the default of INADDR_ANY. The address must be in | |
33 | +dotted quad notation, DNS host names are not allowed. | |
34 | .TP | |
35 | .BI "\-l " "hostlist" | |
36 | Specify a hostname that should be logged only with its simple hostname | |
37 | diff -ur sysklogd-1.4.1.orig/syslogd.c sysklogd-1.4.1/syslogd.c | |
38 | --- sysklogd-1.4.1.orig/syslogd.c Sun Mar 11 22:40:10 2001 | |
39 | +++ sysklogd-1.4.1/syslogd.c Mon Oct 8 07:24:41 2001 | |
40 | @@ -736,6 +736,8 @@ | |
41 | int NoHops = 1; /* Can we bounce syslog messages through an | |
42 | intermediate host. */ | |
43 | ||
44 | +char *bind_addr = NULL; /* bind UDP port to this interface only */ | |
45 | + | |
46 | extern int errno; | |
47 | ||
48 | /* Function prototypes. */ | |
49 | @@ -829,7 +831,7 @@ | |
50 | funix[i] = -1; | |
51 | } | |
52 | ||
53 | - while ((ch = getopt(argc, argv, "a:dhf:l:m:np:rs:v")) != EOF) | |
54 | + while ((ch = getopt(argc, argv, "a:dhf:i:l:m:np:rs:v")) != EOF) | |
55 | switch((char)ch) { | |
56 | case 'a': | |
57 | if (nfunix < MAXFUNIX) | |
58 | @@ -846,9 +848,17 @@ | |
59 | case 'h': | |
60 | NoHops = 0; | |
61 | break; | |
62 | + case 'i': | |
63 | + if (bind_addr) { | |
64 | + fprintf(stderr, "Only one -i argument allowed, " | |
65 | + "the first one is taken.\n"); | |
66 | + break; | |
67 | + } | |
68 | + bind_addr = optarg; | |
69 | + break; | |
70 | case 'l': | |
71 | if (LocalHosts) { | |
72 | - fprintf (stderr, "Only one -l argument allowed," \ | |
73 | + fprintf(stderr, "Only one -l argument allowed, " | |
74 | "the first one is taken.\n"); | |
75 | break; | |
76 | } | |
77 | @@ -1175,7 +1185,7 @@ | |
78 | int usage() | |
79 | { | |
80 | fprintf(stderr, "usage: syslogd [-drvh] [-l hostlist] [-m markinterval] [-n] [-p path]\n" \ | |
81 | - " [-s domainlist] [-f conffile]\n"); | |
82 | + " [-s domainlist] [-f conffile] [-i IP address]\n"); | |
83 | exit(1); | |
84 | } | |
85 | ||
86 | @@ -1217,15 +1227,22 @@ | |
87 | int fd, on = 1; | |
88 | struct sockaddr_in sin; | |
89 | ||
90 | + memset(&sin, 0, sizeof(sin)); | |
91 | + sin.sin_family = AF_INET; | |
92 | + sin.sin_port = LogPort; | |
93 | + if (bind_addr) { | |
94 | + if (!inet_aton(bind_addr, &sin.sin_addr)) { | |
95 | + logerror("syslog: not a valid IP address to bind to."); | |
96 | + return -1; | |
97 | + } | |
98 | + } | |
99 | + | |
100 | fd = socket(AF_INET, SOCK_DGRAM, 0); | |
101 | if (fd < 0) { | |
102 | logerror("syslog: Unknown protocol, suspending inet service."); | |
103 | return fd; | |
104 | } | |
105 | ||
106 | - memset(&sin, 0, sizeof(sin)); | |
107 | - sin.sin_family = AF_INET; | |
108 | - sin.sin_port = LogPort; | |
109 | if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, \ | |
110 | (char *) &on, sizeof(on)) < 0 ) { | |
111 | logerror("setsockopt(REUSEADDR), suspending inet"); |