From 19e09f447fd9bbbc7e8b0271dfee7c74e9417047 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:17:03 +0000 Subject: [PATCH] Remove obsoleted KPIs that were used to access interface address lists. --- UPDATING | 4 ++ sys/net/if.c | 105 ----------------------------------------------- sys/net/if_var.h | 16 -------- sys/sys/param.h | 2 +- 4 files changed, 5 insertions(+), 122 deletions(-) diff --git a/UPDATING b/UPDATING index 4d1761359a20..0ce645ca8f65 100644 --- a/UPDATING +++ b/UPDATING @@ -26,6 +26,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20191021: + KPIs for network drivers to access interface addresses have changed. + Users need to recompile NIC driver modules together with kernel. + 20191021: The net.link.tap.user_open sysctl no longer prevents user opening of already created /dev/tapNN devices. Access is still controlled by diff --git a/sys/net/if.c b/sys/net/if.c index 87755c8a4360..31bd54b5805d 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1767,40 +1767,6 @@ if_data_copy(struct ifnet *ifp, struct if_data *ifd) ifd->ifi_noproto = ifp->if_get_counter(ifp, IFCOUNTER_NOPROTO); } -/* - * Wrapper functions for struct ifnet address list locking macros. These are - * used by kernel modules to avoid encoding programming interface or binary - * interface assumptions that may be violated when kernel-internal locking - * approaches change. - */ -void -if_addr_rlock(struct ifnet *ifp) -{ - - epoch_enter_preempt(net_epoch_preempt, curthread->td_et); -} - -void -if_addr_runlock(struct ifnet *ifp) -{ - - epoch_exit_preempt(net_epoch_preempt, curthread->td_et); -} - -void -if_maddr_rlock(if_t ifp) -{ - - epoch_enter_preempt(net_epoch_preempt, curthread->td_et); -} - -void -if_maddr_runlock(if_t ifp) -{ - - epoch_exit_preempt(net_epoch_preempt, curthread->td_et); -} - /* * Initialization, destruction and refcounting functions for ifaddrs. */ @@ -4405,77 +4371,6 @@ if_input(if_t ifp, struct mbuf* sendmp) } -/* XXX */ -#ifndef ETH_ADDR_LEN -#define ETH_ADDR_LEN 6 -#endif - -int -if_setupmultiaddr(if_t ifp, void *mta, int *cnt, int max) -{ - struct ifmultiaddr *ifma; - uint8_t *lmta = (uint8_t *)mta; - int mcnt = 0; - - CK_STAILQ_FOREACH(ifma, &((struct ifnet *)ifp)->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - if (mcnt == max) - break; - - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - &lmta[mcnt * ETH_ADDR_LEN], ETH_ADDR_LEN); - mcnt++; - } - *cnt = mcnt; - - return (0); -} - -int -if_multiaddr_array(if_t ifp, void *mta, int *cnt, int max) -{ - int error; - - if_maddr_rlock(ifp); - error = if_setupmultiaddr(ifp, mta, cnt, max); - if_maddr_runlock(ifp); - return (error); -} - -int -if_multiaddr_count(if_t ifp, int max) -{ - struct ifmultiaddr *ifma; - int count; - - count = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &((struct ifnet *)ifp)->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - count++; - if (count == max) - break; - } - if_maddr_runlock(ifp); - return (count); -} - -int -if_multi_apply(struct ifnet *ifp, int (*filter)(void *, struct ifmultiaddr *, int), void *arg) -{ - struct ifmultiaddr *ifma; - int cnt = 0; - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) - cnt += filter(arg, ifma, cnt); - if_maddr_runlock(ifp); - return (cnt); -} - struct mbuf * if_dequeue(if_t ifp) { diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 522b265b6055..1a78765a8c29 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -449,16 +449,6 @@ struct ifnet { #define NET_EPOCH_WAIT() epoch_wait_preempt(net_epoch_preempt) #define NET_EPOCH_ASSERT() MPASS(in_epoch(net_epoch_preempt)) -/* - * Function variations on locking macros intended to be used by loadable - * kernel modules in order to divorce them from the internals of address list - * locking. - */ -void if_addr_rlock(struct ifnet *ifp); /* if_addrhead */ -void if_addr_runlock(struct ifnet *ifp); /* if_addrhead */ -void if_maddr_rlock(if_t ifp); /* if_multiaddrs */ -void if_maddr_runlock(if_t ifp); /* if_multiaddrs */ - #ifdef _KERNEL /* interface link layer address change event */ typedef void (*iflladdr_event_handler_t)(void *, struct ifnet *); @@ -773,12 +763,6 @@ u_int if_foreach_lladdr(if_t, iflladdr_cb_t, void *); u_int if_foreach_llmaddr(if_t, iflladdr_cb_t, void *); u_int if_lladdr_count(if_t); u_int if_llmaddr_count(if_t); -int if_multiaddr_count(if_t ifp, int max); - -/* Obsoleted multicast management functions. */ -int if_setupmultiaddr(if_t ifp, void *mta, int *cnt, int max); -int if_multiaddr_array(if_t ifp, void *mta, int *cnt, int max); -int if_multi_apply(struct ifnet *ifp, int (*filter)(void *, struct ifmultiaddr *, int), void *arg); int if_getamcount(if_t ifp); struct ifaddr * if_getifaddr(if_t ifp); diff --git a/sys/sys/param.h b/sys/sys/param.h index 2c1f8b46305d..dd987bb44ffd 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300053 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300054 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,