Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[TCPDIAG]: Just rename everything to inet_diag

Next changeset will rename tcp_diag.[ch] to inet_diag.[ch].

I'm taking this longer route so as to easy review, making clear the changes
made all along the way.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Arnaldo Carvalho de Melo and committed by
David S. Miller
73c1f4a0 4f5736c4

+273 -281
+1 -1
include/linux/netlink.h
··· 8 8 #define NETLINK_W1 1 /* 1-wire subsystem */ 9 9 #define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ 10 10 #define NETLINK_FIREWALL 3 /* Firewalling hook */ 11 - #define NETLINK_TCPDIAG 4 /* TCP socket monitoring */ 11 + #define NETLINK_INET_DIAG 4 /* INET socket monitoring */ 12 12 #define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ 13 13 #define NETLINK_XFRM 6 /* ipsec */ 14 14 #define NETLINK_SELINUX 7 /* SELinux event notifications */
+61 -70
include/linux/tcp_diag.h
··· 1 - #ifndef _TCP_DIAG_H_ 2 - #define _TCP_DIAG_H_ 1 1 + #ifndef _INET_DIAG_H_ 2 + #define _INET_DIAG_H_ 1 3 3 4 4 /* Just some random number */ 5 5 #define TCPDIAG_GETSOCK 18 ··· 8 8 #define INET_DIAG_GETSOCK_MAX 24 9 9 10 10 /* Socket identity */ 11 - struct tcpdiag_sockid 12 - { 13 - __u16 tcpdiag_sport; 14 - __u16 tcpdiag_dport; 15 - __u32 tcpdiag_src[4]; 16 - __u32 tcpdiag_dst[4]; 17 - __u32 tcpdiag_if; 18 - __u32 tcpdiag_cookie[2]; 19 - #define TCPDIAG_NOCOOKIE (~0U) 11 + struct inet_diag_sockid { 12 + __u16 idiag_sport; 13 + __u16 idiag_dport; 14 + __u32 idiag_src[4]; 15 + __u32 idiag_dst[4]; 16 + __u32 idiag_if; 17 + __u32 idiag_cookie[2]; 18 + #define INET_DIAG_NOCOOKIE (~0U) 20 19 }; 21 20 22 21 /* Request structure */ 23 22 24 - struct tcpdiagreq 25 - { 26 - __u8 tcpdiag_family; /* Family of addresses. */ 27 - __u8 tcpdiag_src_len; 28 - __u8 tcpdiag_dst_len; 29 - __u8 tcpdiag_ext; /* Query extended information */ 23 + struct inet_diag_req { 24 + __u8 idiag_family; /* Family of addresses. */ 25 + __u8 idiag_src_len; 26 + __u8 idiag_dst_len; 27 + __u8 idiag_ext; /* Query extended information */ 30 28 31 - struct tcpdiag_sockid id; 29 + struct inet_diag_sockid id; 32 30 33 - __u32 tcpdiag_states; /* States to dump */ 34 - __u32 tcpdiag_dbs; /* Tables to dump (NI) */ 31 + __u32 idiag_states; /* States to dump */ 32 + __u32 idiag_dbs; /* Tables to dump (NI) */ 35 33 }; 36 34 37 - enum 38 - { 39 - TCPDIAG_REQ_NONE, 40 - TCPDIAG_REQ_BYTECODE, 35 + enum { 36 + INET_DIAG_REQ_NONE, 37 + INET_DIAG_REQ_BYTECODE, 41 38 }; 42 39 43 - #define TCPDIAG_REQ_MAX TCPDIAG_REQ_BYTECODE 40 + #define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE 44 41 45 42 /* Bytecode is sequence of 4 byte commands followed by variable arguments. 46 43 * All the commands identified by "code" are conditional jumps forward: ··· 45 48 * length of the command and its arguments. 46 49 */ 47 50 48 - struct tcpdiag_bc_op 49 - { 51 + struct inet_diag_bc_op { 50 52 unsigned char code; 51 53 unsigned char yes; 52 54 unsigned short no; 53 55 }; 54 56 55 - enum 56 - { 57 - TCPDIAG_BC_NOP, 58 - TCPDIAG_BC_JMP, 59 - TCPDIAG_BC_S_GE, 60 - TCPDIAG_BC_S_LE, 61 - TCPDIAG_BC_D_GE, 62 - TCPDIAG_BC_D_LE, 63 - TCPDIAG_BC_AUTO, 64 - TCPDIAG_BC_S_COND, 65 - TCPDIAG_BC_D_COND, 57 + enum { 58 + INET_DIAG_BC_NOP, 59 + INET_DIAG_BC_JMP, 60 + INET_DIAG_BC_S_GE, 61 + INET_DIAG_BC_S_LE, 62 + INET_DIAG_BC_D_GE, 63 + INET_DIAG_BC_D_LE, 64 + INET_DIAG_BC_AUTO, 65 + INET_DIAG_BC_S_COND, 66 + INET_DIAG_BC_D_COND, 66 67 }; 67 68 68 - struct tcpdiag_hostcond 69 - { 69 + struct inet_diag_hostcond { 70 70 __u8 family; 71 71 __u8 prefix_len; 72 72 int port; ··· 72 78 73 79 /* Base info structure. It contains socket identity (addrs/ports/cookie) 74 80 * and, alas, the information shown by netstat. */ 75 - struct tcpdiagmsg 76 - { 77 - __u8 tcpdiag_family; 78 - __u8 tcpdiag_state; 79 - __u8 tcpdiag_timer; 80 - __u8 tcpdiag_retrans; 81 + struct inet_diag_msg { 82 + __u8 idiag_family; 83 + __u8 idiag_state; 84 + __u8 idiag_timer; 85 + __u8 idiag_retrans; 81 86 82 - struct tcpdiag_sockid id; 87 + struct inet_diag_sockid id; 83 88 84 - __u32 tcpdiag_expires; 85 - __u32 tcpdiag_rqueue; 86 - __u32 tcpdiag_wqueue; 87 - __u32 tcpdiag_uid; 88 - __u32 tcpdiag_inode; 89 + __u32 idiag_expires; 90 + __u32 idiag_rqueue; 91 + __u32 idiag_wqueue; 92 + __u32 idiag_uid; 93 + __u32 idiag_inode; 89 94 }; 90 95 91 96 /* Extensions */ 92 97 93 - enum 94 - { 95 - TCPDIAG_NONE, 96 - TCPDIAG_MEMINFO, 97 - TCPDIAG_INFO, 98 - TCPDIAG_VEGASINFO, 99 - TCPDIAG_CONG, 98 + enum { 99 + INET_DIAG_NONE, 100 + INET_DIAG_MEMINFO, 101 + INET_DIAG_INFO, 102 + INET_DIAG_VEGASINFO, 103 + INET_DIAG_CONG, 100 104 }; 101 105 102 - #define TCPDIAG_MAX TCPDIAG_CONG 106 + #define INET_DIAG_MAX INET_DIAG_CONG 103 107 104 108 105 - /* TCPDIAG_MEM */ 109 + /* INET_DIAG_MEM */ 106 110 107 - struct tcpdiag_meminfo 108 - { 109 - __u32 tcpdiag_rmem; 110 - __u32 tcpdiag_wmem; 111 - __u32 tcpdiag_fmem; 112 - __u32 tcpdiag_tmem; 111 + struct inet_diag_meminfo { 112 + __u32 idiag_rmem; 113 + __u32 idiag_wmem; 114 + __u32 idiag_fmem; 115 + __u32 idiag_tmem; 113 116 }; 114 117 115 - /* TCPDIAG_VEGASINFO */ 118 + /* INET_DIAG_VEGASINFO */ 116 119 117 120 struct tcpvegas_info { 118 121 __u32 tcpv_enabled; ··· 125 134 struct inet_diag_handler { 126 135 struct inet_hashinfo *idiag_hashinfo; 127 136 void (*idiag_get_info)(struct sock *sk, 128 - struct tcpdiagmsg *r, 137 + struct inet_diag_msg *r, 129 138 void *info); 130 139 __u16 idiag_info_size; 131 140 __u16 idiag_type; ··· 135 144 extern void inet_diag_unregister(const struct inet_diag_handler *handler); 136 145 #endif /* __KERNEL__ */ 137 146 138 - #endif /* _TCP_DIAG_H_ */ 147 + #endif /* _INET_DIAG_H_ */
+1 -1
include/net/tcp.h
··· 690 690 u32 (*undo_cwnd)(struct sock *sk); 691 691 /* hook for packet ack accounting (optional) */ 692 692 void (*pkts_acked)(struct sock *sk, u32 num_acked); 693 - /* get info for tcp_diag (optional) */ 693 + /* get info for inet_diag (optional) */ 694 694 void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb); 695 695 696 696 char name[TCP_CA_NAME_MAX];
+2 -2
net/dccp/Kconfig
··· 20 20 If in doubt, say N. 21 21 22 22 config IP_DCCP_DIAG 23 - depends on IP_DCCP && IP_TCPDIAG 24 - def_tristate y if (IP_DCCP = y && IP_TCPDIAG = y) 23 + depends on IP_DCCP && IP_INET_DIAG 24 + def_tristate y if (IP_DCCP = y && IP_INET_DIAG = y) 25 25 def_tristate m 26 26 27 27 source "net/dccp/ccids/Kconfig"
+2 -2
net/dccp/diag.c
··· 16 16 17 17 #include "dccp.h" 18 18 19 - static void dccp_diag_get_info(struct sock *sk, struct tcpdiagmsg *r, 19 + static void dccp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, 20 20 void *_info) 21 21 { 22 - r->tcpdiag_rqueue = r->tcpdiag_wqueue = 0; 22 + r->idiag_rqueue = r->idiag_wqueue = 0; 23 23 } 24 24 25 25 static struct inet_diag_handler dccp_diag_handler = {
+5 -5
net/ipv4/Kconfig
··· 413 413 414 414 If unsure, say Y. 415 415 416 - config IP_TCPDIAG 417 - tristate "IP: TCP socket monitoring interface" 416 + config IP_INET_DIAG 417 + tristate "IP: INET socket monitoring interface" 418 418 default y 419 419 ---help--- 420 - Support for TCP socket monitoring interface used by native Linux 421 - tools such as ss. ss is included in iproute2, currently downloadable 422 - at <http://developer.osdl.org/dev/iproute2>. 420 + Support for INET (TCP, DCCP, etc) socket monitoring interface used by 421 + native Linux tools such as ss. ss is included in iproute2, currently 422 + downloadable at <http://developer.osdl.org/dev/iproute2>. 423 423 424 424 If unsure, say Y. 425 425
+1 -1
net/ipv4/Makefile
··· 30 30 obj-$(CONFIG_IP_ROUTE_MULTIPATH_DRR) += multipath_drr.o 31 31 obj-$(CONFIG_NETFILTER) += netfilter/ 32 32 obj-$(CONFIG_IP_VS) += ipvs/ 33 - obj-$(CONFIG_IP_TCPDIAG) += tcp_diag.o 33 + obj-$(CONFIG_IP_INET_DIAG) += tcp_diag.o 34 34 obj-$(CONFIG_IP_ROUTE_MULTIPATH_CACHED) += multipath.o 35 35 obj-$(CONFIG_TCP_CONG_BIC) += tcp_bic.o 36 36 obj-$(CONFIG_TCP_CONG_WESTWOOD) += tcp_westwood.o
+196 -195
net/ipv4/tcp_diag.c
··· 1 1 /* 2 - * tcp_diag.c Module for monitoring TCP sockets. 2 + * inet_diag.c Module for monitoring INET transport protocols sockets. 3 3 * 4 - * Version: $Id: tcp_diag.c,v 1.3 2002/02/01 22:01:04 davem Exp $ 4 + * Version: $Id: inet_diag.c,v 1.3 2002/02/01 22:01:04 davem Exp $ 5 5 * 6 6 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 7 7 * ··· 36 36 37 37 static const struct inet_diag_handler **inet_diag_table; 38 38 39 - struct tcpdiag_entry 40 - { 39 + struct inet_diag_entry { 41 40 u32 *saddr; 42 41 u32 *daddr; 43 42 u16 sport; ··· 45 46 u16 userlocks; 46 47 }; 47 48 48 - static struct sock *tcpnl; 49 + static struct sock *idiagnl; 49 50 50 - #define TCPDIAG_PUT(skb, attrtype, attrlen) \ 51 + #define INET_DIAG_PUT(skb, attrtype, attrlen) \ 51 52 RTA_DATA(__RTA_PUT(skb, attrtype, attrlen)) 52 53 53 - #ifdef CONFIG_IP_TCPDIAG_DCCP 54 - extern struct inet_hashinfo dccp_hashinfo; 55 - #endif 56 - 57 - static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk, 54 + static int inet_diag_fill(struct sk_buff *skb, struct sock *sk, 58 55 int ext, u32 pid, u32 seq, u16 nlmsg_flags, 59 56 const struct nlmsghdr *unlh) 60 57 { 61 58 const struct inet_sock *inet = inet_sk(sk); 62 59 const struct inet_connection_sock *icsk = inet_csk(sk); 63 - struct tcpdiagmsg *r; 60 + struct inet_diag_msg *r; 64 61 struct nlmsghdr *nlh; 65 62 void *info = NULL; 66 - struct tcpdiag_meminfo *minfo = NULL; 63 + struct inet_diag_meminfo *minfo = NULL; 67 64 unsigned char *b = skb->tail; 68 65 const struct inet_diag_handler *handler; 69 66 ··· 71 76 72 77 r = NLMSG_DATA(nlh); 73 78 if (sk->sk_state != TCP_TIME_WAIT) { 74 - if (ext & (1<<(TCPDIAG_MEMINFO-1))) 75 - minfo = TCPDIAG_PUT(skb, TCPDIAG_MEMINFO, sizeof(*minfo)); 76 - if (ext & (1<<(TCPDIAG_INFO-1))) 77 - info = TCPDIAG_PUT(skb, TCPDIAG_INFO, 79 + if (ext & (1 << (INET_DIAG_MEMINFO - 1))) 80 + minfo = INET_DIAG_PUT(skb, INET_DIAG_MEMINFO, 81 + sizeof(*minfo)); 82 + if (ext & (1 << (INET_DIAG_INFO - 1))) 83 + info = INET_DIAG_PUT(skb, INET_DIAG_INFO, 78 84 handler->idiag_info_size); 79 85 80 - if ((ext & (1 << (TCPDIAG_CONG - 1))) && icsk->icsk_ca_ops) { 86 + if ((ext & (1 << (INET_DIAG_CONG - 1))) && icsk->icsk_ca_ops) { 81 87 size_t len = strlen(icsk->icsk_ca_ops->name); 82 - strcpy(TCPDIAG_PUT(skb, TCPDIAG_CONG, len+1), 88 + strcpy(INET_DIAG_PUT(skb, INET_DIAG_CONG, len + 1), 83 89 icsk->icsk_ca_ops->name); 84 90 } 85 91 } 86 - r->tcpdiag_family = sk->sk_family; 87 - r->tcpdiag_state = sk->sk_state; 88 - r->tcpdiag_timer = 0; 89 - r->tcpdiag_retrans = 0; 92 + r->idiag_family = sk->sk_family; 93 + r->idiag_state = sk->sk_state; 94 + r->idiag_timer = 0; 95 + r->idiag_retrans = 0; 90 96 91 - r->id.tcpdiag_if = sk->sk_bound_dev_if; 92 - r->id.tcpdiag_cookie[0] = (u32)(unsigned long)sk; 93 - r->id.tcpdiag_cookie[1] = (u32)(((unsigned long)sk >> 31) >> 1); 97 + r->id.idiag_if = sk->sk_bound_dev_if; 98 + r->id.idiag_cookie[0] = (u32)(unsigned long)sk; 99 + r->id.idiag_cookie[1] = (u32)(((unsigned long)sk >> 31) >> 1); 94 100 95 - if (r->tcpdiag_state == TCP_TIME_WAIT) { 101 + if (r->idiag_state == TCP_TIME_WAIT) { 96 102 const struct inet_timewait_sock *tw = inet_twsk(sk); 97 103 long tmo = tw->tw_ttd - jiffies; 98 104 if (tmo < 0) 99 105 tmo = 0; 100 106 101 - r->id.tcpdiag_sport = tw->tw_sport; 102 - r->id.tcpdiag_dport = tw->tw_dport; 103 - r->id.tcpdiag_src[0] = tw->tw_rcv_saddr; 104 - r->id.tcpdiag_dst[0] = tw->tw_daddr; 105 - r->tcpdiag_state = tw->tw_substate; 106 - r->tcpdiag_timer = 3; 107 - r->tcpdiag_expires = (tmo*1000+HZ-1)/HZ; 108 - r->tcpdiag_rqueue = 0; 109 - r->tcpdiag_wqueue = 0; 110 - r->tcpdiag_uid = 0; 111 - r->tcpdiag_inode = 0; 107 + r->id.idiag_sport = tw->tw_sport; 108 + r->id.idiag_dport = tw->tw_dport; 109 + r->id.idiag_src[0] = tw->tw_rcv_saddr; 110 + r->id.idiag_dst[0] = tw->tw_daddr; 111 + r->idiag_state = tw->tw_substate; 112 + r->idiag_timer = 3; 113 + r->idiag_expires = (tmo * 1000 + HZ - 1) / HZ; 114 + r->idiag_rqueue = 0; 115 + r->idiag_wqueue = 0; 116 + r->idiag_uid = 0; 117 + r->idiag_inode = 0; 112 118 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 113 - if (r->tcpdiag_family == AF_INET6) { 119 + if (r->idiag_family == AF_INET6) { 114 120 const struct tcp6_timewait_sock *tcp6tw = tcp6_twsk(sk); 115 121 116 - ipv6_addr_copy((struct in6_addr *)r->id.tcpdiag_src, 122 + ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, 117 123 &tcp6tw->tw_v6_rcv_saddr); 118 - ipv6_addr_copy((struct in6_addr *)r->id.tcpdiag_dst, 124 + ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, 119 125 &tcp6tw->tw_v6_daddr); 120 126 } 121 127 #endif ··· 124 128 return skb->len; 125 129 } 126 130 127 - r->id.tcpdiag_sport = inet->sport; 128 - r->id.tcpdiag_dport = inet->dport; 129 - r->id.tcpdiag_src[0] = inet->rcv_saddr; 130 - r->id.tcpdiag_dst[0] = inet->daddr; 131 + r->id.idiag_sport = inet->sport; 132 + r->id.idiag_dport = inet->dport; 133 + r->id.idiag_src[0] = inet->rcv_saddr; 134 + r->id.idiag_dst[0] = inet->daddr; 131 135 132 136 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 133 - if (r->tcpdiag_family == AF_INET6) { 137 + if (r->idiag_family == AF_INET6) { 134 138 struct ipv6_pinfo *np = inet6_sk(sk); 135 139 136 - ipv6_addr_copy((struct in6_addr *)r->id.tcpdiag_src, 140 + ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, 137 141 &np->rcv_saddr); 138 - ipv6_addr_copy((struct in6_addr *)r->id.tcpdiag_dst, 142 + ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, 139 143 &np->daddr); 140 144 } 141 145 #endif ··· 143 147 #define EXPIRES_IN_MS(tmo) ((tmo-jiffies)*1000+HZ-1)/HZ 144 148 145 149 if (icsk->icsk_pending == ICSK_TIME_RETRANS) { 146 - r->tcpdiag_timer = 1; 147 - r->tcpdiag_retrans = icsk->icsk_retransmits; 148 - r->tcpdiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout); 150 + r->idiag_timer = 1; 151 + r->idiag_retrans = icsk->icsk_retransmits; 152 + r->idiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout); 149 153 } else if (icsk->icsk_pending == ICSK_TIME_PROBE0) { 150 - r->tcpdiag_timer = 4; 151 - r->tcpdiag_retrans = icsk->icsk_probes_out; 152 - r->tcpdiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout); 154 + r->idiag_timer = 4; 155 + r->idiag_retrans = icsk->icsk_probes_out; 156 + r->idiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout); 153 157 } else if (timer_pending(&sk->sk_timer)) { 154 - r->tcpdiag_timer = 2; 155 - r->tcpdiag_retrans = icsk->icsk_probes_out; 156 - r->tcpdiag_expires = EXPIRES_IN_MS(sk->sk_timer.expires); 158 + r->idiag_timer = 2; 159 + r->idiag_retrans = icsk->icsk_probes_out; 160 + r->idiag_expires = EXPIRES_IN_MS(sk->sk_timer.expires); 157 161 } else { 158 - r->tcpdiag_timer = 0; 159 - r->tcpdiag_expires = 0; 162 + r->idiag_timer = 0; 163 + r->idiag_expires = 0; 160 164 } 161 165 #undef EXPIRES_IN_MS 162 166 163 - r->tcpdiag_uid = sock_i_uid(sk); 164 - r->tcpdiag_inode = sock_i_ino(sk); 167 + r->idiag_uid = sock_i_uid(sk); 168 + r->idiag_inode = sock_i_ino(sk); 165 169 166 170 if (minfo) { 167 - minfo->tcpdiag_rmem = atomic_read(&sk->sk_rmem_alloc); 168 - minfo->tcpdiag_wmem = sk->sk_wmem_queued; 169 - minfo->tcpdiag_fmem = sk->sk_forward_alloc; 170 - minfo->tcpdiag_tmem = atomic_read(&sk->sk_wmem_alloc); 171 + minfo->idiag_rmem = atomic_read(&sk->sk_rmem_alloc); 172 + minfo->idiag_wmem = sk->sk_wmem_queued; 173 + minfo->idiag_fmem = sk->sk_forward_alloc; 174 + minfo->idiag_tmem = atomic_read(&sk->sk_wmem_alloc); 171 175 } 172 176 173 177 handler->idiag_get_info(sk, r, info); ··· 185 189 return -1; 186 190 } 187 191 188 - static int tcpdiag_get_exact(struct sk_buff *in_skb, const struct nlmsghdr *nlh) 192 + static int inet_diag_get_exact(struct sk_buff *in_skb, const struct nlmsghdr *nlh) 189 193 { 190 194 int err; 191 195 struct sock *sk; 192 - struct tcpdiagreq *req = NLMSG_DATA(nlh); 196 + struct inet_diag_req *req = NLMSG_DATA(nlh); 193 197 struct sk_buff *rep; 194 198 struct inet_hashinfo *hashinfo; 195 199 const struct inet_diag_handler *handler; ··· 198 202 BUG_ON(handler == NULL); 199 203 hashinfo = handler->idiag_hashinfo; 200 204 201 - if (req->tcpdiag_family == AF_INET) { 202 - sk = inet_lookup(hashinfo, req->id.tcpdiag_dst[0], 203 - req->id.tcpdiag_dport, req->id.tcpdiag_src[0], 204 - req->id.tcpdiag_sport, req->id.tcpdiag_if); 205 + if (req->idiag_family == AF_INET) { 206 + sk = inet_lookup(hashinfo, req->id.idiag_dst[0], 207 + req->id.idiag_dport, req->id.idiag_src[0], 208 + req->id.idiag_sport, req->id.idiag_if); 205 209 } 206 210 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 207 - else if (req->tcpdiag_family == AF_INET6) { 211 + else if (req->idiag_family == AF_INET6) { 208 212 sk = inet6_lookup(hashinfo, 209 - (struct in6_addr*)req->id.tcpdiag_dst, 210 - req->id.tcpdiag_dport, 211 - (struct in6_addr*)req->id.tcpdiag_src, 212 - req->id.tcpdiag_sport, 213 - req->id.tcpdiag_if); 213 + (struct in6_addr *)req->id.idiag_dst, 214 + req->id.idiag_dport, 215 + (struct in6_addr *)req->id.idiag_src, 216 + req->id.idiag_sport, 217 + req->id.idiag_if); 214 218 } 215 219 #endif 216 220 else { ··· 221 225 return -ENOENT; 222 226 223 227 err = -ESTALE; 224 - if ((req->id.tcpdiag_cookie[0] != TCPDIAG_NOCOOKIE || 225 - req->id.tcpdiag_cookie[1] != TCPDIAG_NOCOOKIE) && 226 - ((u32)(unsigned long)sk != req->id.tcpdiag_cookie[0] || 227 - (u32)((((unsigned long)sk) >> 31) >> 1) != req->id.tcpdiag_cookie[1])) 228 + if ((req->id.idiag_cookie[0] != INET_DIAG_NOCOOKIE || 229 + req->id.idiag_cookie[1] != INET_DIAG_NOCOOKIE) && 230 + ((u32)(unsigned long)sk != req->id.idiag_cookie[0] || 231 + (u32)((((unsigned long)sk) >> 31) >> 1) != req->id.idiag_cookie[1])) 228 232 goto out; 229 233 230 234 err = -ENOMEM; 231 - rep = alloc_skb(NLMSG_SPACE((sizeof(struct tcpdiagmsg) + 232 - sizeof(struct tcpdiag_meminfo) + 235 + rep = alloc_skb(NLMSG_SPACE((sizeof(struct inet_diag_msg) + 236 + sizeof(struct inet_diag_meminfo) + 233 237 handler->idiag_info_size + 64)), 234 238 GFP_KERNEL); 235 239 if (!rep) 236 240 goto out; 237 241 238 - if (tcpdiag_fill(rep, sk, req->tcpdiag_ext, 242 + if (inet_diag_fill(rep, sk, req->idiag_ext, 239 243 NETLINK_CB(in_skb).pid, 240 244 nlh->nlmsg_seq, 0, nlh) <= 0) 241 245 BUG(); 242 246 243 - err = netlink_unicast(tcpnl, rep, NETLINK_CB(in_skb).pid, MSG_DONTWAIT); 247 + err = netlink_unicast(idiagnl, rep, NETLINK_CB(in_skb).pid, 248 + MSG_DONTWAIT); 244 249 if (err > 0) 245 250 err = 0; 246 251 ··· 282 285 } 283 286 284 287 285 - static int tcpdiag_bc_run(const void *bc, int len, 286 - const struct tcpdiag_entry *entry) 288 + static int inet_diag_bc_run(const void *bc, int len, 289 + const struct inet_diag_entry *entry) 287 290 { 288 291 while (len > 0) { 289 292 int yes = 1; 290 - const struct tcpdiag_bc_op *op = bc; 293 + const struct inet_diag_bc_op *op = bc; 291 294 292 295 switch (op->code) { 293 - case TCPDIAG_BC_NOP: 296 + case INET_DIAG_BC_NOP: 294 297 break; 295 - case TCPDIAG_BC_JMP: 298 + case INET_DIAG_BC_JMP: 296 299 yes = 0; 297 300 break; 298 - case TCPDIAG_BC_S_GE: 301 + case INET_DIAG_BC_S_GE: 299 302 yes = entry->sport >= op[1].no; 300 303 break; 301 - case TCPDIAG_BC_S_LE: 304 + case INET_DIAG_BC_S_LE: 302 305 yes = entry->dport <= op[1].no; 303 306 break; 304 - case TCPDIAG_BC_D_GE: 307 + case INET_DIAG_BC_D_GE: 305 308 yes = entry->dport >= op[1].no; 306 309 break; 307 - case TCPDIAG_BC_D_LE: 310 + case INET_DIAG_BC_D_LE: 308 311 yes = entry->dport <= op[1].no; 309 312 break; 310 - case TCPDIAG_BC_AUTO: 313 + case INET_DIAG_BC_AUTO: 311 314 yes = !(entry->userlocks & SOCK_BINDPORT_LOCK); 312 315 break; 313 - case TCPDIAG_BC_S_COND: 314 - case TCPDIAG_BC_D_COND: 316 + case INET_DIAG_BC_S_COND: 317 + case INET_DIAG_BC_D_COND: 315 318 { 316 - struct tcpdiag_hostcond *cond = (struct tcpdiag_hostcond*)(op+1); 319 + struct inet_diag_hostcond *cond = (struct inet_diag_hostcond*)(op+1); 317 320 u32 *addr; 318 321 319 322 if (cond->port != -1 && 320 - cond->port != (op->code == TCPDIAG_BC_S_COND ? 323 + cond->port != (op->code == INET_DIAG_BC_S_COND ? 321 324 entry->sport : entry->dport)) { 322 325 yes = 0; 323 326 break; ··· 326 329 if (cond->prefix_len == 0) 327 330 break; 328 331 329 - if (op->code == TCPDIAG_BC_S_COND) 332 + if (op->code == INET_DIAG_BC_S_COND) 330 333 addr = entry->saddr; 331 334 else 332 335 addr = entry->daddr; ··· 359 362 static int valid_cc(const void *bc, int len, int cc) 360 363 { 361 364 while (len >= 0) { 362 - const struct tcpdiag_bc_op *op = bc; 365 + const struct inet_diag_bc_op *op = bc; 363 366 364 367 if (cc > len) 365 368 return 0; ··· 373 376 return 0; 374 377 } 375 378 376 - static int tcpdiag_bc_audit(const void *bytecode, int bytecode_len) 379 + static int inet_diag_bc_audit(const void *bytecode, int bytecode_len) 377 380 { 378 381 const unsigned char *bc = bytecode; 379 382 int len = bytecode_len; 380 383 381 384 while (len > 0) { 382 - struct tcpdiag_bc_op *op = (struct tcpdiag_bc_op*)bc; 385 + struct inet_diag_bc_op *op = (struct inet_diag_bc_op*)bc; 383 386 384 387 //printk("BC: %d %d %d {%d} / %d\n", op->code, op->yes, op->no, op[1].no, len); 385 388 switch (op->code) { 386 - case TCPDIAG_BC_AUTO: 387 - case TCPDIAG_BC_S_COND: 388 - case TCPDIAG_BC_D_COND: 389 - case TCPDIAG_BC_S_GE: 390 - case TCPDIAG_BC_S_LE: 391 - case TCPDIAG_BC_D_GE: 392 - case TCPDIAG_BC_D_LE: 389 + case INET_DIAG_BC_AUTO: 390 + case INET_DIAG_BC_S_COND: 391 + case INET_DIAG_BC_D_COND: 392 + case INET_DIAG_BC_S_GE: 393 + case INET_DIAG_BC_S_LE: 394 + case INET_DIAG_BC_D_GE: 395 + case INET_DIAG_BC_D_LE: 393 396 if (op->yes < 4 || op->yes > len+4) 394 397 return -EINVAL; 395 - case TCPDIAG_BC_JMP: 398 + case INET_DIAG_BC_JMP: 396 399 if (op->no < 4 || op->no > len+4) 397 400 return -EINVAL; 398 401 if (op->no < len && 399 402 !valid_cc(bytecode, bytecode_len, len-op->no)) 400 403 return -EINVAL; 401 404 break; 402 - case TCPDIAG_BC_NOP: 405 + case INET_DIAG_BC_NOP: 403 406 if (op->yes < 4 || op->yes > len+4) 404 407 return -EINVAL; 405 408 break; ··· 412 415 return len == 0 ? 0 : -EINVAL; 413 416 } 414 417 415 - static int tcpdiag_dump_sock(struct sk_buff *skb, struct sock *sk, 418 + static int inet_diag_dump_sock(struct sk_buff *skb, struct sock *sk, 416 419 struct netlink_callback *cb) 417 420 { 418 - struct tcpdiagreq *r = NLMSG_DATA(cb->nlh); 421 + struct inet_diag_req *r = NLMSG_DATA(cb->nlh); 419 422 420 423 if (cb->nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(*r))) { 421 - struct tcpdiag_entry entry; 424 + struct inet_diag_entry entry; 422 425 struct rtattr *bc = (struct rtattr *)(r + 1); 423 426 struct inet_sock *inet = inet_sk(sk); 424 427 ··· 439 442 entry.dport = ntohs(inet->dport); 440 443 entry.userlocks = sk->sk_userlocks; 441 444 442 - if (!tcpdiag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), &entry)) 445 + if (!inet_diag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), &entry)) 443 446 return 0; 444 447 } 445 448 446 - return tcpdiag_fill(skb, sk, r->tcpdiag_ext, NETLINK_CB(cb->skb).pid, 449 + return inet_diag_fill(skb, sk, r->idiag_ext, NETLINK_CB(cb->skb).pid, 447 450 cb->nlh->nlmsg_seq, NLM_F_MULTI, cb->nlh); 448 451 } 449 452 450 - static int tcpdiag_fill_req(struct sk_buff *skb, struct sock *sk, 453 + static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk, 451 454 struct request_sock *req, 452 455 u32 pid, u32 seq, 453 456 const struct nlmsghdr *unlh) ··· 455 458 const struct inet_request_sock *ireq = inet_rsk(req); 456 459 struct inet_sock *inet = inet_sk(sk); 457 460 unsigned char *b = skb->tail; 458 - struct tcpdiagmsg *r; 461 + struct inet_diag_msg *r; 459 462 struct nlmsghdr *nlh; 460 463 long tmo; 461 464 ··· 463 466 nlh->nlmsg_flags = NLM_F_MULTI; 464 467 r = NLMSG_DATA(nlh); 465 468 466 - r->tcpdiag_family = sk->sk_family; 467 - r->tcpdiag_state = TCP_SYN_RECV; 468 - r->tcpdiag_timer = 1; 469 - r->tcpdiag_retrans = req->retrans; 469 + r->idiag_family = sk->sk_family; 470 + r->idiag_state = TCP_SYN_RECV; 471 + r->idiag_timer = 1; 472 + r->idiag_retrans = req->retrans; 470 473 471 - r->id.tcpdiag_if = sk->sk_bound_dev_if; 472 - r->id.tcpdiag_cookie[0] = (u32)(unsigned long)req; 473 - r->id.tcpdiag_cookie[1] = (u32)(((unsigned long)req >> 31) >> 1); 474 + r->id.idiag_if = sk->sk_bound_dev_if; 475 + r->id.idiag_cookie[0] = (u32)(unsigned long)req; 476 + r->id.idiag_cookie[1] = (u32)(((unsigned long)req >> 31) >> 1); 474 477 475 478 tmo = req->expires - jiffies; 476 479 if (tmo < 0) 477 480 tmo = 0; 478 481 479 - r->id.tcpdiag_sport = inet->sport; 480 - r->id.tcpdiag_dport = ireq->rmt_port; 481 - r->id.tcpdiag_src[0] = ireq->loc_addr; 482 - r->id.tcpdiag_dst[0] = ireq->rmt_addr; 483 - r->tcpdiag_expires = jiffies_to_msecs(tmo), 484 - r->tcpdiag_rqueue = 0; 485 - r->tcpdiag_wqueue = 0; 486 - r->tcpdiag_uid = sock_i_uid(sk); 487 - r->tcpdiag_inode = 0; 482 + r->id.idiag_sport = inet->sport; 483 + r->id.idiag_dport = ireq->rmt_port; 484 + r->id.idiag_src[0] = ireq->loc_addr; 485 + r->id.idiag_dst[0] = ireq->rmt_addr; 486 + r->idiag_expires = jiffies_to_msecs(tmo); 487 + r->idiag_rqueue = 0; 488 + r->idiag_wqueue = 0; 489 + r->idiag_uid = sock_i_uid(sk); 490 + r->idiag_inode = 0; 488 491 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 489 - if (r->tcpdiag_family == AF_INET6) { 490 - ipv6_addr_copy((struct in6_addr *)r->id.tcpdiag_src, 492 + if (r->idiag_family == AF_INET6) { 493 + ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, 491 494 &tcp6_rsk(req)->loc_addr); 492 - ipv6_addr_copy((struct in6_addr *)r->id.tcpdiag_dst, 495 + ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, 493 496 &tcp6_rsk(req)->rmt_addr); 494 497 } 495 498 #endif ··· 502 505 return -1; 503 506 } 504 507 505 - static int tcpdiag_dump_reqs(struct sk_buff *skb, struct sock *sk, 508 + static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, 506 509 struct netlink_callback *cb) 507 510 { 508 - struct tcpdiag_entry entry; 509 - struct tcpdiagreq *r = NLMSG_DATA(cb->nlh); 511 + struct inet_diag_entry entry; 512 + struct inet_diag_req *r = NLMSG_DATA(cb->nlh); 510 513 struct inet_connection_sock *icsk = inet_csk(sk); 511 514 struct listen_sock *lopt; 512 515 struct rtattr *bc = NULL; ··· 544 547 545 548 if (reqnum < s_reqnum) 546 549 continue; 547 - if (r->id.tcpdiag_dport != ireq->rmt_port && 548 - r->id.tcpdiag_dport) 550 + if (r->id.idiag_dport != ireq->rmt_port && 551 + r->id.idiag_dport) 549 552 continue; 550 553 551 554 if (bc) { ··· 563 566 &ireq->rmt_addr; 564 567 entry.dport = ntohs(ireq->rmt_port); 565 568 566 - if (!tcpdiag_bc_run(RTA_DATA(bc), 569 + if (!inet_diag_bc_run(RTA_DATA(bc), 567 570 RTA_PAYLOAD(bc), &entry)) 568 571 continue; 569 572 } 570 573 571 - err = tcpdiag_fill_req(skb, sk, req, 574 + err = inet_diag_fill_req(skb, sk, req, 572 575 NETLINK_CB(cb->skb).pid, 573 576 cb->nlh->nlmsg_seq, cb->nlh); 574 577 if (err < 0) { ··· 587 590 return err; 588 591 } 589 592 590 - static int tcpdiag_dump(struct sk_buff *skb, struct netlink_callback *cb) 593 + static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb) 591 594 { 592 595 int i, num; 593 596 int s_i, s_num; 594 - struct tcpdiagreq *r = NLMSG_DATA(cb->nlh); 597 + struct inet_diag_req *r = NLMSG_DATA(cb->nlh); 595 598 const struct inet_diag_handler *handler; 596 599 struct inet_hashinfo *hashinfo; 597 600 ··· 603 606 s_num = num = cb->args[2]; 604 607 605 608 if (cb->args[0] == 0) { 606 - if (!(r->tcpdiag_states&(TCPF_LISTEN|TCPF_SYN_RECV))) 609 + if (!(r->idiag_states & (TCPF_LISTEN | TCPF_SYN_RECV))) 607 610 goto skip_listen_ht; 608 611 609 612 inet_listen_lock(hashinfo); ··· 620 623 continue; 621 624 } 622 625 623 - if (r->id.tcpdiag_sport != inet->sport && 624 - r->id.tcpdiag_sport) 626 + if (r->id.idiag_sport != inet->sport && 627 + r->id.idiag_sport) 625 628 goto next_listen; 626 629 627 - if (!(r->tcpdiag_states&TCPF_LISTEN) || 628 - r->id.tcpdiag_dport || 630 + if (!(r->idiag_states & TCPF_LISTEN) || 631 + r->id.idiag_dport || 629 632 cb->args[3] > 0) 630 633 goto syn_recv; 631 634 632 - if (tcpdiag_dump_sock(skb, sk, cb) < 0) { 635 + if (inet_diag_dump_sock(skb, sk, cb) < 0) { 633 636 inet_listen_unlock(hashinfo); 634 637 goto done; 635 638 } 636 639 637 640 syn_recv: 638 - if (!(r->tcpdiag_states&TCPF_SYN_RECV)) 641 + if (!(r->idiag_states & TCPF_SYN_RECV)) 639 642 goto next_listen; 640 643 641 - if (tcpdiag_dump_reqs(skb, sk, cb) < 0) { 644 + if (inet_diag_dump_reqs(skb, sk, cb) < 0) { 642 645 inet_listen_unlock(hashinfo); 643 646 goto done; 644 647 } ··· 659 662 s_i = num = s_num = 0; 660 663 } 661 664 662 - if (!(r->tcpdiag_states&~(TCPF_LISTEN|TCPF_SYN_RECV))) 665 + if (!(r->idiag_states & ~(TCPF_LISTEN | TCPF_SYN_RECV))) 663 666 return skb->len; 664 667 665 668 for (i = s_i; i < hashinfo->ehash_size; i++) { ··· 678 681 679 682 if (num < s_num) 680 683 goto next_normal; 681 - if (!(r->tcpdiag_states & (1 << sk->sk_state))) 684 + if (!(r->idiag_states & (1 << sk->sk_state))) 682 685 goto next_normal; 683 - if (r->id.tcpdiag_sport != inet->sport && 684 - r->id.tcpdiag_sport) 686 + if (r->id.idiag_sport != inet->sport && 687 + r->id.idiag_sport) 685 688 goto next_normal; 686 - if (r->id.tcpdiag_dport != inet->dport && r->id.tcpdiag_dport) 689 + if (r->id.idiag_dport != inet->dport && r->id.idiag_dport) 687 690 goto next_normal; 688 - if (tcpdiag_dump_sock(skb, sk, cb) < 0) { 691 + if (inet_diag_dump_sock(skb, sk, cb) < 0) { 689 692 read_unlock_bh(&head->lock); 690 693 goto done; 691 694 } ··· 693 696 ++num; 694 697 } 695 698 696 - if (r->tcpdiag_states&TCPF_TIME_WAIT) { 699 + if (r->idiag_states & TCPF_TIME_WAIT) { 697 700 sk_for_each(sk, node, 698 701 &hashinfo->ehash[i + hashinfo->ehash_size].chain) { 699 702 struct inet_sock *inet = inet_sk(sk); 700 703 701 704 if (num < s_num) 702 705 goto next_dying; 703 - if (r->id.tcpdiag_sport != inet->sport && 704 - r->id.tcpdiag_sport) 706 + if (r->id.idiag_sport != inet->sport && 707 + r->id.idiag_sport) 705 708 goto next_dying; 706 - if (r->id.tcpdiag_dport != inet->dport && 707 - r->id.tcpdiag_dport) 709 + if (r->id.idiag_dport != inet->dport && 710 + r->id.idiag_dport) 708 711 goto next_dying; 709 - if (tcpdiag_dump_sock(skb, sk, cb) < 0) { 712 + if (inet_diag_dump_sock(skb, sk, cb) < 0) { 710 713 read_unlock_bh(&head->lock); 711 714 goto done; 712 715 } ··· 723 726 return skb->len; 724 727 } 725 728 726 - static int tcpdiag_dump_done(struct netlink_callback *cb) 729 + static int inet_diag_dump_done(struct netlink_callback *cb) 727 730 { 728 731 return 0; 729 732 } 730 733 731 734 732 735 static __inline__ int 733 - tcpdiag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) 736 + inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) 734 737 { 735 738 if (!(nlh->nlmsg_flags&NLM_F_REQUEST)) 736 739 return 0; ··· 741 744 if (inet_diag_table[nlh->nlmsg_type] == NULL) 742 745 return -ENOENT; 743 746 744 - if (NLMSG_LENGTH(sizeof(struct tcpdiagreq)) > skb->len) 747 + if (NLMSG_LENGTH(sizeof(struct inet_diag_req)) > skb->len) 745 748 goto err_inval; 746 749 747 750 if (nlh->nlmsg_flags&NLM_F_DUMP) { 748 - if (nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(struct tcpdiagreq))) { 749 - struct rtattr *rta = (struct rtattr*)(NLMSG_DATA(nlh) + sizeof(struct tcpdiagreq)); 750 - if (rta->rta_type != TCPDIAG_REQ_BYTECODE || 751 + if (nlh->nlmsg_len > 752 + (4 + NLMSG_SPACE(sizeof(struct inet_diag_req)))) { 753 + struct rtattr *rta = (void *)(NLMSG_DATA(nlh) + 754 + sizeof(struct inet_diag_req)); 755 + if (rta->rta_type != INET_DIAG_REQ_BYTECODE || 751 756 rta->rta_len < 8 || 752 - rta->rta_len > nlh->nlmsg_len - NLMSG_SPACE(sizeof(struct tcpdiagreq))) 757 + rta->rta_len > 758 + (nlh->nlmsg_len - 759 + NLMSG_SPACE(sizeof(struct inet_diag_req)))) 753 760 goto err_inval; 754 - if (tcpdiag_bc_audit(RTA_DATA(rta), RTA_PAYLOAD(rta))) 761 + if (inet_diag_bc_audit(RTA_DATA(rta), RTA_PAYLOAD(rta))) 755 762 goto err_inval; 756 763 } 757 - return netlink_dump_start(tcpnl, skb, nlh, 758 - tcpdiag_dump, 759 - tcpdiag_dump_done); 764 + return netlink_dump_start(idiagnl, skb, nlh, 765 + inet_diag_dump, 766 + inet_diag_dump_done); 760 767 } else { 761 - return tcpdiag_get_exact(skb, nlh); 768 + return inet_diag_get_exact(skb, nlh); 762 769 } 763 770 764 771 err_inval: ··· 770 769 } 771 770 772 771 773 - static inline void tcpdiag_rcv_skb(struct sk_buff *skb) 772 + static inline void inet_diag_rcv_skb(struct sk_buff *skb) 774 773 { 775 774 int err; 776 775 struct nlmsghdr * nlh; ··· 779 778 nlh = (struct nlmsghdr *)skb->data; 780 779 if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) 781 780 return; 782 - err = tcpdiag_rcv_msg(skb, nlh); 781 + err = inet_diag_rcv_msg(skb, nlh); 783 782 if (err || nlh->nlmsg_flags & NLM_F_ACK) 784 783 netlink_ack(skb, nlh, err); 785 784 } 786 785 } 787 786 788 - static void tcpdiag_rcv(struct sock *sk, int len) 787 + static void inet_diag_rcv(struct sock *sk, int len) 789 788 { 790 789 struct sk_buff *skb; 791 790 unsigned int qlen = skb_queue_len(&sk->sk_receive_queue); 792 791 793 792 while (qlen-- && (skb = skb_dequeue(&sk->sk_receive_queue))) { 794 - tcpdiag_rcv_skb(skb); 793 + inet_diag_rcv_skb(skb); 795 794 kfree_skb(skb); 796 795 } 797 796 } 798 797 799 - static void tcp_diag_get_info(struct sock *sk, struct tcpdiagmsg *r, 798 + static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, 800 799 void *_info) 801 800 { 802 801 const struct tcp_sock *tp = tcp_sk(sk); 803 802 struct tcp_info *info = _info; 804 803 805 - r->tcpdiag_rqueue = tp->rcv_nxt - tp->copied_seq; 806 - r->tcpdiag_wqueue = tp->write_seq - tp->snd_una; 804 + r->idiag_rqueue = tp->rcv_nxt - tp->copied_seq; 805 + r->idiag_wqueue = tp->write_seq - tp->snd_una; 807 806 if (info != NULL) 808 807 tcp_get_info(sk, info); 809 808 } ··· 852 851 } 853 852 EXPORT_SYMBOL_GPL(inet_diag_unregister); 854 853 855 - static int __init tcpdiag_init(void) 854 + static int __init inet_diag_init(void) 856 855 { 857 856 const int inet_diag_table_size = (INET_DIAG_GETSOCK_MAX * 858 857 sizeof(struct inet_diag_handler *)); ··· 864 863 865 864 memset(inet_diag_table, 0, inet_diag_table_size); 866 865 867 - tcpnl = netlink_kernel_create(NETLINK_TCPDIAG, tcpdiag_rcv, 868 - THIS_MODULE); 869 - if (tcpnl == NULL) 866 + idiagnl = netlink_kernel_create(NETLINK_INET_DIAG, inet_diag_rcv, 867 + THIS_MODULE); 868 + if (idiagnl == NULL) 870 869 goto out_free_table; 871 870 872 871 err = inet_diag_register(&tcp_diag_handler); ··· 875 874 out: 876 875 return err; 877 876 out_sock_release: 878 - sock_release(tcpnl->sk_socket); 877 + sock_release(idiagnl->sk_socket); 879 878 out_free_table: 880 879 kfree(inet_diag_table); 881 880 goto out; 882 881 } 883 882 884 - static void __exit tcpdiag_exit(void) 883 + static void __exit inet_diag_exit(void) 885 884 { 886 - sock_release(tcpnl->sk_socket); 885 + sock_release(idiagnl->sk_socket); 887 886 kfree(inet_diag_table); 888 887 } 889 888 890 - module_init(tcpdiag_init); 891 - module_exit(tcpdiag_exit); 889 + module_init(inet_diag_init); 890 + module_exit(inet_diag_exit); 892 891 MODULE_LICENSE("GPL");
+2 -2
net/ipv4/tcp_vegas.c
··· 365 365 struct sk_buff *skb) 366 366 { 367 367 const struct vegas *ca = inet_csk_ca(sk); 368 - if (ext & (1<<(TCPDIAG_VEGASINFO-1))) { 368 + if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) { 369 369 struct tcpvegas_info *info; 370 370 371 - info = RTA_DATA(__RTA_PUT(skb, TCPDIAG_VEGASINFO, 371 + info = RTA_DATA(__RTA_PUT(skb, INET_DIAG_VEGASINFO, 372 372 sizeof(*info))); 373 373 374 374 info->tcpv_enabled = ca->doing_vegas_now;
+2 -2
net/ipv4/tcp_westwood.c
··· 216 216 struct sk_buff *skb) 217 217 { 218 218 const struct westwood *ca = inet_csk_ca(sk); 219 - if (ext & (1<<(TCPDIAG_VEGASINFO-1))) { 219 + if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) { 220 220 struct rtattr *rta; 221 221 struct tcpvegas_info *info; 222 222 223 - rta = __RTA_PUT(skb, TCPDIAG_VEGASINFO, sizeof(*info)); 223 + rta = __RTA_PUT(skb, INET_DIAG_VEGASINFO, sizeof(*info)); 224 224 info = RTA_DATA(rta); 225 225 info->tcpv_enabled = 1; 226 226 info->tcpv_rttcnt = 0;