rpms/sysklogd/FC-6 sysklogd-1.4.1-ipv6.patch, NONE, 1.1 sysklogd.spec, 1.39, 1.40

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Nov 23 13:51:31 UTC 2006


Author: pvrabec

Update of /cvs/dist/rpms/sysklogd/FC-6
In directory cvs.devel.redhat.com:/tmp/cvs-serv15346

Modified Files:
	sysklogd.spec 
Added Files:
	sysklogd-1.4.1-ipv6.patch 
Log Message:
add ipv6 support


sysklogd-1.4.1-ipv6.patch:
 Makefile   |    2 
 sysklogd.8 |   21 +++
 syslogd.c  |  383 ++++++++++++++++++++++++++++++++++++++-----------------------
 3 files changed, 263 insertions(+), 143 deletions(-)

--- NEW FILE sysklogd-1.4.1-ipv6.patch ---
--- sysklogd-1.4.1rh/Makefile.ipv6	2004-02-12 16:49:20.000000000 +0100
+++ sysklogd-1.4.1rh/Makefile	2006-11-23 13:45:34.000000000 +0100
@@ -44,7 +44,7 @@
 # ballot below.
 SYSLOGD_PIDNAME = -DSYSLOGD_PIDNAME=\"syslogd.pid\"
 
-SYSLOGD_FLAGS= -DSYSLOG_INET -DSYSLOG_UNIXAF -DNO_SCCS ${FSSTND} \
+SYSLOGD_FLAGS= -DSYSLOG_INET -DSYSLOG_UNIXAF -DINET6 -DNO_SCCS ${FSSTND} \
 	${SYSLOGD_PIDNAME}
 SYSLOG_FLAGS= -DALLOW_KERNEL_LOGGING
 KLOGD_FLAGS = ${FSSTND} ${KLOGD_START_DELAY}
--- sysklogd-1.4.1rh/sysklogd.8.ipv6	2001-07-09 06:17:22.000000000 +0200
+++ sysklogd-1.4.1rh/sysklogd.8	2006-11-23 13:45:34.000000000 +0100
@@ -7,6 +7,7 @@
 sysklogd \- Linux system logging utilities.
 .SH SYNOPSIS
 .B syslogd
+.RB [ " \-46A " ]
 .RB [ " \-a "
 .I socket
 ]
@@ -75,6 +76,26 @@
 .LP
 .SH OPTIONS
 .TP
+.BI "\-4"
+Force 
+.B syslogd 
+to use IPv4 addresses only.
+.TP
+.BI "\-6"
+Force 
+.B syslogd 
+to use IPv6 addresses only.
+.TP
+.BI "\-A"
+Ordinarily, 
+.B syslogd 
+tries to send the message to only one address
+even if the host has more than one A or AAAA record.  If this
+option is specified, 
+.B syslogd 
+tries to send the message to all
+addresses.
+.TP
 .BI "\-a " "socket"
 Using this argument you can specify additional sockets from that
 .B syslogd
--- sysklogd-1.4.1rh/syslogd.c.ipv6	2006-11-23 13:45:34.000000000 +0100
+++ sysklogd-1.4.1rh/syslogd.c	2006-11-23 14:22:58.000000000 +0100
@@ -566,7 +566,6 @@
 
 char	**parts;
 
-int inetm = 0;
 static int debugging_on = 0;
 static int nlogs = -1;
 static int restart = 0;
@@ -626,22 +625,23 @@
 	short	f_type;			/* entry type, see below */
 	short	f_file;			/* file descriptor */
 	time_t	f_time;			/* time this was last written */
+	char    *f_host;                /* host from which to recd. */
 	u_char	f_pmask[LOG_NFACILITIES+1];	/* priority mask */
 	union {
 		char	f_uname[MAXUNAMES][UNAMESZ+1];
 		struct {
-			char	f_hname[MAXHOSTNAMELEN+1];
-			struct sockaddr_in	f_addr;
+			char	f_hname[MAXHOSTNAMELEN];
+			struct addrinfo	*f_addr;
 		} f_forw;		/* forwarding address */
 		char	f_fname[MAXFNAME];
 	} f_un;
 	char	f_prevline[MAXSVLINE];		/* last message logged */
 	char	f_lasttime[16];			/* time of last occurrence */
