[PATCH 07/14] Export UDP socket lookup function

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: David Miller <davem@...>
Cc: Patrick McHardy <kaber@...>, <netdev@...>
Date: Saturday, October 13, 2007 - 1:32 pm

The iptables tproxy code has to be able to do UDP socket hash lookups,
so we have to provide an exported lookup function for this purpose.

Signed-off-by: KOVACS Krisztian <hidden@sch.bme.hu>
---

 include/net/udp.h |    4 ++++
 net/ipv4/udp.c    |    8 ++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/include/net/udp.h b/include/net/udp.h
index 98755eb..3efae7d 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -138,6 +138,10 @@ extern int 	udp_lib_setsockopt(struct sock *sk, int level, int optname,
 				   char __user *optval, int optlen,
 				   int (*push_pending_frames)(struct sock *));
 
+extern struct sock *udp4_lib_lookup(__be32 saddr, __be16 sport,
+				    __be32 daddr, __be16 dport,
+				    int dif);
+
 DECLARE_SNMP_STAT(struct udp_mib, udp_statistics);
 /*
  * 	SNMP statistics for UDP and UDP-Lite
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index cb9fc58..053d5c4 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -294,6 +294,14 @@ static struct sock *__udp4_lib_lookup(__be32 saddr, __be16 sport,
 	return result;
 }
 
+struct sock *udp4_lib_lookup(__be32 saddr, __be16 sport,
+			       __be32 daddr, __be16 dport,
+			       int dif)
+{
+	return __udp4_lib_lookup(saddr, sport, daddr, dport, dif, udp_hash);
+}
+EXPORT_SYMBOL_GPL(udp4_lib_lookup);
+
 static inline struct sock *udp_v4_mcast_next(struct sock *sk,
 					     __be16 loc_port, __be32 loc_addr,
 					     __be16 rmt_port, __be32 rmt_addr,

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/14] Transparent Proxying Patches, Take 5, KOVACS Krisztian, (Sat Oct 13, 1:28 pm)
Re: [PATCH 00/14] Transparent Proxying Patches, Take 5, David Miller, (Sat Oct 13, 6:44 pm)
Re: [PATCH 00/14] Transparent Proxying Patches, Take 5, KOVACS Krisztian, (Sun Oct 14, 5:05 am)
[PATCH 07/14] Export UDP socket lookup function, KOVACS Krisztian, (Sat Oct 13, 1:32 pm)
[PATCH 09/14] iptables tproxy core, KOVACS Krisztian, (Sat Oct 13, 1:33 pm)
[PATCH 06/14] Port redirection support for TCP, KOVACS Krisztian, (Sat Oct 13, 1:32 pm)
[PATCH 05/14] Handle TCP SYN+ACK/ACK/RST transparency, KOVACS Krisztian, (Sat Oct 13, 1:31 pm)
[PATCH 02/14] Implement IP_TRANSPARENT socket option, KOVACS Krisztian, (Sat Oct 13, 1:29 pm)
[PATCH 01/14] Loosen source address check on IPv4 output, KOVACS Krisztian, (Sat Oct 13, 1:29 pm)
[PATCH 14/14] Add documentation, KOVACS Krisztian, (Sat Oct 13, 1:36 pm)
[PATCH 11/14] iptables TPROXY target, KOVACS Krisztian, (Sat Oct 13, 1:34 pm)
[PATCH 10/14] iptables socket match, KOVACS Krisztian, (Sat Oct 13, 1:34 pm)