Date: Wed, 05 Apr 2006 11:22:06 -0700 From: Julian Elischer <julian@elischer.org> To: Julian Elischer <julian@elischer.org> Cc: current@freebsd.org Subject: Re: change to syslog to allow specifying prot to send to.. Message-ID: <44340ACE.5020106@elischer.org> In-Reply-To: <443310BF.4030600@elischer.org> References: <443310BF.4030600@elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Duh, that would be "port" not "prot" Julian Elischer wrote: > Does anyone think that this would be useful? > > the syslog.conf line would look like: > > > *.* @logger.mynet.com:823 > > Index: syslogd.c > =================================================================== > RCS file: /usr/local/cvsroot/freebsd/src/usr.sbin/syslogd/syslogd.c,v > retrieving revision 1.59.2.28 > diff -u -r1.59.2.28 syslogd.c > --- syslogd.c 29 Feb 2004 20:59:19 -0000 1.59.2.28 > +++ syslogd.c 5 Apr 2006 00:33:14 -0000 > @@ -168,7 +168,7 @@ > struct { > char f_hname[MAXHOSTNAMELEN]; > struct addrinfo *f_addr; > - > + u_short port; > } f_forw; /* forwarding address */ > char f_fname[MAXPATHLEN]; > struct { > @@ -1749,14 +1749,30 @@ > p++; > > switch (*p) { > + char * tp; > + char *tp2; > case '@': > - (void)strlcpy(f->f_un.f_forw.f_hname, ++p, > + /* > + * scan forward to see if there is a port defined. > + */ > + tp2 = NULL; > + tp = ++p; > + while (*tp && (*tp++ != ':')) ; > + if (*tp == ':') { > + *tp++ = '\0'; > + if (*tp) { > + tp2 = tp; > + } > + } > + > + (void)strlcpy(f->f_un.f_forw.f_hname, p, > sizeof(f->f_un.f_forw.f_hname)); > + if (tp2) *--tp = ':'; > 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); > + error = getaddrinfo(f->f_un.f_forw.f_hname, > + tp2 ? tp2: "syslog", &hints, &res); > if (error) { > logerror(gai_strerror(error)); > break; > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to > "freebsd-current-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44340ACE.5020106>