svn commit: r253429 - head/sbin/route

Hiroki Sato hrs at FreeBSD.org
Wed Jul 17 14:15:01 UTC 2013


Author: hrs
Date: Wed Jul 17 14:15:00 2013
New Revision: 253429
URL: http://svnweb.freebsd.org/changeset/base/253429

Log:
  Use NET_RT_DUMP.0.FIB leaf node instead of setting td_proc->p_fibnum.

Modified:
  head/sbin/route/route.c

Modified: head/sbin/route/route.c
==============================================================================
--- head/sbin/route/route.c	Wed Jul 17 14:05:35 2013	(r253428)
+++ head/sbin/route/route.c	Wed Jul 17 14:15:00 2013	(r253429)
@@ -118,7 +118,6 @@ static const char	*routename(struct sock
 static int	rtmsg(int, int, int);
 static void	set_metric(char *, int);
 static int	set_sofib(int);
-static int	set_procfib(int);
 static void	sockaddr(char *, struct sockaddr *, size_t);
 static void	sodump(struct sockaddr *, const char *);
 extern	char *iso_ntoa(void);
@@ -236,15 +235,6 @@ set_sofib(int fib)
 }
 
 static int
-set_procfib(int fib)
-{
-	
-	if (fib < 0)
-		return (0);
-	return (setfib(fib));
-}
-
-static int
 fiboptlist_range(const char *arg, struct fibl_head_t *flh)
 {
 	struct fibl *fl;
@@ -420,11 +410,10 @@ flushroutes_fib(int fib)
 	struct rt_msghdr *rtm;
 	size_t needed;
 	char *buf, *next, *lim;
-	int mib[6], rlen, seqno, count = 0;
+	int mib[7], rlen, seqno, count = 0;
 	int error;
 
 	error = set_sofib(fib);
-	error += set_procfib(fib);
 	if (error) {
 		warn("fib number %d is ignored", fib);
 		return (error);
@@ -437,6 +426,7 @@ retry:
 	mib[3] = AF_UNSPEC;
 	mib[4] = NET_RT_DUMP;
 	mib[5] = 0;		/* no flags */
+	mib[6] = fib;
 	if (sysctl(mib, nitems(mib), NULL, &needed, NULL, 0) < 0)
 		err(EX_OSERR, "route-sysctl-estimate");
 	if ((buf = malloc(needed)) == NULL)


More information about the svn-src-all mailing list