Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147988784
D38348.id116366.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
917 B
Referenced Files
None
Subscribers
None
D38348.id116366.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
@@ -4472,6 +4472,25 @@
return (count);
}
+int
+if_foreach(if_foreach_cb_t cb, void *cb_arg)
+{
+ if_t ifp;
+ int error;
+
+ NET_EPOCH_ASSERT();
+ MPASS(cb);
+
+ error = 0;
+ CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) {
+ error = cb(ifp, cb_arg);
+ if (error != 0)
+ break;
+ }
+
+ return (error);
+}
+
u_int
if_foreach_lladdr(if_t ifp, iflladdr_cb_t cb, void *cb_arg)
{
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -668,6 +668,9 @@
typedef u_int if_addr_cb_t(void *, struct ifaddr *, u_int);
u_int if_foreach_addr_type(if_t ifp, int type, if_addr_cb_t cb, void *cb_arg);
+typedef int (*if_foreach_cb_t)(if_t, void *);
+int if_foreach(if_foreach_cb_t, void *);
+
/* Functions */
void if_setinitfn(if_t ifp, if_init_fn_t);
void if_setinputfn(if_t ifp, if_input_fn_t);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 16, 1:29 AM (15 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29729473
Default Alt Text
D38348.id116366.diff (917 B)
Attached To
Mode
D38348: IfAPI: Add iterator to loop over all interfaces
Attached
Detach File
Event Timeline
Log In to Comment