decui_microsoft.com updated the summary for this revision. decui_microsoft.com updated this revision to Diff 23652. decui_microsoft.com added a comment.
Since sephe's patch (https://reviews.freebsd.org/D8905) is accepted, let me update this patch accordingly. CHANGES SINCE LAST UPDATE https://reviews.freebsd.org/D8963?vs=23382&id=23652 REVISION DETAIL https://reviews.freebsd.org/D8963 AFFECTED FILES sys/net/if.c sys/sys/eventhandler.h EMAIL PREFERENCES https://reviews.freebsd.org/settings/panel/emailpreferences/ To: decui_microsoft.com, hselasky, sepherosa_gmail.com, cem, np, kmacy, kib, honzhan_microsoft.com, howard0su_gmail.com, jhb, ae, delphij, royger, glebius, gnn, rwatson Cc: freebsd-net-list
diff --git a/sys/sys/eventhandler.h b/sys/sys/eventhandler.h --- a/sys/sys/eventhandler.h +++ b/sys/sys/eventhandler.h @@ -284,4 +284,11 @@ EVENTHANDLER_DECLARE(swapon, swapon_fn); EVENTHANDLER_DECLARE(swapoff, swapoff_fn); +/* ifup/ifdown events */ +#define IFNET_EVENT_UP 0 +#define IFNET_EVENT_DOWN 1 +struct ifnet; +typedef void (*ifnet_event_fn)(void *, struct ifnet *ifp, int event); +EVENTHANDLER_DECLARE(ifnet_event, ifnet_event_fn); + #endif /* _SYS_EVENTHANDLER_H_ */ diff --git a/sys/net/if.c b/sys/net/if.c --- a/sys/net/if.c +++ b/sys/net/if.c @@ -59,6 +59,7 @@ #include <sys/domain.h> #include <sys/jail.h> #include <sys/priv.h> +#include <sys/eventhandler.h> #include <machine/stdarg.h> #include <vm/uma.h> @@ -2218,6 +2219,7 @@ if_down(struct ifnet *ifp) { + EVENTHANDLER_INVOKE(ifnet_event, ifp, IFNET_EVENT_DOWN); if_unroute(ifp, IFF_UP, AF_UNSPEC); } @@ -2230,6 +2232,7 @@ { if_route(ifp, IFF_UP, AF_UNSPEC); + EVENTHANDLER_INVOKE(ifnet_event, ifp, IFNET_EVENT_UP); } /*
_______________________________________________ freebsd-net@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"