summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_jail.c1
-rw-r--r--sys/net/if.c16
-rw-r--r--sys/net/if.h2
-rw-r--r--sys/net/if_debug.c1
-rw-r--r--sys/net/if_var.h1
-rw-r--r--sys/sys/priv.h1
-rw-r--r--sys/sys/sockio.h3
7 files changed, 25 insertions, 0 deletions
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
index 5850ad1..358d673 100644
--- a/sys/kern/kern_jail.c
+++ b/sys/kern/kern_jail.c
@@ -3639,6 +3639,7 @@ prison_priv_check(struct ucred *cred, int priv)
case PRIV_NET_LAGG:
case PRIV_NET_GIF:
case PRIV_NET_SETIFVNET:
+ case PRIV_NET_SETIFFIB:
/*
* 802.11-related privileges.
diff --git a/sys/net/if.c b/sys/net/if.c
index a5a3a8e..2b7a24a 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -58,6 +58,8 @@
#include <sys/taskqueue.h>
#include <sys/domain.h>
#include <sys/jail.h>
+#include <sys/priv.h>
+
#include <machine/stdarg.h>
#include <vm/uma.h>
@@ -2135,6 +2137,20 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
free(odescrbuf, M_IFDESCR);
break;
+ case SIOCGIFFIB:
+ ifr->ifr_fib = ifp->if_fib;
+ break;
+
+ case SIOCSIFFIB:
+ error = priv_check(td, PRIV_NET_SETIFFIB);
+ if (error)
+ return (error);
+ if (ifr->ifr_fib >= rt_numfibs)
+ return (EINVAL);
+
+ ifp->if_fib = ifr->ifr_fib;
+ break;
+
case SIOCSIFFLAGS:
error = priv_check(td, PRIV_NET_SETIFFLAGS);
if (error)
diff --git a/sys/net/if.h b/sys/net/if.h
index 06521cb..d1f3883 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -325,6 +325,7 @@ struct ifreq {
int ifru_media;
caddr_t ifru_data;
int ifru_cap[2];
+ u_int ifru_fib;
} ifr_ifru;
#define ifr_addr ifr_ifru.ifru_addr /* address */
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
@@ -341,6 +342,7 @@ struct ifreq {
#define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */
#define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */
#define ifr_index ifr_ifru.ifru_index /* interface index */
+#define ifr_fib ifr_ifru.ifru_fib /* interface fib */
};
#define _SIZEOF_ADDR_IFREQ(ifr) \
diff --git a/sys/net/if_debug.c b/sys/net/if_debug.c
index dcf504e..e7319374 100644
--- a/sys/net/if_debug.c
+++ b/sys/net/if_debug.c
@@ -86,6 +86,7 @@ if_show_ifnet(struct ifnet *ifp)
IF_DB_PRINTF("%d", if_snd.ifq_drv_maxlen);
IF_DB_PRINTF("%d", if_snd.altq_type);
IF_DB_PRINTF("%x", if_snd.altq_flags);
+ IF_DB_PRINTF("%u", if_fib);
#undef IF_DB_PRINTF
}
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index b3ecb7d..cb1d39c 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -196,6 +196,7 @@ struct ifnet {
void *if_pf_kif;
void *if_lagg; /* lagg glue */
u_char if_alloctype; /* if_type at time of allocation */
+ u_int if_fib; /* interface FIB */
/*
* Spare fields are added so that we can modify sensitive data
diff --git a/sys/sys/priv.h b/sys/sys/priv.h
index 7733e36..b984f1a 100644
--- a/sys/sys/priv.h
+++ b/sys/sys/priv.h
@@ -337,6 +337,7 @@
#define PRIV_NET_GIF 416 /* Administer gif interface. */
#define PRIV_NET_SETIFVNET 417 /* Move interface to vnet. */
#define PRIV_NET_SETIFDESCR 418 /* Set interface description. */
+#define PRIV_NET_SETIFFIB 419 /* Set interface fib. */
/*
* 802.11-related privileges.
diff --git a/sys/sys/sockio.h b/sys/sys/sockio.h
index 4c1c483..8922699 100644
--- a/sys/sys/sockio.h
+++ b/sys/sys/sockio.h
@@ -110,6 +110,9 @@
#define SIOCSIFVNET _IOWR('i', 90, struct ifreq) /* move IF jail/vnet */
#define SIOCSIFRVNET _IOWR('i', 91, struct ifreq) /* reclaim vnet IF */
+#define SIOCGIFFIB _IOWR('i', 92, struct ifreq) /* get IF fib */
+#define SIOCSIFFIB _IOW('i', 93, struct ifreq) /* set IF fib */
+
#define SIOCSDRVSPEC _IOW('i', 123, struct ifdrv) /* set driver-specific
parameters */
#define SIOCGDRVSPEC _IOWR('i', 123, struct ifdrv) /* get driver-specific
OpenPOWER on IntegriCloud