Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102659097
D40332.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D40332.diff
View Options
diff --git a/sys/net/if.c b/sys/net/if.c
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -278,7 +278,6 @@
static int ifconf(u_long, caddr_t);
static void if_input_default(struct ifnet *, struct mbuf *);
static int if_requestencap_default(struct ifnet *, struct if_encap_req *);
-static void if_route(struct ifnet *, int flag, int fam);
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);
@@ -2141,26 +2140,6 @@
rt_ifmsg(ifp, IFF_UP);
}
-/*
- * Mark an interface up and notify protocols of
- * the transition.
- */
-static void
-if_route(struct ifnet *ifp, int flag, int fam)
-{
-
- KASSERT(flag == IFF_UP, ("if_route: flag != IFF_UP"));
-
- ifp->if_flags |= flag;
- getmicrotime(&ifp->if_lastchange);
- if (ifp->if_carp)
- (*carp_linkstate_p)(ifp);
- rt_ifmsg(ifp, IFF_UP);
-#ifdef INET6
- in6_if_up(ifp);
-#endif
-}
-
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 *);
@@ -2246,7 +2225,11 @@
if_up(struct ifnet *ifp)
{
- if_route(ifp, IFF_UP, AF_UNSPEC);
+ ifp->if_flags |= IFF_UP;
+ getmicrotime(&ifp->if_lastchange);
+ if (ifp->if_carp)
+ (*carp_linkstate_p)(ifp);
+ rt_ifmsg(ifp, IFF_UP);
EVENTHANDLER_INVOKE(ifnet_event, ifp, IFNET_EVENT_UP);
}
@@ -3109,13 +3092,8 @@
cmd != SIOCSIFDSTADDR && cmd != SIOCSIFNETMASK)
error = (*ifp->if_ioctl)(ifp, cmd, data);
- if ((oif_flags ^ ifp->if_flags) & IFF_UP) {
-#ifdef INET6
- if (ifp->if_flags & IFF_UP)
- in6_if_up(ifp);
-#endif
- }
-
+ if (!(oif_flags & IFF_UP) && (ifp->if_flags & IFF_UP))
+ if_up(ifp);
out_ref:
if_rele(ifp);
out_noref:
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -2049,6 +2049,20 @@
in6_ifattach(ifp, NULL);
}
+static void
+in6_ifevent(void *arg __unused, struct ifnet *ifp, int event)
+{
+ if (event == IFNET_EVENT_UP)
+ in6_if_up(ifp);
+}
+
+static void
+in6_init(void *arg __unused)
+{
+ EVENTHANDLER_REGISTER(ifnet_event, in6_ifevent, NULL, EVENTHANDLER_PRI_ANY);
+}
+SYSINIT(in6_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, in6_init, NULL);
+
int
in6if_do_dad(struct ifnet *ifp)
{
diff --git a/sys/netlink/route/iface.c b/sys/netlink/route/iface.c
--- a/sys/netlink/route/iface.c
+++ b/sys/netlink/route/iface.c
@@ -1312,10 +1312,8 @@
error = EAFNOSUPPORT;
}
-#ifdef INET6
if (error == 0 && !(if_flags & IFF_UP) && (if_getflags(ifp) & IFF_UP))
- in6_if_up(ifp);
-#endif
+ if_up(ifp);
if_rele(ifp);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 16, 11:37 AM (13 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14658019
Default Alt Text
D40332.diff (2 KB)
Attached To
Mode
D40332: ifnet: consistently call hooks when the interface gets up.
Attached
Detach File
Event Timeline
Log In to Comment