Remove obsoleted KPIs that were used to access interface address lists.

This commit is contained in:
Gleb Smirnoff 2019-10-21 18:17:03 +00:00
parent 38e1a6585b
commit 19e09f447f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=353868
4 changed files with 5 additions and 122 deletions

View file

@ -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

View file

@ -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)
{

View file

@ -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);

View file

@ -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,