-	char	f_prevhost[MAXHOSTNAMELEN+1];	/* host from which recd. */
+	char	f_prevhost[MAXHOSTNAMELEN];	/* host from which recd. */
 	int	f_prevpri;			/* pri of f_prevline */
 	int	f_prevlen;			/* length of f_prevline */
 	int	f_prevcount;			/* repetition cnt of prevline */
-	int	f_repeatcount;			/* number of "repeated" msgs */
+	u_int	f_repeatcount;			/* number of "repeated" msgs */
 	int	f_flags;			/* store some additional flags */
 };
 
@@ -734,13 +734,19 @@
 };
 
 int	Debug;			/* debug flag */
-char	LocalHostName[MAXHOSTNAMELEN+1];	/* our hostname */
-char	*LocalDomain;		/* our local domain name */
+int     resolve = 1;            /* resolve hostname */
+char	LocalHostName[MAXHOSTNAMELEN];	/* our hostname */
+const char	*LocalDomain;		/* our local domain name */
 int	InetInuse = 0;		/* non-zero if INET sockets are being used */
-int	finet= -1;		/* Internet datagram socket */
-int	LogPort;		/* port number for INET connections */
+int	* finet = NULL;		/* Internet datagram socket */
 int	Initialized = 0;	/* set when we have initialized ourselves */
 int	MarkInterval = 20 * 60;	/* interval between marks in seconds */
+#ifdef INET6
+int     family = PF_UNSPEC;     /* protocol family (IPv4, IPv6 or both) */
+#else
+int     family = PF_INET;       /* protocol family (IPv4 only) */
+#endif
+int     send_to_all = 0;        /* send message to all IPv4/IPv6 addresses */
 int	MarkSeq = 0;		/* mark sequence number */
 int	NoFork = 0; 		/* don't fork - don't run in daemon mode */
 int     DisableDNS = 0;		/* don't look up IP addresses of incoming messages */
@@ -765,12 +771,13 @@
 void endtty();
 void wallmsg(register struct filed *f, struct iovec *iov);
 void reapchild();
-const char *cvthname(struct sockaddr_in *f);
+const char *cvthname(struct sockaddr_storage *f);
 void domark();
 void alarm_handler(int sig);
 void debug_switch();
-void logerror(char *type);
+void logerror(const char *type);
 void die(int sig);
+static void free_host_ai_list( struct addrinfo *ai );
 void exit_signal_handler(int sig);
 #ifndef TESTING
 void doexit(int sig);
@@ -789,12 +796,12 @@
 static int create_unix_socket(const char *path);
 #endif
 #ifdef SYSLOG_INET
-static int create_inet_socket();
+static int * create_inet_sockets();
 #endif
 
 static struct addrinfo *host_ai_list( char *host );
 static int    hosts_equal(struct addrinfo *ai1, struct addrinfo *ai2);
-static struct in_addr *not_local_address( char *host );
+static struct addrinfo *not_local_address( char *host );
 
 int main(argc, argv)
 	int argc;
@@ -828,12 +835,13 @@
 #ifndef TESTING
 	int	fd;
 #ifdef  SYSLOG_INET
-	struct sockaddr_in frominet;
-	char *from;
+	struct sockaddr_storage frominet;
+	const char *from;
 #endif
 	pid_t ppid = getpid();
 #endif
 	int ch;
+	int l;
 	struct hostent *hent;
 
 	char line[MAXLINE +1];
@@ -849,8 +857,19 @@
 		funix[i]  = -1;
 	}
 
