summaryrefslogtreecommitdiff
path: root/sys/netinet/raw_ip.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/raw_ip.c')
-rw-r--r--sys/netinet/raw_ip.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index db470c84bb2..d3ad8bf199d 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip.c,v 1.54 2011/04/19 03:47:29 dlg Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.55 2011/04/24 19:36:54 bluhm Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
@@ -157,6 +157,16 @@ rip_input(struct mbuf *m, ...)
if (inp->inp_faddr.s_addr &&
inp->inp_faddr.s_addr != ip->ip_src.s_addr)
continue;
+#if NPF > 0
+ if (m->m_pkthdr.pf.statekey && !inp->inp_pf_sk &&
+ !((struct pf_state_key *)m->m_pkthdr.pf.statekey)->inp &&
+ (inp->inp_socket->so_state & SS_ISCONNECTED) &&
+ ip->ip_p != IPPROTO_ICMP) {
+ ((struct pf_state_key *)m->m_pkthdr.pf.statekey)->inp =
+ inp;
+ inp->inp_pf_sk = m->m_pkthdr.pf.statekey;
+ }
+#endif
if (last) {
struct mbuf *n;
@@ -277,6 +287,11 @@ rip_output(struct mbuf *m, ...)
/* force routing domain */
m->m_pkthdr.rdomain = inp->inp_rtableid;
+#if NPF > 0
+ if (inp->inp_socket->so_state & SS_ISCONNECTED &&
+ ip->ip_p != IPPROTO_ICMP)
+ m->m_pkthdr.pf.inp = inp;
+#endif
error = ip_output(m, inp->inp_options, &inp->inp_route, flags,
inp->inp_moptions, inp);
if (error == EACCES) /* translate pf(4) error for userland */