From 625edea131f49ae5923a9a00751ed1b3fb6fe05e Mon Sep 17 00:00:00 2001 From: henning Date: Wed, 11 Jul 2018 09:05:51 +0000 Subject: [PATCH] provide pfi_group_addmember(), which makes the new member interface inherit set flags from the group. ok phessler benno --- sys/net/pf_if.c | 15 ++++++++++++++- sys/net/pfvar.h | 3 ++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/sys/net/pf_if.c b/sys/net/pf_if.c index 4290ba6636b..7ea1f05ea16 100644 --- a/sys/net/pf_if.c +++ b/sys/net/pf_if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_if.c,v 1.93 2018/04/24 20:23:41 bluhm Exp $ */ +/* $OpenBSD: pf_if.c,v 1.94 2018/07/11 09:05:51 henning Exp $ */ /* * Copyright 2005 Henning Brauer @@ -298,6 +298,19 @@ pfi_group_change(const char *group) pfi_kif_update(kif); } +void +pfi_group_addmember(const char *group, struct ifnet *ifp) +{ + struct pfi_kif *gkif, *ikif; + + if ((gkif = pfi_kif_get(group)) == NULL || + (ikif = pfi_kif_get(ifp->if_xname)) == NULL) + panic("pfi_kif_get failed"); + ikif->pfik_flags |= gkif->pfik_flags; + + pfi_group_change(group); +} + int pfi_match_addr(struct pfi_dynaddr *dyn, struct pf_addr *a, sa_family_t af) { diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 8edf918f946..fea4cca9bc8 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfvar.h,v 1.480 2018/07/10 16:48:22 henning Exp $ */ +/* $OpenBSD: pfvar.h,v 1.481 2018/07/11 09:05:51 henning Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -1853,6 +1853,7 @@ void pfi_detach_ifnet(struct ifnet *); void pfi_attach_ifgroup(struct ifg_group *); void pfi_detach_ifgroup(struct ifg_group *); void pfi_group_change(const char *); +void pfi_group_addmember(const char *, struct ifnet *); int pfi_match_addr(struct pfi_dynaddr *, struct pf_addr *, sa_family_t); int pfi_dynaddr_setup(struct pf_addr_wrap *, sa_family_t); -- 2.20.1