From 96df60d2ef9ce30d58326c976f08e66c0c066c01 Mon Sep 17 00:00:00 2001 From: hrs Date: Wed, 17 Jul 2013 14:15:00 +0000 Subject: [PATCH] Use NET_RT_DUMP.0.FIB leaf node instead of setting td_proc->p_fibnum. --- sbin/route/route.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/sbin/route/route.c b/sbin/route/route.c index 2186482239bb..6e3b25735dd5 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -118,7 +118,6 @@ static const char *routename(struct sockaddr *); 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); @@ -235,15 +234,6 @@ set_sofib(int fib) sizeof(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) { @@ -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)