git: ad5eecbfca54 - stable/14 - ifnet: Integrate if_unroute() into if_down()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 01 Jun 2025 15:41:05 UTC
The branch stable/14 has been updated by zlei:
URL: https://cgit.FreeBSD.org/src/commit/?id=ad5eecbfca54cfd2247c8fb3799ba292bf9668ed
commit ad5eecbfca54cfd2247c8fb3799ba292bf9668ed
Author: Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2025-05-20 15:45:20 +0000
Commit: Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2025-06-01 15:40:07 +0000
ifnet: Integrate if_unroute() into if_down()
if_unroute() is static since 2004 and is not used anywhere except for
if_down().
This also makes it easier to grep by the pattern `if_flags &= ~IFF_UP`.
No functional change intended.
Reviewed by: glebius
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D49356
(cherry picked from commit 0693c3f7cb3d9e5389863a0c131ddef799c77091)
---
sys/net/if.c | 29 ++++++++---------------------
1 file changed, 8 insertions(+), 21 deletions(-)
diff --git a/sys/net/if.c b/sys/net/if.c
index fc39c1ffcff0..b4ffa9883efc 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -280,7 +280,6 @@ static void if_input_default(struct ifnet *, struct mbuf *);
static int if_requestencap_default(struct ifnet *, struct if_encap_req *);
static int if_setflag(struct ifnet *, int, int, int *, int);
static int if_transmit_default(struct ifnet *ifp, struct mbuf *m);
-static void if_unroute(struct ifnet *, int flag, int fam);
static int if_delmulti_locked(struct ifnet *, struct ifmultiaddr *, int);
static void do_link_state_change(void *, int);
static int if_getgroup(struct ifgroupreq *, struct ifnet *);
@@ -2098,25 +2097,6 @@ link_init_sdl(struct ifnet *ifp, struct sockaddr *paddr, u_char iftype)
return (sdl);
}
-/*
- * Mark an interface down and notify protocols of
- * the transition.
- */
-static void
-if_unroute(struct ifnet *ifp, int flag, int fam)
-{
-
- KASSERT(flag == IFF_UP, ("if_unroute: flag != IFF_UP"));
-
- ifp->if_flags &= ~flag;
- getmicrotime(&ifp->if_lastchange);
- ifp->if_qflush(ifp);
-
- if (ifp->if_carp)
- (*carp_linkstate_p)(ifp);
- rt_ifmsg(ifp, IFF_UP);
-}
-
void (*vlan_link_state_p)(struct ifnet *); /* XXX: private from if_vlan */
void (*vlan_trunk_cap_p)(struct ifnet *); /* XXX: private from if_vlan */
struct ifnet *(*vlan_trunkdev_p)(struct ifnet *);
@@ -2191,7 +2171,14 @@ if_down(struct ifnet *ifp)
{
EVENTHANDLER_INVOKE(ifnet_event, ifp, IFNET_EVENT_DOWN);
- if_unroute(ifp, IFF_UP, AF_UNSPEC);
+
+ ifp->if_flags &= ~IFF_UP;
+ getmicrotime(&ifp->if_lastchange);
+ ifp->if_qflush(ifp);
+
+ if (ifp->if_carp)
+ (*carp_linkstate_p)(ifp);
+ rt_ifmsg(ifp, IFF_UP);
}
/*