diff options
author | Alexandr Nedvedicky <sashan@cvs.openbsd.org> | 2015-12-02 16:00:43 +0000 |
---|---|---|
committer | Alexandr Nedvedicky <sashan@cvs.openbsd.org> | 2015-12-02 16:00:43 +0000 |
commit | f0a004ba8a87e9ca6577ba721ab81ac1a46cf63c (patch) | |
tree | a8d33e9375b3ff83dfa8d32b3fa4933ca6ffba69 /sys | |
parent | 094e8a89de1f9ba6603647dc94f67d877fe04eb7 (diff) |
- hide PF internals to pf_unlink_divert_state() from in_pcb.c
OK mpi@, bluhm@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/pf.c | 16 | ||||
-rw-r--r-- | sys/net/pfvar.h | 3 | ||||
-rw-r--r-- | sys/netinet/in_pcb.c | 15 |
3 files changed, 20 insertions, 14 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c index c3d978ff259..f392c8dbdad 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.953 2015/12/02 13:29:25 claudio Exp $ */ +/* $OpenBSD: pf.c,v 1.954 2015/12/02 16:00:42 sashan Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -1279,6 +1279,20 @@ pf_unlink_state(struct pf_state *cur) pf_detach_state(cur); } +void +pf_unlink_divert_state(struct pf_state_key *sk) +{ + struct pf_state_item *si; + + TAILQ_FOREACH(si, &sk->states, entry) { + if (sk == si->s->key[PF_SK_STACK] && si->s->rule.ptr && + si->s->rule.ptr->divert.port) { + pf_unlink_state(si->s); + break; + } + } +} + /* callers should be at splsoftnet and hold the * write_lock on pf_consistency_lock */ void diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 5c5a30e3879..cd02361a5bf 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfvar.h,v 1.423 2015/11/20 03:35:23 dlg Exp $ */ +/* $OpenBSD: pfvar.h,v 1.424 2015/12/02 16:00:42 sashan Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -1670,6 +1670,7 @@ extern void pf_purge_thread(void *); extern void pf_purge_expired_src_nodes(int); extern void pf_purge_expired_states(u_int32_t); extern void pf_unlink_state(struct pf_state *); +extern void pf_unlink_divert_state(struct pf_state_key *); extern void pf_free_state(struct pf_state *); extern int pf_state_insert(struct pfi_kif *, struct pf_state_key **, diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 006fdf3fdb8..cb95f7208f9 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.188 2015/10/30 09:39:42 bluhm Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.189 2015/12/02 16:00:42 sashan Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -507,17 +507,8 @@ in_pcbdetach(struct inpcb *inp) ip_freemoptions(inp->inp_moptions); #if NPF > 0 if (inp->inp_pf_sk) { - struct pf_state_key *sk; - struct pf_state_item *si; - - sk = inp->inp_pf_sk; - TAILQ_FOREACH(si, &sk->states, entry) - if (sk == si->s->key[PF_SK_STACK] && si->s->rule.ptr && - si->s->rule.ptr->divert.port) { - pf_unlink_state(si->s); - break; - } - /* pf_unlink_state() may have detached the state */ + pf_unlink_divert_state(inp->inp_pf_sk); + /* pf_unlink_divert_state() may have detached the state */ if (inp->inp_pf_sk) inp->inp_pf_sk->inp = NULL; } |