summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2005-05-25 06:50:06 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2005-05-25 06:50:06 +0000
commit382c311d1f0871b6ed25ccc8058af517300c4f55 (patch)
tree7b5c703defca02090aa9c7f626370e026eba527e
parent11526ce555d6cda677a05ff6a5afd5c247b3f691 (diff)
when an interface joins or leaves a group call back into pf so it can
update the internal tables used for (ifgroup) notation
-rw-r--r--sys/net/if.c10
-rw-r--r--sys/net/pf_if.c24
-rw-r--r--sys/net/pfvar.h3
3 files changed, 32 insertions, 5 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 90cceed11fe..d9ff32eac9e 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.118 2005/05/24 06:48:49 reyk Exp $ */
+/* $OpenBSD: if.c,v 1.119 2005/05/25 06:50:05 henning Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -1631,6 +1631,10 @@ if_addgroup(struct ifnet *ifp, char *groupname)
TAILQ_INSERT_TAIL(&ifg->ifg_members, ifgm, ifgm_next);
TAILQ_INSERT_TAIL(&ifp->if_groups, ifgl, ifgl_next);
+#if NPF > 0
+ pfi_group_change(groupname);
+#endif
+
return (0);
}
@@ -1670,6 +1674,10 @@ if_delgroup(struct ifnet *ifp, char *groupname)
free(ifgl, M_TEMP);
+#if NPF > 0
+ pfi_group_change(groupname);
+#endif
+
return (0);
}
diff --git a/sys/net/pf_if.c b/sys/net/pf_if.c
index fcbdca87b1f..acdef78bdbf 100644
--- a/sys/net/pf_if.c
+++ b/sys/net/pf_if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_if.c,v 1.31 2005/05/24 04:17:19 henning Exp $ */
+/* $OpenBSD: pf_if.c,v 1.32 2005/05/25 06:50:05 henning Exp $ */
/*
* Copyright 2005 Henning Brauer <henning@openbsd.org>
@@ -279,6 +279,24 @@ pfi_detach_ifgroup(struct ifg_group *ifg)
splx(s);
}
+void
+pfi_group_change(char *group)
+{
+ struct pfi_kif *kif;
+ struct pfi_dynaddr *dyn;
+ int s;
+
+ s = splsoftnet();
+ pfi_update++;
+ if ((kif = pfi_kif_get(group)) == NULL)
+ panic("pfi_kif_get failed");
+
+ TAILQ_FOREACH(dyn, &kif->pfik_dynaddrs, entry)
+ pfi_dynaddr_update(dyn);
+
+ splx(s);
+}
+
int
pfi_match_addr(struct pfi_dynaddr *dyn, struct pf_addr *a, sa_family_t af)
{
@@ -430,10 +448,10 @@ pfi_table_update(struct pfr_ktable *kt, struct pfi_kif *kif, int net, int flags)
if (kif->pfik_ifp != NULL)
pfi_instance_add(kif->pfik_ifp, net, flags);
- else if (kif->pfik_group != NULL) {
+ else if (kif->pfik_group != NULL)
TAILQ_FOREACH(ifgm, &kif->pfik_group->ifg_members, ifgm_next)
pfi_instance_add(ifgm->ifgm_ifp, net, flags);
- } else
+ else
RB_FOREACH(p, pfi_ifhead, &pfi_ifs)
if (p->pfik_ifp != NULL)
pfi_instance_add(p->pfik_ifp, net, flags);
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index aed89e219ed..63d04bd2810 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfvar.h,v 1.217 2005/05/23 23:28:53 dhartmei Exp $ */
+/* $OpenBSD: pfvar.h,v 1.218 2005/05/25 06:50:05 henning Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1503,6 +1503,7 @@ void pfi_attach_ifnet(struct ifnet *);
void pfi_detach_ifnet(struct ifnet *);
void pfi_attach_ifgroup(struct ifg_group *);
void pfi_detach_ifgroup(struct ifg_group *);
+void pfi_group_change(char *);
int pfi_match_addr(struct pfi_dynaddr *, struct pf_addr *,
sa_family_t);
int pfi_dynaddr_setup(struct pf_addr_wrap *, sa_family_t);