Date: Tue, 24 Jan 2017 09:20:02 +0000 From: Phabricator <phabric-noreply@FreeBSD.org> To: freebsd-net@freebsd.org Subject: [Differential] D8963: ifnet: introduce event handlers for ifup/ifdown events Message-ID: <2a47387418f6a714560673bb0d6b8b10@localhost.localdomain> In-Reply-To: <differential-rev-PHID-DREV-3ybd3zjkngxrs2mfdmts-req@FreeBSD.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] This revision was automatically updated to reflect the committed changes. Closed by commit rS312687: ifnet: introduce event handlers for ifup/ifdown events (authored by dexuan). CHANGED PRIOR TO COMMIT https://reviews.freebsd.org/D8963?vs=23652&id=24374#toc REPOSITORY rS FreeBSD src repository CHANGES SINCE LAST UPDATE https://reviews.freebsd.org/D8963?vs=23652&id=24374 REVISION DETAIL https://reviews.freebsd.org/D8963 AFFECTED FILES head/sys/net/if.c head/sys/sys/eventhandler.h EMAIL PREFERENCES https://reviews.freebsd.org/settings/panel/emailpreferences/ To: decui_microsoft.com, hselasky, cem, np, kmacy, kib, honzhan_microsoft.com, howard0su_gmail.com, jhb, ae, delphij, royger, glebius, gnn, rwatson, sepherosa_gmail.com Cc: garga, freebsd-net-list [-- Attachment #2 --] diff --git a/head/sys/sys/eventhandler.h b/head/sys/sys/eventhandler.h --- a/head/sys/sys/eventhandler.h +++ b/head/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/head/sys/net/if.c b/head/sys/net/if.c --- a/head/sys/net/if.c +++ b/head/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); } /*home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2a47387418f6a714560673bb0d6b8b10>
