change to syslog to allow specifying prot to send to..
Julian Elischer
julian at elischer.org
Wed Apr 5 18:22:08 UTC 2006
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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to
> "freebsd-current-unsubscribe at freebsd.org"
More information about the freebsd-current
mailing list