Skip to contentSkip to conversation

: lookup sockets for incoming packets in ipt_owner

PATCH In review Patrick McHardy 1 participant 1 message Sep 21, 2004

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 8/12 : lookup sockets for incoming packets in ipt_owner

This patch exports __tcp_v4_lookup and udp_v4_lookup and changes the owner match to look up the receiving socket for incoming packets.

[email protected], 2004-09-19 18:08:05+02:00, [email protected]
[NETFILTER]: lookup sockets for incoming packets in ipt_owner

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/09/19 18:08:05+02:00 [email protected]
# [NETFILTER]: lookup sockets for incoming packets in ipt_owner
#
# Signed-off-by: Patrick McHardy <[email protected]>
#

# net/ipv4/udp.c
#   2004/09/19 18:07:39+02:00 [email protected] +1 -0
#   [NETFILTER]: lookup sockets for incoming packets in ipt_owner
#   
#   Signed-off-by: Patrick McHardy <[email protected]>
# 
# net/ipv4/tcp_ipv4.c
#   2004/09/19 18:07:39+02:00 [email protected] +3 -2
#   [NETFILTER]: lookup sockets for incoming packets in ipt_owner
#   
#   Signed-off-by: Patrick McHardy <[email protected]>
# 
# net/ipv4/netfilter/ipt_owner.c
#   2004/09/19 18:07:39+02:00 [email protected] +76 -24
#   [NETFILTER]: lookup sockets for incoming packets in ipt_owner
#   
#   Signed-off-by: Patrick McHardy <[email protected]>
# 
# include/net/udp.h
#   2004/09/19 18:07:39+02:00 [email protected] +2 -0
#   [NETFILTER]: lookup sockets for incoming packets in ipt_owner
#   
#   Signed-off-by: Patrick McHardy <[email protected]>
# 
# include/net/tcp.h
#   2004/09/19 18:07:39+02:00 [email protected] +1 -0
#   [NETFILTER]: lookup sockets for incoming packets in ipt_owner
#   
#   Signed-off-by: Patrick McHardy <[email protected]>
# 
diff -Nru a/include/net/tcp.h b/include/net/tcp.h
--- a/include/net/tcp.h	2004-09-20 11:58:45 +02:00
+++ b/include/net/tcp.h	2004-09-20 11:58:45 +02:00
@@ -160,6 +160,7 @@
 extern void tcp_bucket_unlock(struct sock *sk);
 extern int tcp_port_rover;
 extern struct sock *tcp_v4_lookup_listener(u32 addr, unsigned short hnum, int dif);
+extern struct sock *__tcp_v4_lookup(u32 saddr, u16 sport, u32 daddr, u16 hnum, int dif);

/* These are AF independent. */
static __inline__ int tcp_bhashfn(__u16 lport)

include/net/udp.h +2 -0
diff -Nru a/include/net/udp.h b/include/net/udp.h
@@ -72,6 +72,8 @@
 extern int	udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
 extern int	udp_disconnect(struct sock *sk, int flags);
 
+extern struct sock *udp_v4_lookup(u32 saddr, u16 sport, u32 daddr, u16 dport, int dif);
+
 DECLARE_SNMP_STAT(struct udp_mib, udp_statistics);
 #define UDP_INC_STATS(field)		SNMP_INC_STATS(udp_statistics, field)
 #define UDP_INC_STATS_BH(field)		SNMP_INC_STATS_BH(udp_statistics, field)
net/ipv4/netfilter/ipt_owner.c +76 -24

178 lines not on this page · raw message

net/ipv4/tcp_ipv4.c +3 -2
diff -Nru a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
@@ -514,8 +514,8 @@
 	goto out;
 }
 
-static inline struct sock *__tcp_v4_lookup(u32 saddr, u16 sport,
-					   u32 daddr, u16 hnum, int dif)
+inline struct sock *__tcp_v4_lookup(u32 saddr, u16 sport,
+				    u32 daddr, u16 hnum, int dif)
 {
 	struct sock *sk = __tcp_v4_lookup_established(saddr, sport,
 						      daddr, hnum, dif);
@@ -2647,6 +2647,7 @@
 EXPORT_SYMBOL(tcp_v4_connect);
 EXPORT_SYMBOL(tcp_v4_do_rcv);
 EXPORT_SYMBOL(tcp_v4_lookup_listener);
+EXPORT_SYMBOL(__tcp_v4_lookup);
 EXPORT_SYMBOL(tcp_v4_rebuild_header);
 EXPORT_SYMBOL(tcp_v4_remember_stamp);
 EXPORT_SYMBOL(tcp_v4_send_check);
net/ipv4/udp.c +1 -0
diff -Nru a/net/ipv4/udp.c b/net/ipv4/udp.c
@@ -1516,6 +1516,7 @@
 EXPORT_SYMBOL(udp_port_rover);
 EXPORT_SYMBOL(udp_prot);
 EXPORT_SYMBOL(udp_sendmsg);
+EXPORT_SYMBOL(udp_v4_lookup);
 
 #ifdef CONFIG_PROC_FS
 EXPORT_SYMBOL(udp_proc_register);