-	while ((ch = getopt(argc, argv, "a:dhf:l:m:np:rs:vx")) != EOF)
+	while ((ch = getopt(argc, argv, "46Aa:dhf:l:m:np:rs:vx")) != EOF)
 		switch((char)ch) {
+                case '4':
+                              family = PF_INET;
+                              break;
+#ifdef INET6
+                case '6':
+                              family = PF_INET6;
+                              break;
+#endif
+                case 'A':
+                              send_to_all++;
+			      break;
 		case 'a':
 			if (nfunix < MAXFUNIX)
 				funixn[nfunix++] = optarg;
@@ -1085,8 +1104,11 @@
 		 * descriptors.
 		 */
 		if ( InetInuse && AcceptRemote ) {
-			FD_SET(inetm, &readfds);
-			if (inetm>maxfds) maxfds=inetm;
+			for (i = 0; i < *finet; i++) {
+                        	if (finet[i+1] != -1)
+                                	FD_SET(finet[i+1], &readfds);
+					if (finet[i+1]>maxfds) maxfds=finet[i+1];
+			}
 			dprintf("Listening on syslog UDP port.\n");
 		}
 #endif
@@ -1171,33 +1193,30 @@
 #endif
 
 #ifdef SYSLOG_INET
-		if (InetInuse && AcceptRemote && FD_ISSET(inetm, &readfds)) {
-			len = sizeof(frominet);
-			memset(line, '\0', sizeof(line));
-			i = recvfrom(finet, line, MAXLINE - 2, 0, \
-				     (struct sockaddr *) &frominet, &len);
-			dprintf("Message from inetd socket: #%d, host: %s\n",
-				inetm, inet_ntoa(frominet.sin_addr));
-			if (i > 0) {
-				line[i] = line[i+1] = '\0';
-				from = (char *)cvthname(&frominet);
-				/*
-				 * Here we could check if the host is permitted
-				 * to send us syslog messages. We just have to
-				 * catch the result of cvthname, look for a dot
-				 * and if that doesn't exist, replace the first
-				 * '\0' with '.' and we have the fqdn in lowercase
-				 * letters so we could match them against whatever.
-				 *  -Joey
-				 */
-				printchopped(from, line, \
- 					     i + 2,  finet);
-			} else if (i < 0 && errno != EINTR) {
-				dprintf("INET socket error: %d = %s.\n", \
-					errno, strerror(errno));
-				logerror("recvfrom inet");
-				/* should be harmless */
-				sleep(10);
+		if (InetInuse && AcceptRemote && finet) {
+			for (i = 0; i < *finet; i++) {
+				if (FD_ISSET(finet[i+1], &readfds)) {
+					len = sizeof(frominet);
+					memset(line, '\0', sizeof(line));
+					l = recvfrom(finet[i+1], line, MAXLINE - 2,
+						     0, (struct sockaddr *)&frominet,
+						     &len);
+					if (l > 0) {
+						line[l] = line[l-1] = '\0';
+						from = cvthname(&frominet);
+						printchopped(from, line, l + 2,  finet[i+1]);
+						dprintf("Message from inetd socket: #%d, host: %s\n",
+        	                                        finet[i+1], from);
+					} 
+					else 
+						if (l < 0 && errno != EINTR) {
+		  	                              	dprintf("INET socket error: %d = %s.\n",
+                                                                errno, strerror(errno));
+							logerror("recvfrom inet");
+							/* should be harmless */
+		                        	        sleep(10);
+						}	
+				}
 			}
 		}
 #endif
@@ -1224,7 +1243,7 @@
 
 int usage()
 {
-	fprintf(stderr, "usage: syslogd [-drvxh] [-l hostlist] [-m markinterval] [-n] [-p path]\n" \
+	fprintf(stderr, "usage: syslogd [-46Adrvxh] [-l hostlist] [-m markinterval] [-n] [-p path]\n" \
 		" [-s domainlist] [-f conffile]\n");
 	exit(1);
 }
@@ -1262,32 +1281,71 @@
 #endif
 
 #ifdef SYSLOG_INET
-static int create_inet_socket()
+static int * create_inet_sockets()
 {
-	int fd, on = 1;
-	struct sockaddr_in sin;
-
-	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");
-		close(fd);
-		return -1;
-	}
-	if (bind(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0) {
-		logerror("bind, suspending inet");
-		close(fd);
-		return -1;
-	}
-	return fd;
+	struct addrinfo hints, *res, *r;
+        int error, maxs, *s, *socks;
+      
+        memset(&hints, 0, sizeof(hints));
+        hints.ai_flags = AI_PASSIVE;
+        hints.ai_family = family;
+        hints.ai_socktype = SOCK_DGRAM;
+        error = getaddrinfo(NULL, "syslog", &hints, &res);
+        if (error) {
+        	logerror(gai_strerror(error));
+                errno = 0;
+                die(0);
+        }
+      
+        /* Count max number of sockets we may open */
+        for (maxs = 0, r = res; r; r = r->ai_next, maxs++);
+        socks = malloc((maxs+1) * sizeof(int));
+        if (!socks) {
+	        logerror("couldn't allocate memory for sockets");
+        	die(0);
+        }
+      
+        *socks = 0;   /* num of sockets counter at start of array */
+        s = socks + 1;
+        for (r = res; r; r = r->ai_next) {
+	        *s = socket(r->ai_family, r->ai_socktype, r->ai_protocol);
+        	if (*s < 0) {
+                	logerror("socket");
+                        continue;
+		}
+
+                if (r->ai_family == AF_INET6) {
+        	        int on = 1;
+               		if (setsockopt(*s, IPPROTO_IPV6, IPV6_V6ONLY,
+                        	       (char *)&on, sizeof (on)) < 0) {
+	                	logerror("setsockopt");
+                        	close(*s);
+                        	continue;
+	                }
+        	}
+
+                if (bind(*s, r->ai_addr, r->ai_addrlen) < 0) {
+	        	close(*s);
+         	        logerror("bind");
+                	continue;
+                }
+      
+                (*socks)++;
+                s++;
+	}
+      
+        if (*socks == 0) {
+        	free(socks);
+                if (Debug)
+                	return(NULL);
+                else
+                	die(0);
+	}
+
+        if (res)
+		freeaddrinfo(res);
+      
+	return(socks);
 }
 #endif
 
@@ -1699,13 +1757,15 @@
 	char *msg;
 {
 	struct iovec iov[6];
+	struct addrinfo *r;
 	register struct iovec *v = iov;
 	char repbuf[80];
 #ifdef SYSLOG_INET
 	register int l;
+	int i,lsent = 0;
 	char line[MAXLINE + 1];
 	time_t fwd_suspend;
-	struct in_addr *ina;
+	struct addrinfo *saddr;
 #endif
 
 	dprintf("Called fprintlog, ");
@@ -1774,7 +1834,7 @@
 		fwd_suspend = time((time_t *) 0) - f->f_time;
 		if ( fwd_suspend >= INET_SUSPEND_TIME ) {
 			dprintf("Forwarding suspension to unknown over, retrying\n");
-			if ( (ina = not_local_address(f->f_un.f_forw.f_hname)) == NULL ) {
+			if ( (saddr = not_local_address(f->f_un.f_forw.f_hname)) == NULL ) {
 				dprintf("Failure: %s\n", sys_h_errlist[h_errno]);
 				dprintf("Retries: %d\n", f->f_prevcount);
 				if ( --f->f_prevcount < 0 ) {
@@ -1786,10 +1846,9 @@
 			}
 			else {
 			        dprintf("%s found, resuming.\n", f->f_un.f_forw.f_hname);
-				memcpy((char *) &f->f_un.f_forw.f_addr.sin_addr, ina, sizeof(struct in_addr));
+				f->f_un.f_forw.f_addr = saddr;
 				f->f_prevcount = 0;
 				f->f_type = F_FORW;
-				free(ina);
 				goto f_forw;
 			}
 		}
@@ -1815,15 +1874,31 @@
 			l = strlen(line);
 			if (l > MAXLINE)
 				l = MAXLINE;
-			if (sendto(finet, line, l, 0, \
-				   (struct sockaddr *) &f->f_un.f_forw.f_addr,
-				   sizeof(f->f_un.f_forw.f_addr)) != l) {
-				int e = errno;
-				dprintf("INET sendto error: %d = %s.\n", 
-					e, strerror(e));
-				f->f_type = F_FORW_SUSP;
-				errno = e;
-				logerror("sendto");
+			if (finet) {
+				for (r = f->f_un.f_forw.f_addr; r; r = r->ai_next) {
+					for (i = 0; i < *finet; i++) {
+#if 0
+					/*
+					 * should we check AF first, or just
+					 * trial and error? FWD
+					*/ 
+					if (r->ai_family == address_family_of(finet[i+1]))
+#endif
+                                        lsent = sendto(finet[i+1], line, l, 0,
+                                                       r->ai_addr, r->ai_addrlen);
+                                        if (lsent == l)
+                                        	break;
+                                      }
+                                      if (lsent == l && !send_to_all)
+	                                      break;
+                              }
+                              if (lsent != l) {
+                                      int e = errno;
+				      dprintf("INET sendto error: %d = %s.\n", e, strerror(e));
+				      f->f_type = F_FORW_SUSP;
+                                      errno = e;
+                                      logerror("sendto");
+                              }
 			}
 		}
 		break;
@@ -2043,30 +2118,48 @@
  * Return a printable representation of a host address.
  */
 const char *cvthname(f)
-	struct sockaddr_in *f;
+	struct sockaddr_storage *f;
 {
-	struct hostent *hp;
+	int error;
 	register char *p;
+	sigset_t omask, nmask;
 	int count;
+	static char hname[NI_MAXHOST], ip[NI_MAXHOST];
+
+	error = getnameinfo((struct sockaddr *)f,
+                            sizeof(*f),
+                            ip, sizeof ip, NULL, 0,
+                            NI_NUMERICHOST);
+        dprintf("cvthname(%s)\n", ip);
 
-	if (f->sin_family != AF_INET) {
-		dprintf("Malformed from address.\n");
+	if (error) {
+		dprintf("Malformed from address %s\n", gai_strerror(error));
 		return ("???");
 	}
-	if (DisableDNS)
-	  hp = 0;
-	else
-	  hp = gethostbyaddr((char *) &f->sin_addr, sizeof(struct in_addr), \
-			   f->sin_family);
-	if (hp == 0) {
-		dprintf("Host name for your address (%s) unknown.\n",
-			inet_ntoa(f->sin_addr));
-		return (inet_ntoa(f->sin_addr));
+
+	
+	if (!DisableDNS) {
+		sigemptyset(&nmask);
+		sigaddset(&nmask, SIGHUP);
+		sigprocmask(SIG_BLOCK, &nmask, &omask);
+
+		error = getnameinfo((struct sockaddr *)f,
+				    sizeof(*f),
+                                    hname, sizeof hname, NULL, 0,
+                                    NI_NAMEREQD);
+
+        	sigprocmask(SIG_SETMASK, &omask, NULL);
+	}
+
+	if (error || DisableDNS) {
+		dprintf("Host name for your address (%s) unknown\n", ip);
+		return (ip);
 	}
+
 	/*
 	 * Convert to lower case, just like LocalDomain above
 	 */
-	for (p = (char *)hp->h_name; *p ; p++)
+	for (p = (char *) hname; *p ; p++)
 		if (isupper(*p))
 			*p = tolower(*p);
 
@@ -2074,17 +2167,17 @@
 	 * Notice that the string still contains the fqdn, but your
 	 * hostname and domain are separated by a '\0'.
 	 */
-	if ((p = strchr(hp->h_name, '.'))) {
+	if ((p = strchr(hname, '.'))) {
 		if (strcmp(p + 1, LocalDomain) == 0) {
 			*p = '\0';
-			return (hp->h_name);
+			return (hname);
 		} else {
 			if (StripDomains) {
 				count=0;
 				while (StripDomains[count]) {
 					if (strcmp(p + 1, StripDomains[count]) == 0) {
 						*p = '\0';
-						return (hp->h_name);
+						return (hname);
 					}
 					count++;
 				}
@@ -2092,9 +2185,9 @@
 			if (LocalHosts) {
 				count=0;
 				while (LocalHosts[count]) {
-					if (!strcmp(hp->h_name, LocalHosts[count])) {
+					if (!strcmp(hname, LocalHosts[count])) {
 						*p = '\0';
-						return (hp->h_name);
+						return (hname);
 					}
 					count++;
 				}
@@ -2102,7 +2195,7 @@
 		}
 	}
 
-	return (hp->h_name);
+	return (hname);
 }
 
 void alarm_handler( int sig )
@@ -2158,7 +2251,7 @@
  * Print syslogd errors some place.
  */
 void logerror(type)
-	char *type;
+	const char *type;
 {
 	char buf[100];
 
@@ -2206,8 +2299,14 @@
         for (i = 0; i < nfunix; i++)
 		if (funix[i] != -1)
 			close(funix[i]);
+
 	/* Close the inet socket. */
-	if (InetInuse) close(inetm);
+	if (InetInuse && finet)
+        	for (i = 0; i < *finet; i++)
+                	if (finet[i+1] != -1) close(finet[i+1]);
+	free(finet);
+        finet = NULL;
+
 
 	/* Clean-up files. */
         for (i = 0; i < nfunix; i++)
@@ -2268,7 +2367,6 @@
 		logerror("see syslogd(8) for details of whether and how to enable it.");
 		return;
 	}
-	LogPort = sp->s_port;
 
 	/*
 	 *  Close all open log files and free log descriptor array.
@@ -2293,6 +2391,9 @@
 				case F_CONSOLE:
 					(void) close(f->f_file);
 				break;
+				case F_FORW:
+					freeaddrinfo(f->f_un.f_forw.f_addr);
+				break;
 			}
 		}
 
@@ -2402,21 +2503,22 @@
 
 #ifdef SYSLOG_INET
 	if (Forwarding || AcceptRemote) {
-		if (finet < 0) {
-			finet = create_inet_socket();
-			if (finet >= 0) {
+		if (!finet) {
+			finet = create_inet_sockets();
+			if (*finet > 0) {
 				InetInuse = 1;
 				dprintf("Opened syslog UDP port.\n");
 			}
 		}
 	}
 	else {
-		if (finet >= 0)
-			close(finet);
-		finet = -1;
+		if (finet)
+			for (i = 0; i < *finet; i++)
+				if (finet[i+1] != -1) close(finet[i+1]);
+		free(finet);
+		finet = NULL;
 		InetInuse = 0;
 	}
-	inetm = finet;
 #endif
 
 	Initialized = 1;
@@ -2496,6 +2598,8 @@
 	char *line;
 	register struct filed *f;
 {
+	struct addrinfo hints, *res;
+	int error;
 	register char *p;
 	register char *q;
 	register int i, i2;
@@ -2505,7 +2609,7 @@
 	int ignorepri = 0;
 	int syncfile;
 #ifdef SYSLOG_INET
-	struct in_addr *ina;
+	struct addrinfo *ina;
 #endif
 	char buf[MAXLINE];
 	char xbuf[200];
@@ -2661,7 +2765,8 @@
 	{
 	case '@':
 #ifdef SYSLOG_INET
-		(void) strcpy(f->f_un.f_forw.f_hname, ++p);
+		(void)strncpy(f->f_un.f_forw.f_hname, ++p,
+	                      sizeof(f->f_un.f_forw.f_hname));
 		dprintf("forwarding host: %s\n", p);	/*ASP*/
 		 if ( (ina = not_local_address(p)) == NULL ) {
 			f->f_type = F_FORW_UNKN;
@@ -2669,17 +2774,20 @@
 			f->f_time = time ( (time_t *)0 );
 		} else {
 			f->f_type = F_FORW;
+			freeaddrinfo(ina);
 		}
 
-		memset((char *) &f->f_un.f_forw.f_addr, 0,
-			 sizeof(f->f_un.f_forw.f_addr));
-		f->f_un.f_forw.f_addr.sin_family = AF_INET;
-		f->f_un.f_forw.f_addr.sin_port = LogPort;
-		if ( f->f_type == F_FORW )
-		{
-			memcpy((char *) &f->f_un.f_forw.f_addr.sin_addr, ina, sizeof(struct in_addr));
-			free(ina);
+		memset(&hints, 0, sizeof(hints));
+		hints.ai_family = family;
+		hints.ai_socktype = SOCK_DGRAM;
+		error = getaddrinfo(f->f_un.f_forw.f_hname, "syslog", &hints,
+				    &res);
+		if (error) {
+			logerror(gai_strerror(error));
+			break;
 		}
+		if ( f->f_type == F_FORW )
+			f->f_un.f_forw.f_addr = res;
 		/*
 		 * Otherwise the host might be unknown due to an
 		 * inaccessible nameserver (perhaps on the same
@@ -2994,12 +3102,11 @@
     return ((ai1 != 0L) && (ai != 0L));
 }
 
-struct in_addr *not_local_address(char *host)
+struct addrinfo *not_local_address(char *host)
 {
     char hostname[1024];
-    struct addrinfo *ai1, *ai2, *ai_next=0;
+    struct addrinfo *ai1, *ai2;
     struct ifaddrs *ifa=0L;
-    struct in_addr *ina=0L;
     if ( host == 0L )
        return 0L;
     if(  (strcmp(host,"localhost") == 0)
@@ -3012,8 +3119,11 @@
 	    return 0L;
     ai1 = host_ai_list(host);
     ai2 = host_ai_list(hostname);
-    if( hosts_equal(ai1, ai2) )
+    if( hosts_equal(ai1, ai2) ) {
+	free_host_ai_list(ai2);
+	free_host_ai_list(ai1);
 	return 0L;
+    }
     free_host_ai_list(ai2);
     ai2=0L;
     if( getifaddrs(&ifa) == 0)
@@ -3043,22 +3153,11 @@
     if( ai2 != 0L )
     {
         free_host_ai_list(ai2);
-        return 0L;
-    }
-    for(ai2 = ai1; ai2 != 0L; ai2 = ai_next)
-    {
-        if ( (ai2->ai_addr != 0L) && (ai2->ai_addr->sa_family == PF_INET))
-            break;
-    }
-    if( ai2 != 0L )
-    {
-        ina = (struct in_addr *)malloc(sizeof(struct in_addr));
-        memcpy(ina,&(((struct sockaddr_in*)ai2->ai_addr)->sin_addr), sizeof(struct in_addr));
         free_host_ai_list(ai1);
-        return ina;
+        return 0L;
     }
-    free_host_ai_list(ai1);
-    return 0L;
+
+    return ai1;
 }
 
 /*


Index: sysklogd.spec
===================================================================
RCS file: /cvs/dist/rpms/sysklogd/FC-6/sysklogd.spec,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- sysklogd.spec	13 Sep 2006 10:50:33 -0000	1.39
+++ sysklogd.spec	23 Nov 2006 13:51:29 -0000	1.40
@@ -1,7 +1,7 @@
 Summary: System logging and kernel message trapping daemons.
 Name: sysklogd
 Version: 1.4.1
-Release: 39.2
+Release: 40%{?dist}
 License: GPL
 Group: System Environment/Daemons
 Source: sysklogd-%{version}rh.tar.gz
@@ -20,6 +20,7 @@
 Patch5: sysklogd-1.4.1-reload.patch
 Patch6: sysklogd-1.4.1-umask.patch
 Patch7: sysklogd-1.4.1-disable__syslog_chk.patch
+Patch8: sysklogd-1.4.1-ipv6.patch
 
 %description
 The sysklogd package contains two system utilities (syslogd and klogd)
@@ -40,6 +41,7 @@
 %patch5 -p1 -b .reload
 %patch6 -p1 -b .umask
 %patch7 -p1 -b .disable__syslog_chk
+%patch8 -p1 -b .ipv6
 
 %build
 make %{?_smp_mflags}
@@ -103,6 +105,9 @@
 %{_mandir}/*/*
 
 %changelog
+* Thu Nov 23 2006 Peter Vrabec <pvrabec at redhat.com> 1.4.1-40
+- add IPv6 support
+
 * Wed Sep 13 2006 Florian La Roche <laroche at redhat.com> - 1.4.1-39.2
 - make sure scripts don't return an error
 




More information about the fedora-cvs-commits mailing list