summaryrefslogtreecommitdiff
path: root/sys/net/pf.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2011-09-17 11:34:50 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2011-09-17 11:34:50 +0000
commit003c2f7040e170c8089267bedff2f90c0e030902 (patch)
tree26b19f0c24adfcb97a12c02e289757738bb312df /sys/net/pf.c
parent18bf53ab3585b5424bb1e2b096df8081daa29eb3 (diff)
move initialisation of pd->nsaddr and pd->ndaddr from pf_test_rule to
pf_setup_pdesc. fixes logging of packets passed statefully. ok bluhm
Diffstat (limited to 'sys/net/pf.c')
-rw-r--r--sys/net/pf.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index ae9429f6245..af1fa62b8f4 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.772 2011/09/17 10:12:37 bluhm Exp $ */
+/* $OpenBSD: pf.c,v 1.773 2011/09/17 11:34:49 henning Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -2762,9 +2762,6 @@ pf_test_rule(struct pf_rule **rm, struct pf_state **sm, int direction,
u_int16_t virtual_type, virtual_id;
u_int8_t icmptype = 0, icmpcode = 0;
- PF_ACPY(&pd->nsaddr, pd->src, pd->af);
- PF_ACPY(&pd->ndaddr, pd->dst, pd->af);
-
bzero(&act, sizeof(act));
act.prio[0] = act.prio[1] = PF_PRIO_NOTSET;
bzero(sns, sizeof(sns));
@@ -2782,14 +2779,6 @@ pf_test_rule(struct pf_rule **rm, struct pf_state **sm, int direction,
}
switch (pd->virtual_proto) {
- case IPPROTO_TCP:
- pd->nsport = th->th_sport;
- pd->ndport = th->th_dport;
- break;
- case IPPROTO_UDP:
- pd->nsport = pd->hdr.udp->uh_sport;
- pd->ndport = pd->hdr.udp->uh_dport;
- break;
#ifdef INET
case IPPROTO_ICMP:
icmptype = pd->hdr.icmp->icmp_type;
@@ -2820,9 +2809,6 @@ pf_test_rule(struct pf_rule **rm, struct pf_state **sm, int direction,
}
break;
#endif /* INET6 */
- default:
- pd->nsport = pd->ndport = 0;
- break;
}
pd->osport = pd->nsport;
@@ -5762,6 +5748,9 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0,
}
+ PF_ACPY(&pd->nsaddr, pd->src, pd->af);
+ PF_ACPY(&pd->ndaddr, pd->dst, pd->af);
+
switch (pd->virtual_proto) {
case PF_VPROTO_FRAGMENT:
/*
@@ -5838,6 +5827,12 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0,
}
#endif /* INET6 */
}
+
+ if (pd->sport)
+ pd->nsport = *pd->sport;
+ if (pd->dport)
+ pd->ndport = *pd->dport;
+
return (0);
}