svn commit: r277397 - in projects/ifnet/sys: net netgraph
Gleb Smirnoff
glebius at FreeBSD.org
Mon Jan 19 21:27:36 UTC 2015
Author: glebius
Date: Mon Jan 19 21:27:34 2015
New Revision: 277397
URL: https://svnweb.freebsd.org/changeset/base/277397
Log:
Remove IF_FIB feature and pass SIOCSIFFIB down to drivers, so that they
can cache it if needed.
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
Modified:
projects/ifnet/sys/net/if.c
projects/ifnet/sys/net/if.h
projects/ifnet/sys/netgraph/ng_iface.c
Modified: projects/ifnet/sys/net/if.c
==============================================================================
--- projects/ifnet/sys/net/if.c Mon Jan 19 20:39:48 2015 (r277396)
+++ projects/ifnet/sys/net/if.c Mon Jan 19 21:27:34 2015 (r277397)
@@ -1528,9 +1528,6 @@ if_getfeature(if_t ifp, ift_feature f, u
case IF_FLAGS:
*f32 = &ifp->if_flags;
break;
- case IF_FIB:
- *f32 = &ifp->if_fib;
- break;
case IF_BAUDRATE:
*f64 = &ifp->if_baudrate;
break;
@@ -2475,8 +2472,8 @@ if_drvioctl(u_long cmd, struct ifnet *if
return (error);
if (ifr->ifr_fib >= rt_numfibs)
return (EINVAL);
-
ifp->if_fib = ifr->ifr_fib;
+ (void )if_ioctl(ifp, cmd, data, td);
break;
case SIOCSIFFLAGS:
Modified: projects/ifnet/sys/net/if.h
==============================================================================
--- projects/ifnet/sys/net/if.h Mon Jan 19 20:39:48 2015 (r277396)
+++ projects/ifnet/sys/net/if.h Mon Jan 19 21:27:34 2015 (r277397)
@@ -575,7 +575,6 @@ typedef enum {
typedef enum {
/* uint32_t */
IF_FLAGS,
- IF_FIB,
/* uint64_t */
IF_BAUDRATE,
/* pointers */
Modified: projects/ifnet/sys/netgraph/ng_iface.c
==============================================================================
--- projects/ifnet/sys/netgraph/ng_iface.c Mon Jan 19 20:39:48 2015 (r277396)
+++ projects/ifnet/sys/netgraph/ng_iface.c Mon Jan 19 21:27:34 2015 (r277397)
@@ -107,7 +107,8 @@ const static struct iffam gFamilies[] =
/* Node private data */
struct ng_iface_private {
- struct ifnet *ifp; /* Our interface */
+ if_t ifp; /* Our interface */
+ u_int fib; /* Interface fib */
int unit; /* Interface unit number */
node_p node; /* Our netgraph node */
hook_p hooks[NUM_FAMILIES]; /* Hook for each address family */
@@ -275,6 +276,7 @@ get_iffam_from_name(const char *name)
static int
ng_iface_ioctl(if_t ifp, u_long command, void *data, struct thread *td)
{
+ const priv_p priv = if_getsoftc(ifp, IF_DRIVER_SOFTC);
struct ifreq *const ifr = (struct ifreq *) data;
int error = 0;
@@ -295,6 +297,11 @@ ng_iface_ioctl(if_t ifp, u_long command,
error = EINVAL;
break;
+ /* Update interface FIB */
+ case SIOCSIFFIB:
+ priv->fib = ifr->ifr_fib;
+ break;
+
/* Stuff that's not supported */
case SIOCGIFADDR:
case SIOCSIFFLAGS:
@@ -643,7 +650,7 @@ ng_iface_rcvdata(hook_p hook, item_p ite
return (EAFNOSUPPORT);
}
random_harvest(&(m->m_data), 12, 2, RANDOM_NET_NG);
- M_SETFIB(m, if_get(ifp, IF_FIB));
+ M_SETFIB(m, priv->fib);
netisr_dispatch(isr, m);
return (0);
}
More information about the svn-src-projects
mailing list