diff options
author | 2001-09-14 20:22:18 +0000 | |
---|---|---|
committer | 2001-09-14 20:22:18 +0000 | |
commit | 8c25ef798e6e89fe55ea0375fff1fa61baa5b465 (patch) | |
tree | 77ecadb9ff81b02e4793d824a903e3290ecdb294 | |
parent | typo. Those are named 4byte/2byte, no s. (diff) | |
download | wireguard-openbsd-8c25ef798e6e89fe55ea0375fff1fa61baa5b465.tar.xz wireguard-openbsd-8c25ef798e6e89fe55ea0375fff1fa61baa5b465.zip |
binat non icmp/udp/tcp protocols as well; ok dhartmei@
-rw-r--r-- | sys/net/pf.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c index 7303d085e10..f14f0bd3cda 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.148 2001/09/11 22:20:48 dhartmei Exp $ */ +/* $OpenBSD: pf.c,v 1.149 2001/09/14 20:22:18 jasoni Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -2778,6 +2778,23 @@ int pf_test_other(int direction, struct ifnet *ifp, struct mbuf *m, struct ip *h) { struct pf_rule *r, *rm = NULL; + struct pf_binat *binat = NULL; + + if (direction == PF_OUT) { + /* check outgoing packet for BINAT */ + if ((binat = pf_get_binat(PF_OUT, ifp, NULL, h->ip_src.s_addr, + h->ip_dst.s_addr)) != NULL) { + pf_change_a(&h->ip_src.s_addr, &h->ip_sum, + binat->raddr, 0); + } + } else { + /* check incoming packet for BINAT */ + if ((binat = pf_get_binat(PF_IN, ifp, NULL, h->ip_dst.s_addr, + h->ip_src.s_addr)) != NULL) { + pf_change_a(&h->ip_dst.s_addr, &h->ip_sum, + binat->saddr, 0); + } + } r = TAILQ_FIRST(pf_rules_active); while (r != NULL) { |