Remove redundant rtinit() calls from tuntap.
Removed code iterates over if_addrhead and tries to remove routes for each ifa. This is exactly the thing that if_purgeaddrs() do, and if_purgeaddr() is already called in the end. Reviewed by: glebius MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D28106
This commit is contained in:
parent
e58c8da068
commit
a6b7689718
@ -123,7 +123,7 @@ struct tuntap_softc {
|
||||
#define TUN_OPEN 0x0001
|
||||
#define TUN_INITED 0x0002
|
||||
#define TUN_UNUSED1 0x0008
|
||||
#define TUN_DSTADDR 0x0010
|
||||
#define TUN_UNUSED2 0x0010
|
||||
#define TUN_LMODE 0x0020
|
||||
#define TUN_RWAIT 0x0040
|
||||
#define TUN_ASYNC 0x0080
|
||||
@ -1160,19 +1160,8 @@ tundtor(void *data)
|
||||
|
||||
/* Delete all addresses and routes which reference this interface. */
|
||||
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
|
||||
struct ifaddr *ifa;
|
||||
|
||||
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
|
||||
TUN_UNLOCK(tp);
|
||||
CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
|
||||
/* deal w/IPv4 PtP destination; unlocked read */
|
||||
if (!l2tun && ifa->ifa_addr->sa_family == AF_INET) {
|
||||
rtinit(ifa, (int)RTM_DELETE,
|
||||
tp->tun_flags & TUN_DSTADDR ? RTF_HOST : 0);
|
||||
} else {
|
||||
rtinit(ifa, (int)RTM_DELETE, 0);
|
||||
}
|
||||
}
|
||||
if_purgeaddrs(ifp);
|
||||
TUN_LOCK(tp);
|
||||
}
|
||||
@ -1197,10 +1186,6 @@ static void
|
||||
tuninit(struct ifnet *ifp)
|
||||
{
|
||||
struct tuntap_softc *tp = ifp->if_softc;
|
||||
#ifdef INET
|
||||
struct epoch_tracker et;
|
||||
struct ifaddr *ifa;
|
||||
#endif
|
||||
|
||||
TUNDEBUG(ifp, "tuninit\n");
|
||||
|
||||
@ -1209,21 +1194,6 @@ tuninit(struct ifnet *ifp)
|
||||
if ((tp->tun_flags & TUN_L2) == 0) {
|
||||
ifp->if_flags |= IFF_UP;
|
||||
getmicrotime(&ifp->if_lastchange);
|
||||
#ifdef INET
|
||||
NET_EPOCH_ENTER(et);
|
||||
CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
|
||||
if (ifa->ifa_addr->sa_family == AF_INET) {
|
||||
struct sockaddr_in *si;
|
||||
|
||||
si = (struct sockaddr_in *)ifa->ifa_dstaddr;
|
||||
if (si && si->sin_addr.s_addr) {
|
||||
tp->tun_flags |= TUN_DSTADDR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
NET_EPOCH_EXIT(et);
|
||||
#endif
|
||||
TUN_UNLOCK(tp);
|
||||
} else {
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user