summaryrefslogtreecommitdiff
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2005-05-24 02:26:05 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2005-05-24 02:26:05 +0000
commit7bcec1f4132cd47e9bfebd8952a49bdaf345b13c (patch)
tree2b86e7773554c39b4cf6dc9ef4e80be9b74e6096 /sys/net/if.c
parent636bf1e47edff0b4d9dcbd9462a287b72869c5da (diff)
keep a list of member interfaces in ifg_group
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 75049c3b755..14cf8d65d2b 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.113 2005/05/22 21:06:02 henning Exp $ */
+/* $OpenBSD: if.c,v 1.114 2005/05/24 02:26:04 henning Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -1576,6 +1576,7 @@ if_addgroup(struct ifnet *ifp, char *groupname)
{
struct ifg_list *ifgl;
struct ifg_group *ifg = NULL;
+ struct ifg_member *ifgm;
TAILQ_FOREACH(ifgl, &ifp->if_groups, ifgl_next)
if (!strcmp(ifgl->ifgl_group->ifg_group, groupname))
@@ -1585,6 +1586,12 @@ if_addgroup(struct ifnet *ifp, char *groupname)
M_NOWAIT)) == NULL)
return (ENOMEM);
+ if ((ifgm = (struct ifg_member *)malloc(sizeof(struct ifg_member),
+ M_TEMP, M_NOWAIT)) == NULL) {
+ free(ifgl, M_TEMP);
+ return (ENOMEM);
+ }
+
TAILQ_FOREACH(ifg, &ifg_head, ifg_next)
if (!strcmp(ifg->ifg_group, groupname))
break;
@@ -1593,10 +1600,12 @@ if_addgroup(struct ifnet *ifp, char *groupname)
if ((ifg = (struct ifg_group *)malloc(sizeof(struct ifg_group),
M_TEMP, M_NOWAIT)) == NULL) {
free(ifgl, M_TEMP);
+ free(ifgm, M_TEMP);
return (ENOMEM);
}
strlcpy(ifg->ifg_group, groupname, sizeof(ifg->ifg_group));
ifg->ifg_refcnt = 0;
+ TAILQ_INIT(&ifg->ifg_members);
#if NPF > 0
pfi_attach_ifgroup(ifg);
#endif
@@ -1605,7 +1614,9 @@ if_addgroup(struct ifnet *ifp, char *groupname)
ifg->ifg_refcnt++;
ifgl->ifgl_group = ifg;
+ ifgm->ifgm_ifp = ifp;
+ TAILQ_INSERT_TAIL(&ifg->ifg_members, ifgm, ifgm_next);
TAILQ_INSERT_TAIL(&ifp->if_groups, ifgl, ifgl_next);
return (0);