From arved@FreeBSD.org  Wed Jun 15 18:57:36 2005
Return-Path: <arved@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id A9FB316A41C
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 15 Jun 2005 18:57:36 +0000 (GMT)
	(envelope-from arved@FreeBSD.org)
Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 9060743D48
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 15 Jun 2005 18:57:36 +0000 (GMT)
	(envelope-from arved@FreeBSD.org)
Received: from freefall.freebsd.org (arved@localhost [127.0.0.1])
	by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j5FIvaBV090483
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 15 Jun 2005 18:57:36 GMT
	(envelope-from arved@freefall.freebsd.org)
Received: (from arved@localhost)
	by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j5FIvaRY090482;
	Wed, 15 Jun 2005 18:57:36 GMT
	(envelope-from arved)
Message-Id: <200506151857.j5FIvaRY090482@freefall.freebsd.org>
Date: Wed, 15 Jun 2005 18:57:36 GMT
From: Tilman Linneweh <arved@FreeBSD.org>
Reply-To: Tilman Linneweh <arved@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [routed] Fix varargs usage, remove non-existing -p option
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         82287
>Category:       bin
>Synopsis:       [patch] routed(8): Fix varargs usage, remove non-existing -p option
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    trhodes
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 15 19:00:38 GMT 2005
>Closed-Date:    Sun Jul 20 17:40:00 UTC 2008
>Last-Modified:  Sun Jul 20 17:40:02 UTC 2008
>Originator:     Tilman Linneweh
>Release:        FreeBSD 4.11-STABLE i386
>Organization:
>Environment:
System: FreeBSD freefall.freebsd.org 4.11-STABLE FreeBSD 4.11-STABLE #16: Sat Feb 26 00:02:03 GMT 2005 kensmith@freefall.freebsd.org:/c/src/sys/compile/FREEFALL i386


	
>Description:
	The varargs handling in routed is broken,  
	This has been fixed, in rhyolite routed 2.31 and NetBSD, OpenBSD 
	Attached is a diff against main.c from rhyolite routed 2.31

	Additional this patch removes the unimplented, and undocumented -p Option
	This fix was committed to the other BSDs some time ago
	
>How-To-Repeat:
	Run routed with -dt on freebsd-amd64

	
>Fix:

	

--- patch-routed-main.c begins here ---
--- /usr/src/sbin/routed/main.c	Sat Jun  4 13:34:31 2005
+++ main.c	Wed Jun 15 19:38:08 2005
@@ -47,8 +47,8 @@
 #elif defined(__FreeBSD__)
 __RCSID("$FreeBSD: src/sbin/routed/main.c,v 1.18 2005/05/31 20:28:48 stefanf Exp $");
 #else
-__RCSID("$Revision: 2.27 $");
-#ident "$Revision: 2.27 $"
+__RCSID("$Revision: 2.31 $");
+#ident "$Revision: 2.31 $"
 #endif
 
 pid_t	mypid;
@@ -133,7 +133,7 @@
 	(void)gethostname(myname, sizeof(myname)-1);
 	(void)gethost(myname, &myaddr);
 
