diff options
| author | Gleb Smirnoff <glebius@FreeBSD.org> | 2006-01-24 09:08:54 +0000 |
|---|---|---|
| committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2006-01-24 09:08:54 +0000 |
| commit | 0b4ae859ac4f6a9e9e90bf70607cf29c5bdacae5 (patch) | |
| tree | 2ff0a67ac1b049ad7113d8fba9060ce00b9d2527 | |
| parent | 1aa4c324ee8a49a7a6e1a3f6b5e99257b6a0236f (diff) | |
Notes
| -rw-r--r-- | sys/netinet/udp_usrreq.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 0693a7eabe98..993450bbb69d 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -30,6 +30,7 @@ * $FreeBSD$ */ +#include "opt_ipfw.h" #include "opt_ipsec.h" #include "opt_inet6.h" #include "opt_mac.h" @@ -154,6 +155,9 @@ udp_input(m, off) int len; struct ip save_ip; struct sockaddr_in udp_in; +#ifdef IPFIREWALL_FORWARD + struct m_tag *fwd_tag; +#endif udpstat.udps_ipackets++; @@ -243,6 +247,22 @@ udp_input(m, off) } else udpstat.udps_nosum++; +#ifdef IPFIREWALL_FORWARD + /* Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain. */ + fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); + + if (fwd_tag != NULL) { + struct sockaddr_in *next_hop; + + /* Do the hack. */ + next_hop = (struct sockaddr_in *)(fwd_tag + 1); + ip->ip_dst = next_hop->sin_addr; + uh->uh_dport = ntohs(next_hop->sin_port); + /* Remove the tag from the packet. We don't need it anymore. */ + m_tag_delete(m, fwd_tag); + } +#endif + INP_INFO_RLOCK(&udbinfo); if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) || |
