summaryrefslogtreecommitdiff
path: root/sys/netinet/udp_usrreq.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2005-10-17 08:43:36 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2005-10-17 08:43:36 +0000
commit39fabf35216b41e26fde1267b94c91b0684dcba2 (patch)
tree4f38d7d737c137e9efdcf90a5f79c72f0a1a1ff4 /sys/netinet/udp_usrreq.c
parent232a2a344188b9fbf9d6c7825619aa59ddafa7e5 (diff)
make pf use one mbuf tag instead of 6 distinct ones. use a little struct
in the data part for the data from the previously distinct tags. look up the tag early and carry a pointer to it around. makes the code easier and saves some tag lookups and thus helps performance, as proven by tests run by Schberle Dniel <Schoeberle.Daniel@aamtech.hu> Initially hacked up somewhere over the atlantic ocean in an A330 early testing reyk and moritz, "put it in" theo
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
-rw-r--r--sys/netinet/udp_usrreq.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 587ae62f5c3..46ff8c86d36 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_usrreq.c,v 1.104 2005/05/27 04:55:28 mcbride Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.105 2005/10/17 08:43:34 henning Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@@ -525,17 +525,23 @@ udp_input(struct mbuf *m, ...)
inp = in_pcbhashlookup(&udbtable, ip->ip_src, uh->uh_sport,
ip->ip_dst, uh->uh_dport);
if (inp == 0) {
+ int inpl_reverse = 0;
+#if NPF > 0
+ struct pf_mtag *t;
+
+ if ((t = pf_find_mtag(m)) != NULL &&
+ t->flags & PF_TAG_TRANSLATE_LOCALHOST)
+ inpl_reverse = 1;
+#endif
++udpstat.udps_pcbhashmiss;
#ifdef INET6
if (ip6) {
inp = in6_pcblookup_listen(&udbtable,
- &ip6->ip6_dst, uh->uh_dport, m_tag_find(m,
- PACKET_TAG_PF_TRANSLATE_LOCALHOST, NULL) != NULL);
+ &ip6->ip6_dst, uh->uh_dport, inpl_reverse);
} else
#endif /* INET6 */
inp = in_pcblookup_listen(&udbtable,
- ip->ip_dst, uh->uh_dport, m_tag_find(m,
- PACKET_TAG_PF_TRANSLATE_LOCALHOST, NULL) != NULL);
+ ip->ip_dst, uh->uh_dport, inpl_reverse);
if (inp == 0) {
udpstat.udps_noport++;
if (m->m_flags & (M_BCAST | M_MCAST)) {