-	while ((n = getopt(argc, argv, "sqdghmpAtvT:F:P:")) != -1) {
+	while ((n = getopt(argc, argv, "sqdghmAtvT:F:P:")) != -1) {
 		switch (n) {
 		case 's':
 			supplier = 1;
@@ -219,7 +219,7 @@
 		case 'v':
 			/* display version */
 			verbose++;
-			msglog("version 2.25");
+			msglog("version 2.31");
 			break;
 
 		default:
@@ -237,7 +237,7 @@
 		goto usage;
 	if (argc != 0) {
 usage:
-		logbad(0, "usage: routed [-sqdghmpAtv] [-T tracefile]"
+		logbad(0, "usage: routed [-sqdghmAtv] [-T tracefile]"
 		       " [-F net[,metric]] [-P parms]");
 	}
 	if (geteuid() != 0) {
@@ -863,14 +863,16 @@
 
 	va_start(args, p);
 	vsyslog(LOG_ERR, p, args);
+	va_end(args);
 
 	if (ftrace != 0) {
 		if (ftrace == stdout)
 			(void)fputs("routed: ", ftrace);
+		va_start(args, p);
 		(void)vfprintf(ftrace, p, args);
+		va_end(args);
 		(void)fputc('\n', ftrace);
 	}
-	va_end(args);
 }
 
 
@@ -889,8 +891,6 @@
 	struct msg_sub *ms1, *ms;
 	const char *p1;
 
-	va_start(args, p);
-
 	/* look for the oldest slot in the table
 	 * or the slot for the bad router.
 	 */
@@ -925,15 +925,18 @@
 		trace_flush();
 		for (p1 = p; *p1 == ' '; p1++)
 			continue;
+		va_start(args, p);
 		vsyslog(LOG_ERR, p1, args);
+		va_end(args);
 	}
 
 	/* always display the message if tracing */
 	if (ftrace != 0) {
+		va_start(args, p);
 		(void)vfprintf(ftrace, p, args);
+		va_end(args);
 		(void)fputc('\n', ftrace);
 	}
-	va_end(args);
 }
 
 
@@ -946,12 +949,14 @@
 
 	va_start(args, p);
 	vsyslog(LOG_ERR, p, args);
+	va_end(args);
 
 	(void)fputs("routed: ", stderr);
+	va_start(args, p);
 	(void)vfprintf(stderr, p, args);
+	va_end(args);
 	(void)fputs("; giving up\n",stderr);
 	(void)fflush(stderr);
-	va_end(args);
 
 	if (dump)
 		abort();
--- patch-routed-main.c ends here ---


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: trhodes 
State-Changed-When: Sun Nov 5 14:51:09 UTC 2006 
State-Changed-Why:  
Patch tested and committed to CURRENT, thanks! 


Responsible-Changed-From-To: freebsd-bugs->trhodes 
Responsible-Changed-By: trhodes 
Responsible-Changed-When: Sun Nov 5 14:51:09 UTC 2006 
Responsible-Changed-Why:  
Over to me, MFC reminder. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=82287 

From: Bruce Cran <bruce@cran.org.uk>
To: bug-followup@FreeBSD.org, arved@FreeBSD.org
Cc:  
Subject: Re: bin/82287: [patch] routed(8): Fix varargs usage, remove non-existing
 -p option
Date: Sat, 15 Mar 2008 01:24:21 +0000

 The fix was committed to 7.0 in rev 1.19 of main.c.
 
 The following message from dfilter was misdirected to PR bin/83387:
 
 ---
 trhodes 2006-11-05 14:49:47 UTC
 
 FreeBSD src repository
 
 Modified files:
 sbin/routed main.c
 Log:
 Sync up with rhyolite routed 2.31 which fixes the handling of varargs.
 Remove -p from usage, it's gone completely now.
 
 PR: 83387
 Submited by: arved
 
 Revision Changes Path
 1.19 +15 -12 src/sbin/routed/main.c
 ---
 
 
 --
 Bruce
State-Changed-From-To: patched->closed 
State-Changed-By: trhodes 
State-Changed-When: Sun Jul 20 17:39:24 UTC 2008 
State-Changed-Why:  
MFC to 6 complete, 7 picked it up during branching, sorry 
for taking so long.  Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=82287 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/82287: commit references a PR
Date: Sun, 20 Jul 2008 17:39:29 +0000 (UTC)

 trhodes     2008-07-20 17:39:07 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     sbin/routed          main.c 
   Log:
   SVN rev 180635 on 2008-07-20 17:39:07Z by trhodes
   
   MFC r163999
   Sync up with rhyolite routed 2.31 which fixes the handling of varargs.
   Remove -p from usage, it's gone completely now.
   
   Merge to 7 not applicable, 7 obtained this change when it was
   branched.
   
   PR:             82287
   Submitted by:   arved
   
   Revision  Changes    Path
   1.18.2.1  +15 -12    src/sbin/routed/main.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
