From owner-freebsd-current@FreeBSD.ORG Wed Apr 5 00:35:14 2006 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3B35516A401 for ; Wed, 5 Apr 2006 00:35:14 +0000 (UTC) (envelope-from julian@elischer.org) Received: from a50.ironport.com (a50.ironport.com [63.251.108.112]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF6CC43D45 for ; Wed, 5 Apr 2006 00:35:11 +0000 (GMT) (envelope-from julian@elischer.org) Received: from unknown (HELO [10.251.17.229]) ([10.251.17.229]) by a50.ironport.com with ESMTP; 04 Apr 2006 17:35:13 -0700 Message-ID: <443310BF.4030600@elischer.org> Date: Tue, 04 Apr 2006 17:35:11 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.11) Gecko/20050727 X-Accept-Language: en-us, en MIME-Version: 1.0 To: current@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: change to syslog to allow specifying prot to send to.. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2006 00:35:14 -0000 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;