diff options
author | Cedric Berger <cedric@cvs.openbsd.org> | 2004-02-02 12:47:51 +0000 |
---|---|---|
committer | Cedric Berger <cedric@cvs.openbsd.org> | 2004-02-02 12:47:51 +0000 |
commit | aefe822af0cf75325ffd4aa3200fdc52921e98bd (patch) | |
tree | ebdba591d27c3420e0ec89f24043dd4e2d3e59c6 /sys/net/pf.c | |
parent | 54185a3200b3ae5809040fe3ea00af9b2ef93ec0 (diff) |
Do not evaluate pfi_index2kif[ifp->if_index] if PF is disabled.
Safer and faster since we know that ifp->if_index can potentially
be garbage. ok dhartmei@
Diffstat (limited to 'sys/net/pf.c')
-rw-r--r-- | sys/net/pf.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c index 6e72226afc1..f9f72176d3c 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.419 2004/01/27 09:31:15 markus Exp $ */ +/* $OpenBSD: pf.c,v 1.420 2004/02/02 12:47:50 cedric Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -5251,7 +5251,7 @@ pf_add_mbuf_tag(struct mbuf *m, u_int tag) int pf_test(int dir, struct ifnet *ifp, struct mbuf **m0) { - struct pfi_kif *kif = pfi_index2kif[ifp->if_index]; + struct pfi_kif *kif; u_short action, reason = 0, log = 0; struct mbuf *m = *m0; struct ip *h; @@ -5265,6 +5265,7 @@ pf_test(int dir, struct ifnet *ifp, struct mbuf **m0) (m_tag_find(m, PACKET_TAG_PF_GENERATED, NULL) != NULL)) return (PF_PASS); + kif = pfi_index2kif[ifp->if_index]; if (kif == NULL) return (PF_DROP); @@ -5555,7 +5556,7 @@ done: int pf_test6(int dir, struct ifnet *ifp, struct mbuf **m0) { - struct pfi_kif *kif = pfi_index2kif[ifp->if_index]; + struct pfi_kif *kif; u_short action, reason = 0, log = 0; struct mbuf *m = *m0; struct ip6_hdr *h; @@ -5569,6 +5570,7 @@ pf_test6(int dir, struct ifnet *ifp, struct mbuf **m0) (m_tag_find(m, PACKET_TAG_PF_GENERATED, NULL) != NULL)) return (PF_PASS); + kif = pfi_index2kif[ifp->if_index]; if (kif == NULL) return (PF_DROP); |