Commit 779dc0ae authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

[TCP]: Modularize tcpdiag

This is the first step in fixing the tcpdiag/modular ipv6 issue.
We modularise tcpdiag in the obvious way.

Next we can move out the IPv6-specific stuff.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 974da4b4
......@@ -349,5 +349,14 @@ config INET_TUNNEL
If unsure, say Y.
config IP_TCPDIAG
tristate "IP: TCP socket monitoring interface"
default y
---help---
Support for TCP socket monitoring interface used by native Linux
tools such as ss.
If unsure, say Y.
source "net/ipv4/ipvs/Kconfig"
......@@ -6,7 +6,7 @@ obj-y := utils.o route.o inetpeer.o protocol.o \
ip_input.o ip_fragment.o ip_forward.o ip_options.o \
ip_output.o ip_sockglue.o \
tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o tcp_minisocks.o \
tcp_diag.o datagram.o raw.o udp.o arp.o icmp.o devinet.o af_inet.o igmp.o \
datagram.o raw.o udp.o arp.o icmp.o devinet.o af_inet.o igmp.o \
sysctl_net_ipv4.o fib_frontend.o fib_semantics.o fib_hash.o
obj-$(CONFIG_PROC_FS) += proc.o
......@@ -22,6 +22,7 @@ obj-$(CONFIG_INET_TUNNEL) += xfrm4_tunnel.o
obj-$(CONFIG_IP_PNP) += ipconfig.o
obj-$(CONFIG_NETFILTER) += netfilter/
obj-$(CONFIG_IP_VS) += ipvs/
obj-$(CONFIG_IP_TCPDIAG) += tcp_diag.o
obj-$(CONFIG_XFRM) += xfrm4_policy.o xfrm4_state.o xfrm4_input.o \
xfrm4_output.o
......@@ -2152,6 +2152,8 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info)
info->tcpi_total_retrans = tp->total_retrans;
}
EXPORT_SYMBOL_GPL(tcp_get_info);
int tcp_getsockopt(struct sock *sk, int level, int optname, char __user *optval,
int __user *optlen)
{
......@@ -2358,8 +2360,6 @@ void __init tcp_init(void)
printk(KERN_INFO "TCP: Hash tables configured "
"(established %d bind %d)\n",
tcp_ehash_size << 1, tcp_bhash_size);
tcpdiag_init();
}
EXPORT_SYMBOL(tcp_accept);
......
......@@ -776,9 +776,19 @@ static void tcpdiag_rcv(struct sock *sk, int len)
}
}
void __init tcpdiag_init(void)
static int __init tcpdiag_init(void)
{
tcpnl = netlink_kernel_create(NETLINK_TCPDIAG, tcpdiag_rcv);
if (tcpnl == NULL)
panic("tcpdiag_init: Cannot create netlink socket.");
return -ENOMEM;
return 0;
}
static void __exit tcpdiag_exit(void)
{
sock_release(tcpnl->sk_socket);
}
module_init(tcpdiag_init);
module_exit(tcpdiag_exit);
MODULE_LICENSE("GPL");
......@@ -535,6 +535,8 @@ inline struct sock *tcp_v4_lookup(u32 saddr, u16 sport, u32 daddr,
return sk;
}
EXPORT_SYMBOL_GPL(tcp_v4_lookup);
static inline __u32 tcp_v4_init_sequence(struct sock *sk, struct sk_buff *skb)
{
return secure_tcp_sequence_number(skb->nh.iph->daddr,
......
......@@ -364,6 +364,8 @@ inline struct sock *tcp_v6_lookup(struct in6_addr *saddr, u16 sport,
return sk;
}
EXPORT_SYMBOL_GPL(tcp_v6_lookup);
/*
* Open request hash tables.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment