Date: Wed, 13 Jan 2021 10:05:44 GMT From: "Alexander V. Chernikov" <melifaro@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: a6b7689718d2 - main - Remove redundant rtinit() calls from tuntap. Message-ID: <202101131005.10DA5iWa036430@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=a6b7689718d223e5cefc7beb6d8bb317f92ff839 commit a6b7689718d223e5cefc7beb6d8bb317f92ff839 Author: Alexander V. Chernikov <melifaro@FreeBSD.org> AuthorDate: 2021-01-11 23:31:37 +0000 Commit: Alexander V. Chernikov <melifaro@FreeBSD.org> CommitDate: 2021-01-13 10:03:15 +0000 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 --- sys/net/if_tuntap.c | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/sys/net/if_tuntap.c b/sys/net/if_tuntap.c index 5789fce5407f..0c0a0dd66339 100644 --- a/sys/net/if_tuntap.c +++ b/sys/net/if_tuntap.c @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101131005.10DA5iWa036430>