Репозиторий Sisyphus
Последнее обновление: 15 октября 2021 | Пакетов: 17364 | Посещений: 22087329
en ru br
Репозитории ALT
S:1.8.0-alt1
5.1: 1.4.1-alt30
4.1: 1.4.1-alt28
4.0: 1.4.1-alt27
3.0: 1.4.1-alt20
www.altlinux.org/Changes

Группа :: Система/Ядро и оборудование
Пакет: sysklogd

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: sysklogd-1.4.2-caen-owl-syslogd-bind.patch
Скачать


diff -upk.orig sysklogd-1.4.2.orig/sysklogd.8 sysklogd-1.4.2/sysklogd.8
--- sysklogd-1.4.2.orig/sysklogd.8	2004-07-09 17:33:32 +0000
+++ sysklogd-1.4.2/sysklogd.8	2005-08-18 14:40:25 +0000
@@ -2,7 +2,7 @@
 .\" May be distributed under the GNU General Public License
 .\" Sun Aug 30 11:35:55 MET: Martin Schulze: Updates
 .\"
-.TH SYSKLOGD 8 "12 October 1998" "Version 1.3" "Linux System Administration"
+.TH SYSKLOGD 8 "8 October, 2001" "Version 1.4.1+CAEN/Owl" "Linux System Administration"
 .SH NAME
 sysklogd \- Linux system logging utilities.
 .SH SYNOPSIS
@@ -15,6 +15,9 @@ sysklogd \- Linux system logging utiliti
 .I config file
 ]
 .RB [ " \-h " ] 
+.RB [ " \-i "
+.I IP address
+]
 .RB [ " \-l "
 .I hostlist
 ]
@@ -104,6 +107,13 @@ Specifying this switch on the command li
 forward any remote messages it receives to forwarding hosts which have been
 defined.
 .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
 and not the fqdn.  Multiple hosts may be specified using the colon
diff -upk.orig sysklogd-1.4.2.orig/syslogd.c sysklogd-1.4.2/syslogd.c
--- sysklogd-1.4.2.orig/syslogd.c	2005-08-18 14:33:22 +0000
+++ sysklogd-1.4.2/syslogd.c	2005-08-18 14:40:25 +0000
@@ -774,6 +774,8 @@ char	**LocalHosts = NULL;	/* these hosts
 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. */
@@ -878,7 +880,7 @@ int main(argc, argv)
 		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)
@@ -895,9 +897,17 @@ int main(argc, argv)
 		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;
 			}
@@ -1244,7 +1254,7 @@ int main(argc, argv)
 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);
 }
 
@@ -1286,15 +1296,22 @@ static int create_inet_socket()
 	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");
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin