change to syslog to allow specifying prot to send to..

From: Julian Elischer <julian_at_elischer.org>
Date: Tue, 04 Apr 2006 17:35:11 -0700
Does anyone think that  this would be useful?

the syslog.conf line would look like:


*.*                         _at_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
_at__at_ -168,7 +168,7 _at__at_
                struct {
                        char    f_hname[MAXHOSTNAMELEN];
                        struct addrinfo *f_addr;
-
+                       u_short port;
                } f_forw;               /* forwarding address */
                char    f_fname[MAXPATHLEN];
                struct {
_at__at_ -1749,14 +1749,30 _at__at_
                p++;
 
        switch (*p) {
+               char * tp;
+               char *tp2;
        case '_at_':
-               (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;
Received on Tue Apr 04 2006 - 22:35:14 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:54 UTC