diff options
author | Klemens Nanni <kn@cvs.openbsd.org> | 2022-11-14 22:06:27 +0000 |
---|---|---|
committer | Klemens Nanni <kn@cvs.openbsd.org> | 2022-11-14 22:06:27 +0000 |
commit | 0e80454fc9892aa998a0d577e5064043c84fece4 (patch) | |
tree | 2154ffaff2ff1bdb9a6abc16ffaa7f9ffa0f0d7b /sys/net | |
parent | 6ad31bf1f283226d1072aa6013535f0c52db7a7f (diff) |
Document global interface group list locking
The per-interface group list is protected by the net lock and already
documented as such.
The global interface group list `ifg_head' is also protected by the net
lock and all access to it (all within if.c) take it accordingly.
Feedback OK mvs
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if.c | 5 | ||||
-rw-r--r-- | sys/net/if_var.h | 22 |
2 files changed, 14 insertions, 13 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index a29a011a32b..e80b50fdf83 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.677 2022/11/10 17:17:47 dlg Exp $ */ +/* $OpenBSD: if.c,v 1.678 2022/11/14 22:06:25 kn Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -222,7 +222,8 @@ void if_idxmap_alloc(struct ifnet *); void if_idxmap_insert(struct ifnet *); void if_idxmap_remove(struct ifnet *); -TAILQ_HEAD(, ifg_group) ifg_head = TAILQ_HEAD_INITIALIZER(ifg_head); +TAILQ_HEAD(, ifg_group) ifg_head = + TAILQ_HEAD_INITIALIZER(ifg_head); /* [N] list of interface groups */ LIST_HEAD(, if_clone) if_cloners = LIST_HEAD_INITIALIZER(if_cloners); /* [I] list of clonable interfaces */ diff --git a/sys/net/if_var.h b/sys/net/if_var.h index b5ebe479b73..3a418bf0547 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_var.h,v 1.119 2022/11/10 12:46:19 kn Exp $ */ +/* $OpenBSD: if_var.h,v 1.120 2022/11/14 22:06:26 kn Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -263,22 +263,22 @@ struct ifmaddr { */ struct ifg_group { - char ifg_group[IFNAMSIZ]; - u_int ifg_refcnt; - caddr_t ifg_pf_kif; - int ifg_carp_demoted; - TAILQ_HEAD(, ifg_member) ifg_members; - TAILQ_ENTRY(ifg_group) ifg_next; + char ifg_group[IFNAMSIZ]; /* [I] group name */ + u_int ifg_refcnt; /* [N] group reference count */ + caddr_t ifg_pf_kif; /* [I] pf interface group */ + int ifg_carp_demoted; /* [K] carp demotion counter */ + TAILQ_HEAD(, ifg_member) ifg_members; /* [N] list of members per group */ + TAILQ_ENTRY(ifg_group) ifg_next; /* [N] all groups are chained */ }; struct ifg_member { - TAILQ_ENTRY(ifg_member) ifgm_next; - struct ifnet *ifgm_ifp; + TAILQ_ENTRY(ifg_member) ifgm_next; /* [N] all members are chained */ + struct ifnet *ifgm_ifp; /* [I] member interface */ }; struct ifg_list { - struct ifg_group *ifgl_group; - TAILQ_ENTRY(ifg_list) ifgl_next; + struct ifg_group *ifgl_group; /* [I] interface group */ + TAILQ_ENTRY(ifg_list) ifgl_next; /* [N] all groups are chained */ }; #define IFNET_SLOWTIMO 1 /* granularity is 1 second */ |