diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-10-15 02:30:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-18 21:52:53 -0400 |
commit | c720c7e8383aff1cb219bddf474ed89d850336e3 (patch) | |
tree | 4f12337e6690fccced376db9f501eaf98614a65e | |
parent | 988ade6b8e27e79311812f83a87b5cea11fabcd7 (diff) |
inet: rename some inet_sock fields
In order to have better cache layouts of struct sock (separate zones
for rx/tx paths), we need this preliminary patch.
Goal is to transfert fields used at lookup time in the first
read-mostly cache line (inside struct sock_common) and move sk_refcnt
to a separate cache line (only written by rx path)
This patch adds inet_ prefix to daddr, rcv_saddr, dport, num, saddr,
sport and id fields. This allows a future patch to define these
fields as macros, like sk_refcnt, without name clashes.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
47 files changed, 408 insertions, 388 deletions
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c index 5910df60c93e..849cc9c62c2a 100644 --- a/drivers/net/pppol2tp.c +++ b/drivers/net/pppol2tp.c | |||
@@ -516,7 +516,7 @@ static inline int pppol2tp_verify_udp_checksum(struct sock *sk, | |||
516 | return 0; | 516 | return 0; |
517 | 517 | ||
518 | inet = inet_sk(sk); | 518 | inet = inet_sk(sk); |
519 | psum = csum_tcpudp_nofold(inet->saddr, inet->daddr, ulen, | 519 | psum = csum_tcpudp_nofold(inet->inet_saddr, inet->inet_daddr, ulen, |
520 | IPPROTO_UDP, 0); | 520 | IPPROTO_UDP, 0); |
521 | 521 | ||
522 | if ((skb->ip_summed == CHECKSUM_COMPLETE) && | 522 | if ((skb->ip_summed == CHECKSUM_COMPLETE) && |
@@ -949,8 +949,8 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh | |||
949 | inet = inet_sk(sk_tun); | 949 | inet = inet_sk(sk_tun); |
950 | udp_len = hdr_len + sizeof(ppph) + total_len; | 950 | udp_len = hdr_len + sizeof(ppph) + total_len; |
951 | uh = (struct udphdr *) skb->data; | 951 | uh = (struct udphdr *) skb->data; |
952 | uh->source = inet->sport; | 952 | uh->source = inet->inet_sport; |
953 | uh->dest = inet->dport; | 953 | uh->dest = inet->inet_dport; |
954 | uh->len = htons(udp_len); | 954 | uh->len = htons(udp_len); |
955 | uh->check = 0; | 955 | uh->check = 0; |
956 | skb_put(skb, sizeof(struct udphdr)); | 956 | skb_put(skb, sizeof(struct udphdr)); |
@@ -978,7 +978,8 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh | |||
978 | else if (!(skb_dst(skb)->dev->features & NETIF_F_V4_CSUM)) { | 978 | else if (!(skb_dst(skb)->dev->features & NETIF_F_V4_CSUM)) { |
979 | skb->ip_summed = CHECKSUM_COMPLETE; | 979 | skb->ip_summed = CHECKSUM_COMPLETE; |
980 | csum = skb_checksum(skb, 0, udp_len, 0); | 980 | csum = skb_checksum(skb, 0, udp_len, 0); |
981 | uh->check = csum_tcpudp_magic(inet->saddr, inet->daddr, | 981 | uh->check = csum_tcpudp_magic(inet->inet_saddr, |
982 | inet->inet_daddr, | ||
982 | udp_len, IPPROTO_UDP, csum); | 983 | udp_len, IPPROTO_UDP, csum); |
983 | if (uh->check == 0) | 984 | if (uh->check == 0) |
984 | uh->check = CSUM_MANGLED_0; | 985 | uh->check = CSUM_MANGLED_0; |
@@ -986,7 +987,8 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh | |||
986 | skb->ip_summed = CHECKSUM_PARTIAL; | 987 | skb->ip_summed = CHECKSUM_PARTIAL; |
987 | skb->csum_start = skb_transport_header(skb) - skb->head; | 988 | skb->csum_start = skb_transport_header(skb) - skb->head; |
988 | skb->csum_offset = offsetof(struct udphdr, check); | 989 | skb->csum_offset = offsetof(struct udphdr, check); |
989 | uh->check = ~csum_tcpudp_magic(inet->saddr, inet->daddr, | 990 | uh->check = ~csum_tcpudp_magic(inet->inet_saddr, |
991 | inet->inet_daddr, | ||
990 | udp_len, IPPROTO_UDP, 0); | 992 | udp_len, IPPROTO_UDP, 0); |
991 | } | 993 | } |
992 | 994 | ||
@@ -1136,8 +1138,8 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) | |||
1136 | __skb_push(skb, sizeof(*uh)); | 1138 | __skb_push(skb, sizeof(*uh)); |
1137 | skb_reset_transport_header(skb); | 1139 | skb_reset_transport_header(skb); |
1138 | uh = udp_hdr(skb); | 1140 | uh = udp_hdr(skb); |
1139 | uh->source = inet->sport; | 1141 | uh->source = inet->inet_sport; |
1140 | uh->dest = inet->dport; | 1142 | uh->dest = inet->inet_dport; |
1141 | uh->len = htons(udp_len); | 1143 | uh->len = htons(udp_len); |
1142 | uh->check = 0; | 1144 | uh->check = 0; |
1143 | 1145 | ||
@@ -1181,7 +1183,8 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) | |||
1181 | else if (!(skb_dst(skb)->dev->features & NETIF_F_V4_CSUM)) { | 1183 | else if (!(skb_dst(skb)->dev->features & NETIF_F_V4_CSUM)) { |
1182 | skb->ip_summed = CHECKSUM_COMPLETE; | 1184 | skb->ip_summed = CHECKSUM_COMPLETE; |
1183 | csum = skb_checksum(skb, 0, udp_len, 0); | 1185 | csum = skb_checksum(skb, 0, udp_len, 0); |
1184 | uh->check = csum_tcpudp_magic(inet->saddr, inet->daddr, | 1186 | uh->check = csum_tcpudp_magic(inet->inet_saddr, |
1187 | inet->inet_daddr, | ||
1185 | udp_len, IPPROTO_UDP, csum); | 1188 | udp_len, IPPROTO_UDP, csum); |
1186 | if (uh->check == 0) | 1189 | if (uh->check == 0) |
1187 | uh->check = CSUM_MANGLED_0; | 1190 | uh->check = CSUM_MANGLED_0; |
@@ -1189,7 +1192,8 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) | |||
1189 | skb->ip_summed = CHECKSUM_PARTIAL; | 1192 | skb->ip_summed = CHECKSUM_PARTIAL; |
1190 | skb->csum_start = skb_transport_header(skb) - skb->head; | 1193 | skb->csum_start = skb_transport_header(skb) - skb->head; |
1191 | skb->csum_offset = offsetof(struct udphdr, check); | 1194 | skb->csum_offset = offsetof(struct udphdr, check); |
1192 | uh->check = ~csum_tcpudp_magic(inet->saddr, inet->daddr, | 1195 | uh->check = ~csum_tcpudp_magic(inet->inet_saddr, |
1196 | inet->inet_daddr, | ||
1193 | udp_len, IPPROTO_UDP, 0); | 1197 | udp_len, IPPROTO_UDP, 0); |
1194 | } | 1198 | } |
1195 | 1199 | ||
diff --git a/fs/ocfs2/cluster/netdebug.c b/fs/ocfs2/cluster/netdebug.c index da794bc07a6c..a3f150e52b02 100644 --- a/fs/ocfs2/cluster/netdebug.c +++ b/fs/ocfs2/cluster/netdebug.c | |||
@@ -294,10 +294,10 @@ static int sc_seq_show(struct seq_file *seq, void *v) | |||
294 | if (sc->sc_sock) { | 294 | if (sc->sc_sock) { |
295 | inet = inet_sk(sc->sc_sock->sk); | 295 | inet = inet_sk(sc->sc_sock->sk); |
296 | /* the stack's structs aren't sparse endian clean */ | 296 | /* the stack's structs aren't sparse endian clean */ |
297 | saddr = (__force __be32)inet->saddr; | 297 | saddr = (__force __be32)inet->inet_saddr; |
298 | daddr = (__force __be32)inet->daddr; | 298 | daddr = (__force __be32)inet->inet_daddr; |
299 | sport = (__force __be16)inet->sport; | 299 | sport = (__force __be16)inet->inet_sport; |
300 | dport = (__force __be16)inet->dport; | 300 | dport = (__force __be16)inet->inet_dport; |
301 | } | 301 | } |
302 | 302 | ||
303 | /* XXX sigh, inet-> doesn't have sparse annotation so any | 303 | /* XXX sigh, inet-> doesn't have sparse annotation so any |
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 56404251248c..e0cc9a7db2b5 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
@@ -505,7 +505,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk) | |||
505 | 505 | ||
506 | #define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\ | 506 | #define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\ |
507 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ | 507 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ |
508 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 508 | ((*((__portpair *)&(inet_sk(__sk)->inet_dport))) == (__ports)) && \ |
509 | ((__sk)->sk_family == AF_INET6) && \ | 509 | ((__sk)->sk_family == AF_INET6) && \ |
510 | ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ | 510 | ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ |
511 | ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ | 511 | ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ |
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index 22c73a77cd99..92838d3a1ab7 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h | |||
@@ -46,8 +46,8 @@ static inline int inet6_sk_ehashfn(const struct sock *sk) | |||
46 | const struct ipv6_pinfo *np = inet6_sk(sk); | 46 | const struct ipv6_pinfo *np = inet6_sk(sk); |
47 | const struct in6_addr *laddr = &np->rcv_saddr; | 47 | const struct in6_addr *laddr = &np->rcv_saddr; |
48 | const struct in6_addr *faddr = &np->daddr; | 48 | const struct in6_addr *faddr = &np->daddr; |
49 | const __u16 lport = inet->num; | 49 | const __u16 lport = inet->inet_num; |
50 | const __be16 fport = inet->dport; | 50 | const __be16 fport = inet->inet_dport; |
51 | struct net *net = sock_net(sk); | 51 | struct net *net = sock_net(sk); |
52 | 52 | ||
53 | return inet6_ehashfn(net, laddr, lport, faddr, fport); | 53 | return inet6_ehashfn(net, laddr, lport, faddr, fport); |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 5f11c4a0daca..5b698b3b463d 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
@@ -241,7 +241,7 @@ static inline int inet_lhashfn(struct net *net, const unsigned short num) | |||
241 | 241 | ||
242 | static inline int inet_sk_listen_hashfn(const struct sock *sk) | 242 | static inline int inet_sk_listen_hashfn(const struct sock *sk) |
243 | { | 243 | { |
244 | return inet_lhashfn(sock_net(sk), inet_sk(sk)->num); | 244 | return inet_lhashfn(sock_net(sk), inet_sk(sk)->inet_num); |
245 | } | 245 | } |
246 | 246 | ||
247 | /* Caller must disable local BH processing. */ | 247 | /* Caller must disable local BH processing. */ |
@@ -301,8 +301,8 @@ typedef __u64 __bitwise __addrpair; | |||
301 | #endif /* __BIG_ENDIAN */ | 301 | #endif /* __BIG_ENDIAN */ |
302 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ | 302 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ |
303 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ | 303 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ |
304 | ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ | 304 | ((*((__addrpair *)&(inet_sk(__sk)->inet_daddr))) == (__cookie)) && \ |
305 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 305 | ((*((__portpair *)&(inet_sk(__sk)->inet_dport))) == (__ports)) && \ |
306 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 306 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
307 | #define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ | 307 | #define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ |
308 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ | 308 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ |
@@ -313,9 +313,9 @@ typedef __u64 __bitwise __addrpair; | |||
313 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) | 313 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) |
314 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ | 314 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ |
315 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ | 315 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ |
316 | (inet_sk(__sk)->daddr == (__saddr)) && \ | 316 | (inet_sk(__sk)->inet_daddr == (__saddr)) && \ |
317 | (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ | 317 | (inet_sk(__sk)->inet_rcv_saddr == (__daddr)) && \ |
318 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 318 | ((*((__portpair *)&(inet_sk(__sk)->inet_dport))) == (__ports)) && \ |
319 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 319 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
320 | #define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ | 320 | #define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ |
321 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ | 321 | (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 47004f35cc7e..bd4c53f75ac0 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -93,14 +93,14 @@ struct rtable; | |||
93 | * | 93 | * |
94 | * @sk - ancestor class | 94 | * @sk - ancestor class |
95 | * @pinet6 - pointer to IPv6 control block | 95 | * @pinet6 - pointer to IPv6 control block |
96 | * @daddr - Foreign IPv4 addr | 96 | * @inet_daddr - Foreign IPv4 addr |
97 | * @rcv_saddr - Bound local IPv4 addr | 97 | * @inet_rcv_saddr - Bound local IPv4 addr |
98 | * @dport - Destination port | 98 | * @inet_dport - Destination port |
99 | * @num - Local port | 99 | * @inet_num - Local port |
100 | * @saddr - Sending source | 100 | * @inet_saddr - Sending source |
101 | * @uc_ttl - Unicast TTL | 101 | * @uc_ttl - Unicast TTL |
102 | * @sport - Source port | 102 | * @inet_sport - Source port |
103 | * @id - ID counter for DF pkts | 103 | * @inet_id - ID counter for DF pkts |
104 | * @tos - TOS | 104 | * @tos - TOS |
105 | * @mc_ttl - Multicasting TTL | 105 | * @mc_ttl - Multicasting TTL |
106 | * @is_icsk - is this an inet_connection_sock? | 106 | * @is_icsk - is this an inet_connection_sock? |
@@ -115,16 +115,16 @@ struct inet_sock { | |||
115 | struct ipv6_pinfo *pinet6; | 115 | struct ipv6_pinfo *pinet6; |
116 | #endif | 116 | #endif |
117 | /* Socket demultiplex comparisons on incoming packets. */ | 117 | /* Socket demultiplex comparisons on incoming packets. */ |
118 | __be32 daddr; | 118 | __be32 inet_daddr; |
119 | __be32 rcv_saddr; | 119 | __be32 inet_rcv_saddr; |
120 | __be16 dport; | 120 | __be16 inet_dport; |
121 | __u16 num; | 121 | __u16 inet_num; |
122 | __be32 saddr; | 122 | __be32 inet_saddr; |
123 | __s16 uc_ttl; | 123 | __s16 uc_ttl; |
124 | __u16 cmsg_flags; | 124 | __u16 cmsg_flags; |
125 | struct ip_options *opt; | 125 | struct ip_options *opt; |
126 | __be16 sport; | 126 | __be16 inet_sport; |
127 | __u16 id; | 127 | __u16 inet_id; |
128 | __u8 tos; | 128 | __u8 tos; |
129 | __u8 mc_ttl; | 129 | __u8 mc_ttl; |
130 | __u8 pmtudisc; | 130 | __u8 pmtudisc; |
@@ -190,10 +190,10 @@ static inline unsigned int inet_ehashfn(struct net *net, | |||
190 | static inline int inet_sk_ehashfn(const struct sock *sk) | 190 | static inline int inet_sk_ehashfn(const struct sock *sk) |
191 | { | 191 | { |
192 | const struct inet_sock *inet = inet_sk(sk); | 192 | const struct inet_sock *inet = inet_sk(sk); |
193 | const __be32 laddr = inet->rcv_saddr; | 193 | const __be32 laddr = inet->inet_rcv_saddr; |
194 | const __u16 lport = inet->num; | 194 | const __u16 lport = inet->inet_num; |
195 | const __be32 faddr = inet->daddr; | 195 | const __be32 faddr = inet->inet_daddr; |
196 | const __be16 fport = inet->dport; | 196 | const __be16 fport = inet->inet_dport; |
197 | struct net *net = sock_net(sk); | 197 | struct net *net = sock_net(sk); |
198 | 198 | ||
199 | return inet_ehashfn(net, laddr, lport, faddr, fport); | 199 | return inet_ehashfn(net, laddr, lport, faddr, fport); |
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index b63b80fac567..37f3aea074a5 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
@@ -194,7 +194,7 @@ static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk) | |||
194 | static inline __be32 inet_rcv_saddr(const struct sock *sk) | 194 | static inline __be32 inet_rcv_saddr(const struct sock *sk) |
195 | { | 195 | { |
196 | return likely(sk->sk_state != TCP_TIME_WAIT) ? | 196 | return likely(sk->sk_state != TCP_TIME_WAIT) ? |
197 | inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr; | 197 | inet_sk(sk)->inet_rcv_saddr : inet_twsk(sk)->tw_rcv_saddr; |
198 | } | 198 | } |
199 | 199 | ||
200 | extern void inet_twsk_put(struct inet_timewait_sock *tw); | 200 | extern void inet_twsk_put(struct inet_timewait_sock *tw); |
diff --git a/include/net/ip.h b/include/net/ip.h index 2f47e5482b55..376adf47764e 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -240,8 +240,8 @@ static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, str | |||
240 | * does not change, they drop every other packet in | 240 | * does not change, they drop every other packet in |
241 | * a TCP stream using header compression. | 241 | * a TCP stream using header compression. |
242 | */ | 242 | */ |
243 | iph->id = (sk && inet_sk(sk)->daddr) ? | 243 | iph->id = (sk && inet_sk(sk)->inet_daddr) ? |
244 | htons(inet_sk(sk)->id++) : 0; | 244 | htons(inet_sk(sk)->inet_id++) : 0; |
245 | } else | 245 | } else |
246 | __ip_select_ident(iph, dst, 0); | 246 | __ip_select_ident(iph, dst, 0); |
247 | } | 247 | } |
@@ -249,9 +249,9 @@ static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, str | |||
249 | static inline void ip_select_ident_more(struct iphdr *iph, struct dst_entry *dst, struct sock *sk, int more) | 249 | static inline void ip_select_ident_more(struct iphdr *iph, struct dst_entry *dst, struct sock *sk, int more) |
250 | { | 250 | { |
251 | if (iph->frag_off & htons(IP_DF)) { | 251 | if (iph->frag_off & htons(IP_DF)) { |
252 | if (sk && inet_sk(sk)->daddr) { | 252 | if (sk && inet_sk(sk)->inet_daddr) { |
253 | iph->id = htons(inet_sk(sk)->id); | 253 | iph->id = htons(inet_sk(sk)->inet_id); |
254 | inet_sk(sk)->id += 1 + more; | 254 | inet_sk(sk)->inet_id += 1 + more; |
255 | } else | 255 | } else |
256 | iph->id = 0; | 256 | iph->id = 0; |
257 | } else | 257 | } else |
@@ -317,7 +317,7 @@ static inline void ip_ib_mc_map(__be32 naddr, const unsigned char *broadcast, ch | |||
317 | 317 | ||
318 | static __inline__ void inet_reset_saddr(struct sock *sk) | 318 | static __inline__ void inet_reset_saddr(struct sock *sk) |
319 | { | 319 | { |
320 | inet_sk(sk)->rcv_saddr = inet_sk(sk)->saddr = 0; | 320 | inet_sk(sk)->inet_rcv_saddr = inet_sk(sk)->inet_saddr = 0; |
321 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 321 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
322 | if (sk->sk_family == PF_INET6) { | 322 | if (sk->sk_family == PF_INET6) { |
323 | struct ipv6_pinfo *np = inet6_sk(sk); | 323 | struct ipv6_pinfo *np = inet6_sk(sk); |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 7302e1498d46..00028d4b09d9 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -62,10 +62,10 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
62 | nexthop = inet->opt->faddr; | 62 | nexthop = inet->opt->faddr; |
63 | } | 63 | } |
64 | 64 | ||
65 | tmp = ip_route_connect(&rt, nexthop, inet->saddr, | 65 | tmp = ip_route_connect(&rt, nexthop, inet->inet_saddr, |
66 | RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, | 66 | RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, |
67 | IPPROTO_DCCP, | 67 | IPPROTO_DCCP, |
68 | inet->sport, usin->sin_port, sk, 1); | 68 | inet->inet_sport, usin->sin_port, sk, 1); |
69 | if (tmp < 0) | 69 | if (tmp < 0) |
70 | return tmp; | 70 | return tmp; |
71 | 71 | ||
@@ -77,12 +77,12 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
77 | if (inet->opt == NULL || !inet->opt->srr) | 77 | if (inet->opt == NULL || !inet->opt->srr) |
78 | daddr = rt->rt_dst; | 78 | daddr = rt->rt_dst; |
79 | 79 | ||
80 | if (inet->saddr == 0) | 80 | if (inet->inet_saddr == 0) |
81 | inet->saddr = rt->rt_src; | 81 | inet->inet_saddr = rt->rt_src; |
82 | inet->rcv_saddr = inet->saddr; | 82 | inet->inet_rcv_saddr = inet->inet_saddr; |
83 | 83 | ||
84 | inet->dport = usin->sin_port; | 84 | inet->inet_dport = usin->sin_port; |
85 | inet->daddr = daddr; | 85 | inet->inet_daddr = daddr; |
86 | 86 | ||
87 | inet_csk(sk)->icsk_ext_hdr_len = 0; | 87 | inet_csk(sk)->icsk_ext_hdr_len = 0; |
88 | if (inet->opt != NULL) | 88 | if (inet->opt != NULL) |
@@ -98,17 +98,19 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
98 | if (err != 0) | 98 | if (err != 0) |
99 | goto failure; | 99 | goto failure; |
100 | 100 | ||
101 | err = ip_route_newports(&rt, IPPROTO_DCCP, inet->sport, inet->dport, | 101 | err = ip_route_newports(&rt, IPPROTO_DCCP, inet->inet_sport, |
102 | sk); | 102 | inet->inet_dport, sk); |
103 | if (err != 0) | 103 | if (err != 0) |
104 | goto failure; | 104 | goto failure; |
105 | 105 | ||
106 | /* OK, now commit destination to socket. */ | 106 | /* OK, now commit destination to socket. */ |
107 | sk_setup_caps(sk, &rt->u.dst); | 107 | sk_setup_caps(sk, &rt->u.dst); |
108 | 108 | ||
109 | dp->dccps_iss = secure_dccp_sequence_number(inet->saddr, inet->daddr, | 109 | dp->dccps_iss = secure_dccp_sequence_number(inet->inet_saddr, |
110 | inet->sport, inet->dport); | 110 | inet->inet_daddr, |
111 | inet->id = dp->dccps_iss ^ jiffies; | 111 | inet->inet_sport, |
112 | inet->inet_dport); | ||
113 | inet->inet_id = dp->dccps_iss ^ jiffies; | ||
112 | 114 | ||
113 | err = dccp_connect(sk); | 115 | err = dccp_connect(sk); |
114 | rt = NULL; | 116 | rt = NULL; |
@@ -123,7 +125,7 @@ failure: | |||
123 | dccp_set_state(sk, DCCP_CLOSED); | 125 | dccp_set_state(sk, DCCP_CLOSED); |
124 | ip_rt_put(rt); | 126 | ip_rt_put(rt); |
125 | sk->sk_route_caps = 0; | 127 | sk->sk_route_caps = 0; |
126 | inet->dport = 0; | 128 | inet->inet_dport = 0; |
127 | goto out; | 129 | goto out; |
128 | } | 130 | } |
129 | 131 | ||
@@ -352,7 +354,9 @@ void dccp_v4_send_check(struct sock *sk, int unused, struct sk_buff *skb) | |||
352 | struct dccp_hdr *dh = dccp_hdr(skb); | 354 | struct dccp_hdr *dh = dccp_hdr(skb); |
353 | 355 | ||
354 | dccp_csum_outgoing(skb); | 356 | dccp_csum_outgoing(skb); |
355 | dh->dccph_checksum = dccp_v4_csum_finish(skb, inet->saddr, inet->daddr); | 357 | dh->dccph_checksum = dccp_v4_csum_finish(skb, |
358 | inet->inet_saddr, | ||
359 | inet->inet_daddr); | ||
356 | } | 360 | } |
357 | 361 | ||
358 | EXPORT_SYMBOL_GPL(dccp_v4_send_check); | 362 | EXPORT_SYMBOL_GPL(dccp_v4_send_check); |
@@ -393,14 +397,14 @@ struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
393 | 397 | ||
394 | newinet = inet_sk(newsk); | 398 | newinet = inet_sk(newsk); |
395 | ireq = inet_rsk(req); | 399 | ireq = inet_rsk(req); |
396 | newinet->daddr = ireq->rmt_addr; | 400 | newinet->inet_daddr = ireq->rmt_addr; |
397 | newinet->rcv_saddr = ireq->loc_addr; | 401 | newinet->inet_rcv_saddr = ireq->loc_addr; |
398 | newinet->saddr = ireq->loc_addr; | 402 | newinet->inet_saddr = ireq->loc_addr; |
399 | newinet->opt = ireq->opt; | 403 | newinet->opt = ireq->opt; |
400 | ireq->opt = NULL; | 404 | ireq->opt = NULL; |
401 | newinet->mc_index = inet_iif(skb); | 405 | newinet->mc_index = inet_iif(skb); |
402 | newinet->mc_ttl = ip_hdr(skb)->ttl; | 406 | newinet->mc_ttl = ip_hdr(skb)->ttl; |
403 | newinet->id = jiffies; | 407 | newinet->inet_id = jiffies; |
404 | 408 | ||
405 | dccp_sync_mss(newsk, dst_mtu(dst)); | 409 | dccp_sync_mss(newsk, dst_mtu(dst)); |
406 | 410 | ||
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index a2afb553d8b3..6d89f9f7d5d8 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -158,8 +158,8 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
158 | ipv6_addr_copy(&fl.fl6_dst, &np->daddr); | 158 | ipv6_addr_copy(&fl.fl6_dst, &np->daddr); |
159 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); | 159 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); |
160 | fl.oif = sk->sk_bound_dev_if; | 160 | fl.oif = sk->sk_bound_dev_if; |
161 | fl.fl_ip_dport = inet->dport; | 161 | fl.fl_ip_dport = inet->inet_dport; |
162 | fl.fl_ip_sport = inet->sport; | 162 | fl.fl_ip_sport = inet->inet_sport; |
163 | security_sk_classify_flow(sk, &fl); | 163 | security_sk_classify_flow(sk, &fl); |
164 | 164 | ||
165 | err = ip6_dst_lookup(sk, &dst, &fl); | 165 | err = ip6_dst_lookup(sk, &dst, &fl); |
@@ -510,9 +510,9 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, | |||
510 | 510 | ||
511 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); | 511 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); |
512 | 512 | ||
513 | ipv6_addr_set_v4mapped(newinet->daddr, &newnp->daddr); | 513 | ipv6_addr_set_v4mapped(newinet->inet_daddr, &newnp->daddr); |
514 | 514 | ||
515 | ipv6_addr_set_v4mapped(newinet->saddr, &newnp->saddr); | 515 | ipv6_addr_set_v4mapped(newinet->inet_saddr, &newnp->saddr); |
516 | 516 | ||
517 | ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr); | 517 | ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr); |
518 | 518 | ||
@@ -640,7 +640,8 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, | |||
640 | 640 | ||
641 | dccp_sync_mss(newsk, dst_mtu(dst)); | 641 | dccp_sync_mss(newsk, dst_mtu(dst)); |
642 | 642 | ||
643 | newinet->daddr = newinet->saddr = newinet->rcv_saddr = LOOPBACK4_IPV6; | 643 | newinet->inet_daddr = newinet->inet_saddr = LOOPBACK4_IPV6; |
644 | newinet->inet_rcv_saddr = LOOPBACK4_IPV6; | ||
644 | 645 | ||
645 | __inet6_hash(newsk); | 646 | __inet6_hash(newsk); |
646 | __inet_inherit_port(sk, newsk); | 647 | __inet_inherit_port(sk, newsk); |
@@ -968,10 +969,9 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
968 | icsk->icsk_af_ops = &dccp_ipv6_af_ops; | 969 | icsk->icsk_af_ops = &dccp_ipv6_af_ops; |
969 | sk->sk_backlog_rcv = dccp_v6_do_rcv; | 970 | sk->sk_backlog_rcv = dccp_v6_do_rcv; |
970 | goto failure; | 971 | goto failure; |
971 | } else { | ||
972 | ipv6_addr_set_v4mapped(inet->saddr, &np->saddr); | ||
973 | ipv6_addr_set_v4mapped(inet->rcv_saddr, &np->rcv_saddr); | ||
974 | } | 972 | } |
973 | ipv6_addr_set_v4mapped(inet->inet_saddr, &np->saddr); | ||
974 | ipv6_addr_set_v4mapped(inet->inet_rcv_saddr, &np->rcv_saddr); | ||
975 | 975 | ||
976 | return err; | 976 | return err; |
977 | } | 977 | } |
@@ -984,7 +984,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
984 | ipv6_addr_copy(&fl.fl6_src, saddr ? saddr : &np->saddr); | 984 | ipv6_addr_copy(&fl.fl6_src, saddr ? saddr : &np->saddr); |
985 | fl.oif = sk->sk_bound_dev_if; | 985 | fl.oif = sk->sk_bound_dev_if; |
986 | fl.fl_ip_dport = usin->sin6_port; | 986 | fl.fl_ip_dport = usin->sin6_port; |
987 | fl.fl_ip_sport = inet->sport; | 987 | fl.fl_ip_sport = inet->inet_sport; |
988 | security_sk_classify_flow(sk, &fl); | 988 | security_sk_classify_flow(sk, &fl); |
989 | 989 | ||
990 | if (np->opt != NULL && np->opt->srcrt != NULL) { | 990 | if (np->opt != NULL && np->opt->srcrt != NULL) { |
@@ -1017,7 +1017,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
1017 | 1017 | ||
1018 | /* set the source address */ | 1018 | /* set the source address */ |
1019 | ipv6_addr_copy(&np->saddr, saddr); | 1019 | ipv6_addr_copy(&np->saddr, saddr); |
1020 | inet->rcv_saddr = LOOPBACK4_IPV6; | 1020 | inet->inet_rcv_saddr = LOOPBACK4_IPV6; |
1021 | 1021 | ||
1022 | __ip6_dst_store(sk, dst, NULL, NULL); | 1022 | __ip6_dst_store(sk, dst, NULL, NULL); |
1023 | 1023 | ||
@@ -1026,7 +1026,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
1026 | icsk->icsk_ext_hdr_len = (np->opt->opt_flen + | 1026 | icsk->icsk_ext_hdr_len = (np->opt->opt_flen + |
1027 | np->opt->opt_nflen); | 1027 | np->opt->opt_nflen); |
1028 | 1028 | ||
1029 | inet->dport = usin->sin6_port; | 1029 | inet->inet_dport = usin->sin6_port; |
1030 | 1030 | ||
1031 | dccp_set_state(sk, DCCP_REQUESTING); | 1031 | dccp_set_state(sk, DCCP_REQUESTING); |
1032 | err = inet6_hash_connect(&dccp_death_row, sk); | 1032 | err = inet6_hash_connect(&dccp_death_row, sk); |
@@ -1035,7 +1035,8 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
1035 | 1035 | ||
1036 | dp->dccps_iss = secure_dccpv6_sequence_number(np->saddr.s6_addr32, | 1036 | dp->dccps_iss = secure_dccpv6_sequence_number(np->saddr.s6_addr32, |
1037 | np->daddr.s6_addr32, | 1037 | np->daddr.s6_addr32, |
1038 | inet->sport, inet->dport); | 1038 | inet->inet_sport, |
1039 | inet->inet_dport); | ||
1039 | err = dccp_connect(sk); | 1040 | err = dccp_connect(sk); |
1040 | if (err) | 1041 | if (err) |
1041 | goto late_failure; | 1042 | goto late_failure; |
@@ -1046,7 +1047,7 @@ late_failure: | |||
1046 | dccp_set_state(sk, DCCP_CLOSED); | 1047 | dccp_set_state(sk, DCCP_CLOSED); |
1047 | __sk_dst_reset(sk); | 1048 | __sk_dst_reset(sk); |
1048 | failure: | 1049 | failure: |
1049 | inet->dport = 0; | 1050 | inet->inet_dport = 0; |
1050 | sk->sk_route_caps = 0; | 1051 | sk->sk_route_caps = 0; |
1051 | return err; | 1052 | return err; |
1052 | } | 1053 | } |
diff --git a/net/dccp/output.c b/net/dccp/output.c index c96119fda688..d6bb753bf6ad 100644 --- a/net/dccp/output.c +++ b/net/dccp/output.c | |||
@@ -99,8 +99,8 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb) | |||
99 | /* Build DCCP header and checksum it. */ | 99 | /* Build DCCP header and checksum it. */ |
100 | dh = dccp_zeroed_hdr(skb, dccp_header_size); | 100 | dh = dccp_zeroed_hdr(skb, dccp_header_size); |
101 | dh->dccph_type = dcb->dccpd_type; | 101 | dh->dccph_type = dcb->dccpd_type; |
102 | dh->dccph_sport = inet->sport; | 102 | dh->dccph_sport = inet->inet_sport; |
103 | dh->dccph_dport = inet->dport; | 103 | dh->dccph_dport = inet->inet_dport; |
104 | dh->dccph_doff = (dccp_header_size + dcb->dccpd_opt_len) / 4; | 104 | dh->dccph_doff = (dccp_header_size + dcb->dccpd_opt_len) / 4; |
105 | dh->dccph_ccval = dcb->dccpd_ccval; | 105 | dh->dccph_ccval = dcb->dccpd_ccval; |
106 | dh->dccph_cscov = dp->dccps_pcslen; | 106 | dh->dccph_cscov = dp->dccps_pcslen; |
diff --git a/net/dccp/probe.c b/net/dccp/probe.c index 5e6ec8b9b7b6..dc328425fa20 100644 --- a/net/dccp/probe.c +++ b/net/dccp/probe.c | |||
@@ -80,19 +80,20 @@ static int jdccp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
80 | if (ccid_get_current_tx_ccid(dccp_sk(sk)) == DCCPC_CCID3) | 80 | if (ccid_get_current_tx_ccid(dccp_sk(sk)) == DCCPC_CCID3) |
81 | hc = ccid3_hc_tx_sk(sk); | 81 | hc = ccid3_hc_tx_sk(sk); |
82 | 82 | ||
83 | if (port == 0 || ntohs(inet->dport) == port || | 83 | if (port == 0 || ntohs(inet->inet_dport) == port || |
84 | ntohs(inet->sport) == port) { | 84 | ntohs(inet->inet_sport) == port) { |
85 | if (hc) | 85 | if (hc) |
86 | printl("%pI4:%u %pI4:%u %d %d %d %d %u %llu %llu %d\n", | 86 | printl("%pI4:%u %pI4:%u %d %d %d %d %u %llu %llu %d\n", |
87 | &inet->saddr, ntohs(inet->sport), | 87 | &inet->inet_saddr, ntohs(inet->inet_sport), |
88 | &inet->daddr, ntohs(inet->dport), size, | 88 | &inet->inet_daddr, ntohs(inet->inet_dport), size, |
89 | hc->tx_s, hc->tx_rtt, hc->tx_p, | 89 | hc->tx_s, hc->tx_rtt, hc->tx_p, |
90 | hc->tx_x_calc, hc->tx_x_recv >> 6, | 90 | hc->tx_x_calc, hc->tx_x_recv >> 6, |
91 | hc->tx_x >> 6, hc->tx_t_ipi); | 91 | hc->tx_x >> 6, hc->tx_t_ipi); |
92 | else | 92 | else |
93 | printl("%pI4:%u %pI4:%u %d\n", | 93 | printl("%pI4:%u %pI4:%u %d\n", |
94 | &inet->saddr, ntohs(inet->sport), | 94 | &inet->inet_saddr, ntohs(inet->inet_sport), |
95 | &inet->daddr, ntohs(inet->dport), size); | 95 | &inet->inet_daddr, ntohs(inet->inet_dport), |
96 | size); | ||
96 | } | 97 | } |
97 | 98 | ||
98 | jprobe_return(); | 99 | jprobe_return(); |
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index ecb203fff501..671cd1413d59 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -278,7 +278,7 @@ int dccp_disconnect(struct sock *sk, int flags) | |||
278 | sk->sk_send_head = NULL; | 278 | sk->sk_send_head = NULL; |
279 | } | 279 | } |
280 | 280 | ||
281 | inet->dport = 0; | 281 | inet->inet_dport = 0; |
282 | 282 | ||
283 | if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK)) | 283 | if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK)) |
284 | inet_reset_saddr(sk); | 284 | inet_reset_saddr(sk); |
@@ -290,7 +290,7 @@ int dccp_disconnect(struct sock *sk, int flags) | |||
290 | inet_csk_delack_init(sk); | 290 | inet_csk_delack_init(sk); |
291 | __sk_dst_reset(sk); | 291 | __sk_dst_reset(sk); |
292 | 292 | ||
293 | WARN_ON(inet->num && !icsk->icsk_bind_hash); | 293 | WARN_ON(inet->inet_num && !icsk->icsk_bind_hash); |
294 | 294 | ||
295 | sk->sk_error_report(sk); | 295 | sk->sk_error_report(sk); |
296 | return err; | 296 | return err; |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 1deff48b122e..04a14b1600ac 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -174,12 +174,12 @@ static int inet_autobind(struct sock *sk) | |||
174 | /* We may need to bind the socket. */ | 174 | /* We may need to bind the socket. */ |
175 | lock_sock(sk); | 175 | lock_sock(sk); |
176 | inet = inet_sk(sk); | 176 | inet = inet_sk(sk); |
177 | if (!inet->num) { | 177 | if (!inet->inet_num) { |
178 | if (sk->sk_prot->get_port(sk, 0)) { | 178 | if (sk->sk_prot->get_port(sk, 0)) { |
179 | release_sock(sk); | 179 | release_sock(sk); |
180 | return -EAGAIN; | 180 | return -EAGAIN; |
181 | } | 181 | } |
182 | inet->sport = htons(inet->num); | 182 | inet->inet_sport = htons(inet->inet_num); |
183 | } | 183 | } |
184 | release_sock(sk); | 184 | release_sock(sk); |
185 | return 0; | 185 | return 0; |
@@ -354,7 +354,7 @@ lookup_protocol: | |||
354 | inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0; | 354 | inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0; |
355 | 355 | ||
356 | if (SOCK_RAW == sock->type) { | 356 | if (SOCK_RAW == sock->type) { |
357 | inet->num = protocol; | 357 | inet->inet_num = protocol; |
358 | if (IPPROTO_RAW == protocol) | 358 | if (IPPROTO_RAW == protocol) |
359 | inet->hdrincl = 1; | 359 | inet->hdrincl = 1; |
360 | } | 360 | } |
@@ -364,7 +364,7 @@ lookup_protocol: | |||
364 | else | 364 | else |
365 | inet->pmtudisc = IP_PMTUDISC_WANT; | 365 | inet->pmtudisc = IP_PMTUDISC_WANT; |
366 | 366 | ||
367 | inet->id = 0; | 367 | inet->inet_id = 0; |
368 | 368 | ||
369 | sock_init_data(sock, sk); | 369 | sock_init_data(sock, sk); |
370 | 370 | ||
@@ -381,13 +381,13 @@ lookup_protocol: | |||
381 | 381 | ||
382 | sk_refcnt_debug_inc(sk); | 382 | sk_refcnt_debug_inc(sk); |
383 | 383 | ||
384 | if (inet->num) { | 384 | if (inet->inet_num) { |
385 | /* It assumes that any protocol which allows | 385 | /* It assumes that any protocol which allows |
386 | * the user to assign a number at socket | 386 | * the user to assign a number at socket |
387 | * creation time automatically | 387 | * creation time automatically |
388 | * shares. | 388 | * shares. |
389 | */ | 389 | */ |
390 | inet->sport = htons(inet->num); | 390 | inet->inet_sport = htons(inet->inet_num); |
391 | /* Add to protocol hash chains. */ | 391 | /* Add to protocol hash chains. */ |
392 | sk->sk_prot->hash(sk); | 392 | sk->sk_prot->hash(sk); |
393 | } | 393 | } |
@@ -494,27 +494,27 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
494 | 494 | ||
495 | /* Check these errors (active socket, double bind). */ | 495 | /* Check these errors (active socket, double bind). */ |
496 | err = -EINVAL; | 496 | err = -EINVAL; |
497 | if (sk->sk_state != TCP_CLOSE || inet->num) | 497 | if (sk->sk_state != TCP_CLOSE || inet->inet_num) |
498 | goto out_release_sock; | 498 | goto out_release_sock; |
499 | 499 | ||
500 | inet->rcv_saddr = inet->saddr = addr->sin_addr.s_addr; | 500 | inet->inet_rcv_saddr = inet->inet_saddr = addr->sin_addr.s_addr; |
501 | if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST) | 501 | if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST) |
502 | inet->saddr = 0; /* Use device */ | 502 | inet->inet_saddr = 0; /* Use device */ |
503 | 503 | ||
504 | /* Make sure we are allowed to bind here. */ | 504 | /* Make sure we are allowed to bind here. */ |
505 | if (sk->sk_prot->get_port(sk, snum)) { | 505 | if (sk->sk_prot->get_port(sk, snum)) { |
506 | inet->saddr = inet->rcv_saddr = 0; | 506 | inet->inet_saddr = inet->inet_rcv_saddr = 0; |
507 | err = -EADDRINUSE; | 507 | err = -EADDRINUSE; |
508 | goto out_release_sock; | 508 | goto out_release_sock; |
509 | } | 509 | } |
510 | 510 | ||
511 | if (inet->rcv_saddr) | 511 | if (inet->inet_rcv_saddr) |
512 | sk->sk_userlocks |= SOCK_BINDADDR_LOCK; | 512 | sk->sk_userlocks |= SOCK_BINDADDR_LOCK; |
513 | if (snum) | 513 | if (snum) |
514 | sk->sk_userlocks |= SOCK_BINDPORT_LOCK; | 514 | sk->sk_userlocks |= SOCK_BINDPORT_LOCK; |
515 | inet->sport = htons(inet->num); | 515 | inet->inet_sport = htons(inet->inet_num); |
516 | inet->daddr = 0; | 516 | inet->inet_daddr = 0; |
517 | inet->dport = 0; | 517 | inet->inet_dport = 0; |
518 | sk_dst_reset(sk); | 518 | sk_dst_reset(sk); |
519 | err = 0; | 519 | err = 0; |
520 | out_release_sock: | 520 | out_release_sock: |
@@ -532,7 +532,7 @@ int inet_dgram_connect(struct socket *sock, struct sockaddr * uaddr, | |||
532 | if (uaddr->sa_family == AF_UNSPEC) | 532 | if (uaddr->sa_family == AF_UNSPEC) |
533 | return sk->sk_prot->disconnect(sk, flags); | 533 | return sk->sk_prot->disconnect(sk, flags); |
534 | 534 | ||
535 | if (!inet_sk(sk)->num && inet_autobind(sk)) | 535 | if (!inet_sk(sk)->inet_num && inet_autobind(sk)) |
536 | return -EAGAIN; | 536 | return -EAGAIN; |
537 | return sk->sk_prot->connect(sk, (struct sockaddr *)uaddr, addr_len); | 537 | return sk->sk_prot->connect(sk, (struct sockaddr *)uaddr, addr_len); |
538 | } | 538 | } |
@@ -689,17 +689,17 @@ int inet_getname(struct socket *sock, struct sockaddr *uaddr, | |||
689 | 689 | ||
690 | sin->sin_family = AF_INET; | 690 | sin->sin_family = AF_INET; |
691 | if (peer) { | 691 | if (peer) { |
692 | if (!inet->dport || | 692 | if (!inet->inet_dport || |
693 | (((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_SYN_SENT)) && | 693 | (((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_SYN_SENT)) && |
694 | peer == 1)) | 694 | peer == 1)) |
695 | return -ENOTCONN; | 695 | return -ENOTCONN; |
696 | sin->sin_port = inet->dport; | 696 | sin->sin_port = inet->inet_dport; |
697 | sin->sin_addr.s_addr = inet->daddr; | 697 | sin->sin_addr.s_addr = inet->inet_daddr; |
698 | } else { | 698 | } else { |
699 | __be32 addr = inet->rcv_saddr; | 699 | __be32 addr = inet->inet_rcv_saddr; |
700 | if (!addr) | 700 | if (!addr) |
701 | addr = inet->saddr; | 701 | addr = inet->inet_saddr; |
702 | sin->sin_port = inet->sport; | 702 | sin->sin_port = inet->inet_sport; |
703 | sin->sin_addr.s_addr = addr; | 703 | sin->sin_addr.s_addr = addr; |
704 | } | 704 | } |
705 | memset(sin->sin_zero, 0, sizeof(sin->sin_zero)); | 705 | memset(sin->sin_zero, 0, sizeof(sin->sin_zero)); |
@@ -714,7 +714,7 @@ int inet_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, | |||
714 | struct sock *sk = sock->sk; | 714 | struct sock *sk = sock->sk; |
715 | 715 | ||
716 | /* We may need to bind the socket. */ | 716 | /* We may need to bind the socket. */ |
717 | if (!inet_sk(sk)->num && inet_autobind(sk)) | 717 | if (!inet_sk(sk)->inet_num && inet_autobind(sk)) |
718 | return -EAGAIN; | 718 | return -EAGAIN; |
719 | 719 | ||
720 | return sk->sk_prot->sendmsg(iocb, sk, msg, size); | 720 | return sk->sk_prot->sendmsg(iocb, sk, msg, size); |
@@ -728,7 +728,7 @@ static ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset, | |||
728 | struct sock *sk = sock->sk; | 728 | struct sock *sk = sock->sk; |
729 | 729 | ||
730 | /* We may need to bind the socket. */ | 730 | /* We may need to bind the socket. */ |
731 | if (!inet_sk(sk)->num && inet_autobind(sk)) | 731 | if (!inet_sk(sk)->inet_num && inet_autobind(sk)) |
732 | return -EAGAIN; | 732 | return -EAGAIN; |
733 | 733 | ||
734 | if (sk->sk_prot->sendpage) | 734 | if (sk->sk_prot->sendpage) |
@@ -1059,9 +1059,9 @@ static int inet_sk_reselect_saddr(struct sock *sk) | |||
1059 | struct inet_sock *inet = inet_sk(sk); | 1059 | struct inet_sock *inet = inet_sk(sk); |
1060 | int err; | 1060 | int err; |
1061 | struct rtable *rt; | 1061 | struct rtable *rt; |
1062 | __be32 old_saddr = inet->saddr; | 1062 | __be32 old_saddr = inet->inet_saddr; |
1063 | __be32 new_saddr; | 1063 | __be32 new_saddr; |
1064 | __be32 daddr = inet->daddr; | 1064 | __be32 daddr = inet->inet_daddr; |
1065 | 1065 | ||
1066 | if (inet->opt && inet->opt->srr) | 1066 | if (inet->opt && inet->opt->srr) |
1067 | daddr = inet->opt->faddr; | 1067 | daddr = inet->opt->faddr; |
@@ -1071,7 +1071,7 @@ static int inet_sk_reselect_saddr(struct sock *sk) | |||
1071 | RT_CONN_FLAGS(sk), | 1071 | RT_CONN_FLAGS(sk), |
1072 | sk->sk_bound_dev_if, | 1072 | sk->sk_bound_dev_if, |
1073 | sk->sk_protocol, | 1073 | sk->sk_protocol, |
1074 | inet->sport, inet->dport, sk, 0); | 1074 | inet->inet_sport, inet->inet_dport, sk, 0); |
1075 | if (err) | 1075 | if (err) |
1076 | return err; | 1076 | return err; |
1077 | 1077 | ||
@@ -1087,7 +1087,7 @@ static int inet_sk_reselect_saddr(struct sock *sk) | |||
1087 | __func__, &old_saddr, &new_saddr); | 1087 | __func__, &old_saddr, &new_saddr); |
1088 | } | 1088 | } |
1089 | 1089 | ||
1090 | inet->saddr = inet->rcv_saddr = new_saddr; | 1090 | inet->inet_saddr = inet->inet_rcv_saddr = new_saddr; |
1091 | 1091 | ||
1092 | /* | 1092 | /* |
1093 | * XXX The only one ugly spot where we need to | 1093 | * XXX The only one ugly spot where we need to |
@@ -1113,7 +1113,7 @@ int inet_sk_rebuild_header(struct sock *sk) | |||
1113 | return 0; | 1113 | return 0; |
1114 | 1114 | ||
1115 | /* Reroute. */ | 1115 | /* Reroute. */ |
1116 | daddr = inet->daddr; | 1116 | daddr = inet->inet_daddr; |
1117 | if (inet->opt && inet->opt->srr) | 1117 | if (inet->opt && inet->opt->srr) |
1118 | daddr = inet->opt->faddr; | 1118 | daddr = inet->opt->faddr; |
1119 | { | 1119 | { |
@@ -1123,7 +1123,7 @@ int inet_sk_rebuild_header(struct sock *sk) | |||
1123 | .nl_u = { | 1123 | .nl_u = { |
1124 | .ip4_u = { | 1124 | .ip4_u = { |
1125 | .daddr = daddr, | 1125 | .daddr = daddr, |
1126 | .saddr = inet->saddr, | 1126 | .saddr = inet->inet_saddr, |
1127 | .tos = RT_CONN_FLAGS(sk), | 1127 | .tos = RT_CONN_FLAGS(sk), |
1128 | }, | 1128 | }, |
1129 | }, | 1129 | }, |
@@ -1131,8 +1131,8 @@ int inet_sk_rebuild_header(struct sock *sk) | |||
1131 | .flags = inet_sk_flowi_flags(sk), | 1131 | .flags = inet_sk_flowi_flags(sk), |
1132 | .uli_u = { | 1132 | .uli_u = { |
1133 | .ports = { | 1133 | .ports = { |
1134 | .sport = inet->sport, | 1134 | .sport = inet->inet_sport, |
1135 | .dport = inet->dport, | 1135 | .dport = inet->inet_dport, |
1136 | }, | 1136 | }, |
1137 | }, | 1137 | }, |
1138 | }; | 1138 | }; |
diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c index 5e6c5a0f3fde..fb2465811b48 100644 --- a/net/ipv4/datagram.c +++ b/net/ipv4/datagram.c | |||
@@ -39,7 +39,7 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
39 | sk_dst_reset(sk); | 39 | sk_dst_reset(sk); |
40 | 40 | ||
41 | oif = sk->sk_bound_dev_if; | 41 | oif = sk->sk_bound_dev_if; |
42 | saddr = inet->saddr; | 42 | saddr = inet->inet_saddr; |
43 | if (ipv4_is_multicast(usin->sin_addr.s_addr)) { | 43 | if (ipv4_is_multicast(usin->sin_addr.s_addr)) { |
44 | if (!oif) | 44 | if (!oif) |
45 | oif = inet->mc_index; | 45 | oif = inet->mc_index; |
@@ -49,7 +49,7 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
49 | err = ip_route_connect(&rt, usin->sin_addr.s_addr, saddr, | 49 | err = ip_route_connect(&rt, usin->sin_addr.s_addr, saddr, |
50 | RT_CONN_FLAGS(sk), oif, | 50 | RT_CONN_FLAGS(sk), oif, |
51 | sk->sk_protocol, | 51 | sk->sk_protocol, |
52 | inet->sport, usin->sin_port, sk, 1); | 52 | inet->inet_sport, usin->sin_port, sk, 1); |
53 | if (err) { | 53 | if (err) { |
54 | if (err == -ENETUNREACH) | 54 | if (err == -ENETUNREACH) |
55 | IP_INC_STATS_BH(sock_net(sk), IPSTATS_MIB_OUTNOROUTES); | 55 | IP_INC_STATS_BH(sock_net(sk), IPSTATS_MIB_OUTNOROUTES); |
@@ -60,14 +60,14 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
60 | ip_rt_put(rt); | 60 | ip_rt_put(rt); |
61 | return -EACCES; | 61 | return -EACCES; |
62 | } | 62 | } |
63 | if (!inet->saddr) | 63 | if (!inet->inet_saddr) |
64 | inet->saddr = rt->rt_src; /* Update source address */ | 64 | inet->inet_saddr = rt->rt_src; /* Update source address */ |
65 | if (!inet->rcv_saddr) | 65 | if (!inet->inet_rcv_saddr) |
66 | inet->rcv_saddr = rt->rt_src; | 66 | inet->inet_rcv_saddr = rt->rt_src; |
67 | inet->daddr = rt->rt_dst; | 67 | inet->inet_daddr = rt->rt_dst; |
68 | inet->dport = usin->sin_port; | 68 | inet->inet_dport = usin->sin_port; |
69 | sk->sk_state = TCP_ESTABLISHED; | 69 | sk->sk_state = TCP_ESTABLISHED; |
70 | inet->id = jiffies; | 70 | inet->inet_id = jiffies; |
71 | 71 | ||
72 | sk_dst_set(sk, &rt->u.dst); | 72 | sk_dst_set(sk, &rt->u.dst); |
73 | return(0); | 73 | return(0); |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 9139e8f6fdb1..f6a0af759932 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -368,7 +368,7 @@ struct dst_entry *inet_csk_route_req(struct sock *sk, | |||
368 | .proto = sk->sk_protocol, | 368 | .proto = sk->sk_protocol, |
369 | .flags = inet_sk_flowi_flags(sk), | 369 | .flags = inet_sk_flowi_flags(sk), |
370 | .uli_u = { .ports = | 370 | .uli_u = { .ports = |
371 | { .sport = inet_sk(sk)->sport, | 371 | { .sport = inet_sk(sk)->inet_sport, |
372 | .dport = ireq->rmt_port } } }; | 372 | .dport = ireq->rmt_port } } }; |
373 | struct net *net = sock_net(sk); | 373 | struct net *net = sock_net(sk); |
374 | 374 | ||
@@ -547,9 +547,9 @@ struct sock *inet_csk_clone(struct sock *sk, const struct request_sock *req, | |||
547 | newsk->sk_state = TCP_SYN_RECV; | 547 | newsk->sk_state = TCP_SYN_RECV; |
548 | newicsk->icsk_bind_hash = NULL; | 548 | newicsk->icsk_bind_hash = NULL; |
549 | 549 | ||
550 | inet_sk(newsk)->dport = inet_rsk(req)->rmt_port; | 550 | inet_sk(newsk)->inet_dport = inet_rsk(req)->rmt_port; |
551 | inet_sk(newsk)->num = ntohs(inet_rsk(req)->loc_port); | 551 | inet_sk(newsk)->inet_num = ntohs(inet_rsk(req)->loc_port); |
552 | inet_sk(newsk)->sport = inet_rsk(req)->loc_port; | 552 | inet_sk(newsk)->inet_sport = inet_rsk(req)->loc_port; |
553 | newsk->sk_write_space = sk_stream_write_space; | 553 | newsk->sk_write_space = sk_stream_write_space; |
554 | 554 | ||
555 | newicsk->icsk_retransmits = 0; | 555 | newicsk->icsk_retransmits = 0; |
@@ -580,8 +580,8 @@ void inet_csk_destroy_sock(struct sock *sk) | |||
580 | /* It cannot be in hash table! */ | 580 | /* It cannot be in hash table! */ |
581 | WARN_ON(!sk_unhashed(sk)); | 581 | WARN_ON(!sk_unhashed(sk)); |
582 | 582 | ||
583 | /* If it has not 0 inet_sk(sk)->num, it must be bound */ | 583 | /* If it has not 0 inet_sk(sk)->inet_num, it must be bound */ |
584 | WARN_ON(inet_sk(sk)->num && !inet_csk(sk)->icsk_bind_hash); | 584 | WARN_ON(inet_sk(sk)->inet_num && !inet_csk(sk)->icsk_bind_hash); |
585 | 585 | ||
586 | sk->sk_prot->destroy(sk); | 586 | sk->sk_prot->destroy(sk); |
587 | 587 | ||
@@ -616,8 +616,8 @@ int inet_csk_listen_start(struct sock *sk, const int nr_table_entries) | |||
616 | * after validation is complete. | 616 | * after validation is complete. |
617 | */ | 617 | */ |
618 | sk->sk_state = TCP_LISTEN; | 618 | sk->sk_state = TCP_LISTEN; |
619 | if (!sk->sk_prot->get_port(sk, inet->num)) { | 619 | if (!sk->sk_prot->get_port(sk, inet->inet_num)) { |
620 | inet->sport = htons(inet->num); | 620 | inet->inet_sport = htons(inet->inet_num); |
621 | 621 | ||
622 | sk_dst_reset(sk); | 622 | sk_dst_reset(sk); |
623 | sk->sk_prot->hash(sk); | 623 | sk->sk_prot->hash(sk); |
@@ -693,8 +693,8 @@ void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr) | |||
693 | const struct inet_sock *inet = inet_sk(sk); | 693 | const struct inet_sock *inet = inet_sk(sk); |
694 | 694 | ||
695 | sin->sin_family = AF_INET; | 695 | sin->sin_family = AF_INET; |
696 | sin->sin_addr.s_addr = inet->daddr; | 696 | sin->sin_addr.s_addr = inet->inet_daddr; |
697 | sin->sin_port = inet->dport; | 697 | sin->sin_port = inet->inet_dport; |
698 | } | 698 | } |
699 | 699 | ||
700 | EXPORT_SYMBOL_GPL(inet_csk_addr2sockaddr); | 700 | EXPORT_SYMBOL_GPL(inet_csk_addr2sockaddr); |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index cb73fdefba91..bdb78dd180ce 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -116,10 +116,10 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
116 | r->id.idiag_cookie[0] = (u32)(unsigned long)sk; | 116 | r->id.idiag_cookie[0] = (u32)(unsigned long)sk; |
117 | r->id.idiag_cookie[1] = (u32)(((unsigned long)sk >> 31) >> 1); | 117 | r->id.idiag_cookie[1] = (u32)(((unsigned long)sk >> 31) >> 1); |
118 | 118 | ||
119 | r->id.idiag_sport = inet->sport; | 119 | r->id.idiag_sport = inet->inet_sport; |
120 | r->id.idiag_dport = inet->dport; | 120 | r->id.idiag_dport = inet->inet_dport; |
121 | r->id.idiag_src[0] = inet->rcv_saddr; | 121 | r->id.idiag_src[0] = inet->inet_rcv_saddr; |
122 | r->id.idiag_dst[0] = inet->daddr; | 122 | r->id.idiag_dst[0] = inet->inet_daddr; |
123 | 123 | ||
124 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 124 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
125 | if (r->idiag_family == AF_INET6) { | 125 | if (r->idiag_family == AF_INET6) { |
@@ -504,11 +504,11 @@ static int inet_csk_diag_dump(struct sock *sk, | |||
504 | } else | 504 | } else |
505 | #endif | 505 | #endif |
506 | { | 506 | { |
507 | entry.saddr = &inet->rcv_saddr; | 507 | entry.saddr = &inet->inet_rcv_saddr; |
508 | entry.daddr = &inet->daddr; | 508 | entry.daddr = &inet->inet_daddr; |
509 | } | 509 | } |
510 | entry.sport = inet->num; | 510 | entry.sport = inet->inet_num; |
511 | entry.dport = ntohs(inet->dport); | 511 | entry.dport = ntohs(inet->inet_dport); |
512 | entry.userlocks = sk->sk_userlocks; | 512 | entry.userlocks = sk->sk_userlocks; |
513 | 513 | ||
514 | if (!inet_diag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), &entry)) | 514 | if (!inet_diag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), &entry)) |
@@ -584,7 +584,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk, | |||
584 | if (tmo < 0) | 584 | if (tmo < 0) |
585 | tmo = 0; | 585 | tmo = 0; |
586 | 586 | ||
587 | r->id.idiag_sport = inet->sport; | 587 | r->id.idiag_sport = inet->inet_sport; |
588 | r->id.idiag_dport = ireq->rmt_port; | 588 | r->id.idiag_dport = ireq->rmt_port; |
589 | r->id.idiag_src[0] = ireq->loc_addr; | 589 | r->id.idiag_src[0] = ireq->loc_addr; |
590 | r->id.idiag_dst[0] = ireq->rmt_addr; | 590 | r->id.idiag_dst[0] = ireq->rmt_addr; |
@@ -639,7 +639,7 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, | |||
639 | 639 | ||
640 | if (cb->nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(*r))) { | 640 | if (cb->nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(*r))) { |
641 | bc = (struct rtattr *)(r + 1); | 641 | bc = (struct rtattr *)(r + 1); |
642 | entry.sport = inet->num; | 642 | entry.sport = inet->inet_num; |
643 | entry.userlocks = sk->sk_userlocks; | 643 | entry.userlocks = sk->sk_userlocks; |
644 | } | 644 | } |
645 | 645 | ||
@@ -732,7 +732,7 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
732 | continue; | 732 | continue; |
733 | } | 733 | } |
734 | 734 | ||
735 | if (r->id.idiag_sport != inet->sport && | 735 | if (r->id.idiag_sport != inet->inet_sport && |
736 | r->id.idiag_sport) | 736 | r->id.idiag_sport) |
737 | goto next_listen; | 737 | goto next_listen; |
738 | 738 | ||
@@ -797,10 +797,10 @@ skip_listen_ht: | |||
797 | goto next_normal; | 797 | goto next_normal; |
798 | if (!(r->idiag_states & (1 << sk->sk_state))) | 798 | if (!(r->idiag_states & (1 << sk->sk_state))) |
799 | goto next_normal; | 799 | goto next_normal; |
800 | if (r->id.idiag_sport != inet->sport && | 800 | if (r->id.idiag_sport != inet->inet_sport && |
801 | r->id.idiag_sport) | 801 | r->id.idiag_sport) |
802 | goto next_normal; | 802 | goto next_normal; |
803 | if (r->id.idiag_dport != inet->dport && | 803 | if (r->id.idiag_dport != inet->inet_dport && |
804 | r->id.idiag_dport) | 804 | r->id.idiag_dport) |
805 | goto next_normal; | 805 | goto next_normal; |
806 | if (inet_csk_diag_dump(sk, skb, cb) < 0) { | 806 | if (inet_csk_diag_dump(sk, skb, cb) < 0) { |
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index a45aaf3d48b1..47ad7aab51e3 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c | |||
@@ -64,7 +64,7 @@ void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb, | |||
64 | 64 | ||
65 | atomic_inc(&hashinfo->bsockets); | 65 | atomic_inc(&hashinfo->bsockets); |
66 | 66 | ||
67 | inet_sk(sk)->num = snum; | 67 | inet_sk(sk)->inet_num = snum; |
68 | sk_add_bind_node(sk, &tb->owners); | 68 | sk_add_bind_node(sk, &tb->owners); |
69 | tb->num_owners++; | 69 | tb->num_owners++; |
70 | inet_csk(sk)->icsk_bind_hash = tb; | 70 | inet_csk(sk)->icsk_bind_hash = tb; |
@@ -76,7 +76,7 @@ void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb, | |||
76 | static void __inet_put_port(struct sock *sk) | 76 | static void __inet_put_port(struct sock *sk) |
77 | { | 77 | { |
78 | struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; | 78 | struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; |
79 | const int bhash = inet_bhashfn(sock_net(sk), inet_sk(sk)->num, | 79 | const int bhash = inet_bhashfn(sock_net(sk), inet_sk(sk)->inet_num, |
80 | hashinfo->bhash_size); | 80 | hashinfo->bhash_size); |
81 | struct inet_bind_hashbucket *head = &hashinfo->bhash[bhash]; | 81 | struct inet_bind_hashbucket *head = &hashinfo->bhash[bhash]; |
82 | struct inet_bind_bucket *tb; | 82 | struct inet_bind_bucket *tb; |
@@ -88,7 +88,7 @@ static void __inet_put_port(struct sock *sk) | |||
88 | __sk_del_bind_node(sk); | 88 | __sk_del_bind_node(sk); |
89 | tb->num_owners--; | 89 | tb->num_owners--; |
90 | inet_csk(sk)->icsk_bind_hash = NULL; | 90 | inet_csk(sk)->icsk_bind_hash = NULL; |
91 | inet_sk(sk)->num = 0; | 91 | inet_sk(sk)->inet_num = 0; |
92 | inet_bind_bucket_destroy(hashinfo->bind_bucket_cachep, tb); | 92 | inet_bind_bucket_destroy(hashinfo->bind_bucket_cachep, tb); |
93 | spin_unlock(&head->lock); | 93 | spin_unlock(&head->lock); |
94 | } | 94 | } |
@@ -105,7 +105,7 @@ EXPORT_SYMBOL(inet_put_port); | |||
105 | void __inet_inherit_port(struct sock *sk, struct sock *child) | 105 | void __inet_inherit_port(struct sock *sk, struct sock *child) |
106 | { | 106 | { |
107 | struct inet_hashinfo *table = sk->sk_prot->h.hashinfo; | 107 | struct inet_hashinfo *table = sk->sk_prot->h.hashinfo; |
108 | const int bhash = inet_bhashfn(sock_net(sk), inet_sk(child)->num, | 108 | const int bhash = inet_bhashfn(sock_net(sk), inet_sk(child)->inet_num, |
109 | table->bhash_size); | 109 | table->bhash_size); |
110 | struct inet_bind_hashbucket *head = &table->bhash[bhash]; | 110 | struct inet_bind_hashbucket *head = &table->bhash[bhash]; |
111 | struct inet_bind_bucket *tb; | 111 | struct inet_bind_bucket *tb; |
@@ -126,9 +126,9 @@ static inline int compute_score(struct sock *sk, struct net *net, | |||
126 | int score = -1; | 126 | int score = -1; |
127 | struct inet_sock *inet = inet_sk(sk); | 127 | struct inet_sock *inet = inet_sk(sk); |
128 | 128 | ||
129 | if (net_eq(sock_net(sk), net) && inet->num == hnum && | 129 | if (net_eq(sock_net(sk), net) && inet->inet_num == hnum && |
130 | !ipv6_only_sock(sk)) { | 130 | !ipv6_only_sock(sk)) { |
131 | __be32 rcv_saddr = inet->rcv_saddr; | 131 | __be32 rcv_saddr = inet->inet_rcv_saddr; |
132 | score = sk->sk_family == PF_INET ? 1 : 0; | 132 | score = sk->sk_family == PF_INET ? 1 : 0; |
133 | if (rcv_saddr) { | 133 | if (rcv_saddr) { |
134 | if (rcv_saddr != daddr) | 134 | if (rcv_saddr != daddr) |
@@ -273,13 +273,14 @@ static int __inet_check_established(struct inet_timewait_death_row *death_row, | |||
273 | { | 273 | { |
274 | struct inet_hashinfo *hinfo = death_row->hashinfo; | 274 | struct inet_hashinfo *hinfo = death_row->hashinfo; |
275 | struct inet_sock *inet = inet_sk(sk); | 275 | struct inet_sock *inet = inet_sk(sk); |
276 | __be32 daddr = inet->rcv_saddr; | 276 | __be32 daddr = inet->inet_rcv_saddr; |
277 | __be32 saddr = inet->daddr; | 277 | __be32 saddr = inet->inet_daddr; |
278 | int dif = sk->sk_bound_dev_if; | 278 | int dif = sk->sk_bound_dev_if; |
279 | INET_ADDR_COOKIE(acookie, saddr, daddr) | 279 | INET_ADDR_COOKIE(acookie, saddr, daddr) |
280 | const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport); | 280 | const __portpair ports = INET_COMBINED_PORTS(inet->inet_dport, lport); |
281 | struct net *net = sock_net(sk); | 281 | struct net *net = sock_net(sk); |
282 | unsigned int hash = inet_ehashfn(net, daddr, lport, saddr, inet->dport); | 282 | unsigned int hash = inet_ehashfn(net, daddr, lport, |
283 | saddr, inet->inet_dport); | ||
283 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); | 284 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); |
284 | spinlock_t *lock = inet_ehash_lockp(hinfo, hash); | 285 | spinlock_t *lock = inet_ehash_lockp(hinfo, hash); |
285 | struct sock *sk2; | 286 | struct sock *sk2; |
@@ -312,8 +313,8 @@ static int __inet_check_established(struct inet_timewait_death_row *death_row, | |||
312 | unique: | 313 | unique: |
313 | /* Must record num and sport now. Otherwise we will see | 314 | /* Must record num and sport now. Otherwise we will see |
314 | * in hash table socket with a funny identity. */ | 315 | * in hash table socket with a funny identity. */ |
315 | inet->num = lport; | 316 | inet->inet_num = lport; |
316 | inet->sport = htons(lport); | 317 | inet->inet_sport = htons(lport); |
317 | sk->sk_hash = hash; | 318 | sk->sk_hash = hash; |
318 | WARN_ON(!sk_unhashed(sk)); | 319 | WARN_ON(!sk_unhashed(sk)); |
319 | __sk_nulls_add_node_rcu(sk, &head->chain); | 320 | __sk_nulls_add_node_rcu(sk, &head->chain); |
@@ -341,8 +342,9 @@ not_unique: | |||
341 | static inline u32 inet_sk_port_offset(const struct sock *sk) | 342 | static inline u32 inet_sk_port_offset(const struct sock *sk) |
342 | { | 343 | { |
343 | const struct inet_sock *inet = inet_sk(sk); | 344 | const struct inet_sock *inet = inet_sk(sk); |
344 | return secure_ipv4_port_ephemeral(inet->rcv_saddr, inet->daddr, | 345 | return secure_ipv4_port_ephemeral(inet->inet_rcv_saddr, |
345 | inet->dport); | 346 | inet->inet_daddr, |
347 | inet->inet_dport); | ||
346 | } | 348 | } |
347 | 349 | ||
348 | void __inet_hash_nolisten(struct sock *sk) | 350 | void __inet_hash_nolisten(struct sock *sk) |
@@ -424,7 +426,7 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row, | |||
424 | void (*hash)(struct sock *sk)) | 426 | void (*hash)(struct sock *sk)) |
425 | { | 427 | { |
426 | struct inet_hashinfo *hinfo = death_row->hashinfo; | 428 | struct inet_hashinfo *hinfo = death_row->hashinfo; |
427 | const unsigned short snum = inet_sk(sk)->num; | 429 | const unsigned short snum = inet_sk(sk)->inet_num; |
428 | struct inet_bind_hashbucket *head; | 430 | struct inet_bind_hashbucket *head; |
429 | struct inet_bind_bucket *tb; | 431 | struct inet_bind_bucket *tb; |
430 | int ret; | 432 | int ret; |
@@ -485,7 +487,7 @@ ok: | |||
485 | /* Head lock still held and bh's disabled */ | 487 | /* Head lock still held and bh's disabled */ |
486 | inet_bind_hash(sk, tb, port); | 488 | inet_bind_hash(sk, tb, port); |
487 | if (sk_unhashed(sk)) { | 489 | if (sk_unhashed(sk)) { |
488 | inet_sk(sk)->sport = htons(port); | 490 | inet_sk(sk)->inet_sport = htons(port); |
489 | hash(sk); | 491 | hash(sk); |
490 | } | 492 | } |
491 | spin_unlock(&head->lock); | 493 | spin_unlock(&head->lock); |
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c index 2fe571155b22..1f5d508bb18b 100644 --- a/net/ipv4/inet_timewait_sock.c +++ b/net/ipv4/inet_timewait_sock.c | |||
@@ -86,7 +86,7 @@ void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk, | |||
86 | Note, that any socket with inet->num != 0 MUST be bound in | 86 | Note, that any socket with inet->num != 0 MUST be bound in |
87 | binding cache, even if it is closed. | 87 | binding cache, even if it is closed. |
88 | */ | 88 | */ |
89 | bhead = &hashinfo->bhash[inet_bhashfn(twsk_net(tw), inet->num, | 89 | bhead = &hashinfo->bhash[inet_bhashfn(twsk_net(tw), inet->inet_num, |
90 | hashinfo->bhash_size)]; | 90 | hashinfo->bhash_size)]; |
91 | spin_lock(&bhead->lock); | 91 | spin_lock(&bhead->lock); |
92 | tw->tw_tb = icsk->icsk_bind_hash; | 92 | tw->tw_tb = icsk->icsk_bind_hash; |
@@ -124,14 +124,14 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, const int stat | |||
124 | kmemcheck_annotate_bitfield(tw, flags); | 124 | kmemcheck_annotate_bitfield(tw, flags); |
125 | 125 | ||
126 | /* Give us an identity. */ | 126 | /* Give us an identity. */ |
127 | tw->tw_daddr = inet->daddr; | 127 | tw->tw_daddr = inet->inet_daddr; |
128 | tw->tw_rcv_saddr = inet->rcv_saddr; | 128 | tw->tw_rcv_saddr = inet->inet_rcv_saddr; |
129 | tw->tw_bound_dev_if = sk->sk_bound_dev_if; | 129 | tw->tw_bound_dev_if = sk->sk_bound_dev_if; |
130 | tw->tw_num = inet->num; | 130 | tw->tw_num = inet->inet_num; |
131 | tw->tw_state = TCP_TIME_WAIT; | 131 | tw->tw_state = TCP_TIME_WAIT; |
132 | tw->tw_substate = state; | 132 | tw->tw_substate = state; |
133 | tw->tw_sport = inet->sport; | 133 | tw->tw_sport = inet->inet_sport; |
134 | tw->tw_dport = inet->dport; | 134 | tw->tw_dport = inet->inet_dport; |
135 | tw->tw_family = sk->sk_family; | 135 | tw->tw_family = sk->sk_family; |
136 | tw->tw_reuse = sk->sk_reuse; | 136 | tw->tw_reuse = sk->sk_reuse; |
137 | tw->tw_hash = sk->sk_hash; | 137 | tw->tw_hash = sk->sk_hash; |
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 6c98b43badf4..fdf51badc8e5 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
@@ -161,7 +161,7 @@ int ip_call_ra_chain(struct sk_buff *skb) | |||
161 | /* If socket is bound to an interface, only report | 161 | /* If socket is bound to an interface, only report |
162 | * the packet if it came from that interface. | 162 | * the packet if it came from that interface. |
163 | */ | 163 | */ |
164 | if (sk && inet_sk(sk)->num == protocol && | 164 | if (sk && inet_sk(sk)->inet_num == protocol && |
165 | (!sk->sk_bound_dev_if || | 165 | (!sk->sk_bound_dev_if || |
166 | sk->sk_bound_dev_if == dev->ifindex) && | 166 | sk->sk_bound_dev_if == dev->ifindex) && |
167 | sock_net(sk) == dev_net(dev)) { | 167 | sock_net(sk) == dev_net(dev)) { |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index f9895180f481..322b40864ac0 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -329,7 +329,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok) | |||
329 | __be32 daddr; | 329 | __be32 daddr; |
330 | 330 | ||
331 | /* Use correct destination address if we have options. */ | 331 | /* Use correct destination address if we have options. */ |
332 | daddr = inet->daddr; | 332 | daddr = inet->inet_daddr; |
333 | if(opt && opt->srr) | 333 | if(opt && opt->srr) |
334 | daddr = opt->faddr; | 334 | daddr = opt->faddr; |
335 | 335 | ||
@@ -338,13 +338,13 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok) | |||
338 | .mark = sk->sk_mark, | 338 | .mark = sk->sk_mark, |
339 | .nl_u = { .ip4_u = | 339 | .nl_u = { .ip4_u = |
340 | { .daddr = daddr, | 340 | { .daddr = daddr, |
341 | .saddr = inet->saddr, | 341 | .saddr = inet->inet_saddr, |
342 | .tos = RT_CONN_FLAGS(sk) } }, | 342 | .tos = RT_CONN_FLAGS(sk) } }, |
343 | .proto = sk->sk_protocol, | 343 | .proto = sk->sk_protocol, |
344 | .flags = inet_sk_flowi_flags(sk), | 344 | .flags = inet_sk_flowi_flags(sk), |
345 | .uli_u = { .ports = | 345 | .uli_u = { .ports = |
346 | { .sport = inet->sport, | 346 | { .sport = inet->inet_sport, |
347 | .dport = inet->dport } } }; | 347 | .dport = inet->inet_dport } } }; |
348 | 348 | ||
349 | /* If this fails, retransmit mechanism of transport layer will | 349 | /* If this fails, retransmit mechanism of transport layer will |
350 | * keep trying until route appears or the connection times | 350 | * keep trying until route appears or the connection times |
@@ -379,7 +379,7 @@ packet_routed: | |||
379 | 379 | ||
380 | if (opt && opt->optlen) { | 380 | if (opt && opt->optlen) { |
381 | iph->ihl += opt->optlen >> 2; | 381 | iph->ihl += opt->optlen >> 2; |
382 | ip_options_build(skb, opt, inet->daddr, rt, 0); | 382 | ip_options_build(skb, opt, inet->inet_daddr, rt, 0); |
383 | } | 383 | } |
384 | 384 | ||
385 | ip_select_ident_more(iph, &rt->u.dst, sk, | 385 | ip_select_ident_more(iph, &rt->u.dst, sk, |
@@ -846,7 +846,8 @@ int ip_append_data(struct sock *sk, | |||
846 | maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen; | 846 | maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen; |
847 | 847 | ||
848 | if (inet->cork.length + length > 0xFFFF - fragheaderlen) { | 848 | if (inet->cork.length + length > 0xFFFF - fragheaderlen) { |
849 | ip_local_error(sk, EMSGSIZE, rt->rt_dst, inet->dport, mtu-exthdrlen); | 849 | ip_local_error(sk, EMSGSIZE, rt->rt_dst, inet->inet_dport, |
850 | mtu-exthdrlen); | ||
850 | return -EMSGSIZE; | 851 | return -EMSGSIZE; |
851 | } | 852 | } |
852 | 853 | ||
@@ -1100,7 +1101,7 @@ ssize_t ip_append_page(struct sock *sk, struct page *page, | |||
1100 | maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen; | 1101 | maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen; |
1101 | 1102 | ||
1102 | if (inet->cork.length + size > 0xFFFF - fragheaderlen) { | 1103 | if (inet->cork.length + size > 0xFFFF - fragheaderlen) { |
1103 | ip_local_error(sk, EMSGSIZE, rt->rt_dst, inet->dport, mtu); | 1104 | ip_local_error(sk, EMSGSIZE, rt->rt_dst, inet->inet_dport, mtu); |
1104 | return -EMSGSIZE; | 1105 | return -EMSGSIZE; |
1105 | } | 1106 | } |
1106 | 1107 | ||
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 0c0b6e363a20..c602d985fe14 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -245,7 +245,7 @@ int ip_ra_control(struct sock *sk, unsigned char on, | |||
245 | { | 245 | { |
246 | struct ip_ra_chain *ra, *new_ra, **rap; | 246 | struct ip_ra_chain *ra, *new_ra, **rap; |
247 | 247 | ||
248 | if (sk->sk_type != SOCK_RAW || inet_sk(sk)->num == IPPROTO_RAW) | 248 | if (sk->sk_type != SOCK_RAW || inet_sk(sk)->inet_num == IPPROTO_RAW) |
249 | return -EINVAL; | 249 | return -EINVAL; |
250 | 250 | ||
251 | new_ra = on ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL; | 251 | new_ra = on ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL; |
@@ -492,7 +492,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
492 | if (sk->sk_family == PF_INET || | 492 | if (sk->sk_family == PF_INET || |
493 | (!((1 << sk->sk_state) & | 493 | (!((1 << sk->sk_state) & |
494 | (TCPF_LISTEN | TCPF_CLOSE)) && | 494 | (TCPF_LISTEN | TCPF_CLOSE)) && |
495 | inet->daddr != LOOPBACK4_IPV6)) { | 495 | inet->inet_daddr != LOOPBACK4_IPV6)) { |
496 | #endif | 496 | #endif |
497 | if (inet->opt) | 497 | if (inet->opt) |
498 | icsk->icsk_ext_hdr_len -= inet->opt->optlen; | 498 | icsk->icsk_ext_hdr_len -= inet->opt->optlen; |
@@ -1181,8 +1181,8 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, | |||
1181 | if (inet->cmsg_flags & IP_CMSG_PKTINFO) { | 1181 | if (inet->cmsg_flags & IP_CMSG_PKTINFO) { |
1182 | struct in_pktinfo info; | 1182 | struct in_pktinfo info; |
1183 | 1183 | ||
1184 | info.ipi_addr.s_addr = inet->rcv_saddr; | 1184 | info.ipi_addr.s_addr = inet->inet_rcv_saddr; |
1185 | info.ipi_spec_dst.s_addr = inet->rcv_saddr; | 1185 | info.ipi_spec_dst.s_addr = inet->inet_rcv_saddr; |
1186 | info.ipi_ifindex = inet->mc_index; | 1186 | info.ipi_ifindex = inet->mc_index; |
1187 | put_cmsg(&msg, SOL_IP, IP_PKTINFO, sizeof(info), &info); | 1187 | put_cmsg(&msg, SOL_IP, IP_PKTINFO, sizeof(info), &info); |
1188 | } | 1188 | } |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index c757f0b4b74c..694974502ea6 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -956,7 +956,7 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, unsi | |||
956 | switch (optname) { | 956 | switch (optname) { |
957 | case MRT_INIT: | 957 | case MRT_INIT: |
958 | if (sk->sk_type != SOCK_RAW || | 958 | if (sk->sk_type != SOCK_RAW || |
959 | inet_sk(sk)->num != IPPROTO_IGMP) | 959 | inet_sk(sk)->inet_num != IPPROTO_IGMP) |
960 | return -EOPNOTSUPP; | 960 | return -EOPNOTSUPP; |
961 | if (optlen != sizeof(int)) | 961 | if (optlen != sizeof(int)) |
962 | return -ENOPROTOOPT; | 962 | return -ENOPROTOOPT; |
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index aa95bb82ee6c..9cd423ffafa8 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | |||
@@ -255,10 +255,10 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len) | |||
255 | struct nf_conntrack_tuple tuple; | 255 | struct nf_conntrack_tuple tuple; |
256 | 256 | ||
257 | memset(&tuple, 0, sizeof(tuple)); | 257 | memset(&tuple, 0, sizeof(tuple)); |
258 | tuple.src.u3.ip = inet->rcv_saddr; | 258 | tuple.src.u3.ip = inet->inet_rcv_saddr; |
259 | tuple.src.u.tcp.port = inet->sport; | 259 | tuple.src.u.tcp.port = inet->inet_sport; |
260 | tuple.dst.u3.ip = inet->daddr; | 260 | tuple.dst.u3.ip = inet->inet_daddr; |
261 | tuple.dst.u.tcp.port = inet->dport; | 261 | tuple.dst.u.tcp.port = inet->inet_dport; |
262 | tuple.src.l3num = PF_INET; | 262 | tuple.src.l3num = PF_INET; |
263 | tuple.dst.protonum = sk->sk_protocol; | 263 | tuple.dst.protonum = sk->sk_protocol; |
264 | 264 | ||
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 39e2a6b8752c..9ef8c0829a77 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -87,7 +87,7 @@ void raw_hash_sk(struct sock *sk) | |||
87 | struct raw_hashinfo *h = sk->sk_prot->h.raw_hash; | 87 | struct raw_hashinfo *h = sk->sk_prot->h.raw_hash; |
88 | struct hlist_head *head; | 88 | struct hlist_head *head; |
89 | 89 | ||
90 | head = &h->ht[inet_sk(sk)->num & (RAW_HTABLE_SIZE - 1)]; | 90 | head = &h->ht[inet_sk(sk)->inet_num & (RAW_HTABLE_SIZE - 1)]; |
91 | 91 | ||
92 | write_lock_bh(&h->lock); | 92 | write_lock_bh(&h->lock); |
93 | sk_add_node(sk, head); | 93 | sk_add_node(sk, head); |
@@ -115,9 +115,9 @@ static struct sock *__raw_v4_lookup(struct net *net, struct sock *sk, | |||
115 | sk_for_each_from(sk, node) { | 115 | sk_for_each_from(sk, node) { |
116 | struct inet_sock *inet = inet_sk(sk); | 116 | struct inet_sock *inet = inet_sk(sk); |
117 | 117 | ||
118 | if (net_eq(sock_net(sk), net) && inet->num == num && | 118 | if (net_eq(sock_net(sk), net) && inet->inet_num == num && |
119 | !(inet->daddr && inet->daddr != raddr) && | 119 | !(inet->inet_daddr && inet->inet_daddr != raddr) && |
120 | !(inet->rcv_saddr && inet->rcv_saddr != laddr) && | 120 | !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) && |
121 | !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)) | 121 | !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)) |
122 | goto found; /* gotcha */ | 122 | goto found; /* gotcha */ |
123 | } | 123 | } |
@@ -326,7 +326,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length, | |||
326 | int err; | 326 | int err; |
327 | 327 | ||
328 | if (length > rt->u.dst.dev->mtu) { | 328 | if (length > rt->u.dst.dev->mtu) { |
329 | ip_local_error(sk, EMSGSIZE, rt->rt_dst, inet->dport, | 329 | ip_local_error(sk, EMSGSIZE, rt->rt_dst, inet->inet_dport, |
330 | rt->u.dst.dev->mtu); | 330 | rt->u.dst.dev->mtu); |
331 | return -EMSGSIZE; | 331 | return -EMSGSIZE; |
332 | } | 332 | } |
@@ -489,10 +489,10 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
489 | err = -EDESTADDRREQ; | 489 | err = -EDESTADDRREQ; |
490 | if (sk->sk_state != TCP_ESTABLISHED) | 490 | if (sk->sk_state != TCP_ESTABLISHED) |
491 | goto out; | 491 | goto out; |
492 | daddr = inet->daddr; | 492 | daddr = inet->inet_daddr; |
493 | } | 493 | } |
494 | 494 | ||
495 | ipc.addr = inet->saddr; | 495 | ipc.addr = inet->inet_saddr; |
496 | ipc.opt = NULL; | 496 | ipc.opt = NULL; |
497 | ipc.shtx.flags = 0; | 497 | ipc.shtx.flags = 0; |
498 | ipc.oif = sk->sk_bound_dev_if; | 498 | ipc.oif = sk->sk_bound_dev_if; |
@@ -634,9 +634,9 @@ static int raw_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
634 | if (addr->sin_addr.s_addr && chk_addr_ret != RTN_LOCAL && | 634 | if (addr->sin_addr.s_addr && chk_addr_ret != RTN_LOCAL && |
635 | chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) | 635 | chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) |
636 | goto out; | 636 | goto out; |
637 | inet->rcv_saddr = inet->saddr = addr->sin_addr.s_addr; | 637 | inet->inet_rcv_saddr = inet->inet_saddr = addr->sin_addr.s_addr; |
638 | if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST) | 638 | if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST) |
639 | inet->saddr = 0; /* Use device */ | 639 | inet->inet_saddr = 0; /* Use device */ |
640 | sk_dst_reset(sk); | 640 | sk_dst_reset(sk); |
641 | ret = 0; | 641 | ret = 0; |
642 | out: return ret; | 642 | out: return ret; |
@@ -706,7 +706,7 @@ static int raw_init(struct sock *sk) | |||
706 | { | 706 | { |
707 | struct raw_sock *rp = raw_sk(sk); | 707 | struct raw_sock *rp = raw_sk(sk); |
708 | 708 | ||
709 | if (inet_sk(sk)->num == IPPROTO_ICMP) | 709 | if (inet_sk(sk)->inet_num == IPPROTO_ICMP) |
710 | memset(&rp->filter, 0, sizeof(rp->filter)); | 710 | memset(&rp->filter, 0, sizeof(rp->filter)); |
711 | return 0; | 711 | return 0; |
712 | } | 712 | } |
@@ -743,7 +743,7 @@ static int do_raw_setsockopt(struct sock *sk, int level, int optname, | |||
743 | char __user *optval, unsigned int optlen) | 743 | char __user *optval, unsigned int optlen) |
744 | { | 744 | { |
745 | if (optname == ICMP_FILTER) { | 745 | if (optname == ICMP_FILTER) { |
746 | if (inet_sk(sk)->num != IPPROTO_ICMP) | 746 | if (inet_sk(sk)->inet_num != IPPROTO_ICMP) |
747 | return -EOPNOTSUPP; | 747 | return -EOPNOTSUPP; |
748 | else | 748 | else |
749 | return raw_seticmpfilter(sk, optval, optlen); | 749 | return raw_seticmpfilter(sk, optval, optlen); |
@@ -773,7 +773,7 @@ static int do_raw_getsockopt(struct sock *sk, int level, int optname, | |||
773 | char __user *optval, int __user *optlen) | 773 | char __user *optval, int __user *optlen) |
774 | { | 774 | { |
775 | if (optname == ICMP_FILTER) { | 775 | if (optname == ICMP_FILTER) { |
776 | if (inet_sk(sk)->num != IPPROTO_ICMP) | 776 | if (inet_sk(sk)->inet_num != IPPROTO_ICMP) |
777 | return -EOPNOTSUPP; | 777 | return -EOPNOTSUPP; |
778 | else | 778 | else |
779 | return raw_geticmpfilter(sk, optval, optlen); | 779 | return raw_geticmpfilter(sk, optval, optlen); |
@@ -932,10 +932,10 @@ EXPORT_SYMBOL_GPL(raw_seq_stop); | |||
932 | static void raw_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) | 932 | static void raw_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) |
933 | { | 933 | { |
934 | struct inet_sock *inet = inet_sk(sp); | 934 | struct inet_sock *inet = inet_sk(sp); |
935 | __be32 dest = inet->daddr, | 935 | __be32 dest = inet->inet_daddr, |
936 | src = inet->rcv_saddr; | 936 | src = inet->inet_rcv_saddr; |
937 | __u16 destp = 0, | 937 | __u16 destp = 0, |
938 | srcp = inet->num; | 938 | srcp = inet->inet_num; |
939 | 939 | ||
940 | seq_printf(seq, "%4d: %08X:%04X %08X:%04X" | 940 | seq_printf(seq, "%4d: %08X:%04X %08X:%04X" |
941 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n", | 941 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n", |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index cf13726259cd..206a291dff03 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -1998,7 +1998,7 @@ int tcp_disconnect(struct sock *sk, int flags) | |||
1998 | __skb_queue_purge(&sk->sk_async_wait_queue); | 1998 | __skb_queue_purge(&sk->sk_async_wait_queue); |
1999 | #endif | 1999 | #endif |
2000 | 2000 | ||
2001 | inet->dport = 0; | 2001 | inet->inet_dport = 0; |
2002 | 2002 | ||
2003 | if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK)) | 2003 | if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK)) |
2004 | inet_reset_saddr(sk); | 2004 | inet_reset_saddr(sk); |
@@ -2022,7 +2022,7 @@ int tcp_disconnect(struct sock *sk, int flags) | |||
2022 | memset(&tp->rx_opt, 0, sizeof(tp->rx_opt)); | 2022 | memset(&tp->rx_opt, 0, sizeof(tp->rx_opt)); |
2023 | __sk_dst_reset(sk); | 2023 | __sk_dst_reset(sk); |
2024 | 2024 | ||
2025 | WARN_ON(inet->num && !icsk->icsk_bind_hash); | 2025 | WARN_ON(inet->inet_num && !icsk->icsk_bind_hash); |
2026 | 2026 | ||
2027 | sk->sk_error_report(sk); | 2027 | sk->sk_error_report(sk); |
2028 | return err; | 2028 | return err; |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 99718703d040..a4a3390a5287 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -165,10 +165,10 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
165 | nexthop = inet->opt->faddr; | 165 | nexthop = inet->opt->faddr; |
166 | } | 166 | } |
167 | 167 | ||
168 | tmp = ip_route_connect(&rt, nexthop, inet->saddr, | 168 | tmp = ip_route_connect(&rt, nexthop, inet->inet_saddr, |
169 | RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, | 169 | RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, |
170 | IPPROTO_TCP, | 170 | IPPROTO_TCP, |
171 | inet->sport, usin->sin_port, sk, 1); | 171 | inet->inet_sport, usin->sin_port, sk, 1); |
172 | if (tmp < 0) { | 172 | if (tmp < 0) { |
173 | if (tmp == -ENETUNREACH) | 173 | if (tmp == -ENETUNREACH) |
174 | IP_INC_STATS_BH(sock_net(sk), IPSTATS_MIB_OUTNOROUTES); | 174 | IP_INC_STATS_BH(sock_net(sk), IPSTATS_MIB_OUTNOROUTES); |
@@ -183,11 +183,11 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
183 | if (!inet->opt || !inet->opt->srr) | 183 | if (!inet->opt || !inet->opt->srr) |
184 | daddr = rt->rt_dst; | 184 | daddr = rt->rt_dst; |
185 | 185 | ||
186 | if (!inet->saddr) | 186 | if (!inet->inet_saddr) |
187 | inet->saddr = rt->rt_src; | 187 | inet->inet_saddr = rt->rt_src; |
188 | inet->rcv_saddr = inet->saddr; | 188 | inet->inet_rcv_saddr = inet->inet_saddr; |
189 | 189 | ||
190 | if (tp->rx_opt.ts_recent_stamp && inet->daddr != daddr) { | 190 | if (tp->rx_opt.ts_recent_stamp && inet->inet_daddr != daddr) { |
191 | /* Reset inherited state */ | 191 | /* Reset inherited state */ |
192 | tp->rx_opt.ts_recent = 0; | 192 | tp->rx_opt.ts_recent = 0; |
193 | tp->rx_opt.ts_recent_stamp = 0; | 193 | tp->rx_opt.ts_recent_stamp = 0; |
@@ -210,8 +210,8 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
213 | inet->dport = usin->sin_port; | 213 | inet->inet_dport = usin->sin_port; |
214 | inet->daddr = daddr; | 214 | inet->inet_daddr = daddr; |
215 | 215 | ||
216 | inet_csk(sk)->icsk_ext_hdr_len = 0; | 216 | inet_csk(sk)->icsk_ext_hdr_len = 0; |
217 | if (inet->opt) | 217 | if (inet->opt) |
@@ -230,7 +230,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
230 | goto failure; | 230 | goto failure; |
231 | 231 | ||
232 | err = ip_route_newports(&rt, IPPROTO_TCP, | 232 | err = ip_route_newports(&rt, IPPROTO_TCP, |
233 | inet->sport, inet->dport, sk); | 233 | inet->inet_sport, inet->inet_dport, sk); |
234 | if (err) | 234 | if (err) |
235 | goto failure; | 235 | goto failure; |
236 | 236 | ||
@@ -239,12 +239,12 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
239 | sk_setup_caps(sk, &rt->u.dst); | 239 | sk_setup_caps(sk, &rt->u.dst); |
240 | 240 | ||
241 | if (!tp->write_seq) | 241 | if (!tp->write_seq) |
242 | tp->write_seq = secure_tcp_sequence_number(inet->saddr, | 242 | tp->write_seq = secure_tcp_sequence_number(inet->inet_saddr, |
243 | inet->daddr, | 243 | inet->inet_daddr, |
244 | inet->sport, | 244 | inet->inet_sport, |
245 | usin->sin_port); | 245 | usin->sin_port); |
246 | 246 | ||
247 | inet->id = tp->write_seq ^ jiffies; | 247 | inet->inet_id = tp->write_seq ^ jiffies; |
248 | 248 | ||
249 | err = tcp_connect(sk); | 249 | err = tcp_connect(sk); |
250 | rt = NULL; | 250 | rt = NULL; |
@@ -261,7 +261,7 @@ failure: | |||
261 | tcp_set_state(sk, TCP_CLOSE); | 261 | tcp_set_state(sk, TCP_CLOSE); |
262 | ip_rt_put(rt); | 262 | ip_rt_put(rt); |
263 | sk->sk_route_caps = 0; | 263 | sk->sk_route_caps = 0; |
264 | inet->dport = 0; | 264 | inet->inet_dport = 0; |
265 | return err; | 265 | return err; |
266 | } | 266 | } |
267 | 267 | ||
@@ -520,12 +520,13 @@ void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb) | |||
520 | struct tcphdr *th = tcp_hdr(skb); | 520 | struct tcphdr *th = tcp_hdr(skb); |
521 | 521 | ||
522 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 522 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
523 | th->check = ~tcp_v4_check(len, inet->saddr, | 523 | th->check = ~tcp_v4_check(len, inet->inet_saddr, |
524 | inet->daddr, 0); | 524 | inet->inet_daddr, 0); |
525 | skb->csum_start = skb_transport_header(skb) - skb->head; | 525 | skb->csum_start = skb_transport_header(skb) - skb->head; |
526 | skb->csum_offset = offsetof(struct tcphdr, check); | 526 | skb->csum_offset = offsetof(struct tcphdr, check); |
527 | } else { | 527 | } else { |
528 | th->check = tcp_v4_check(len, inet->saddr, inet->daddr, | 528 | th->check = tcp_v4_check(len, inet->inet_saddr, |
529 | inet->inet_daddr, | ||
529 | csum_partial(th, | 530 | csum_partial(th, |
530 | th->doff << 2, | 531 | th->doff << 2, |
531 | skb->csum)); | 532 | skb->csum)); |
@@ -848,7 +849,7 @@ static struct tcp_md5sig_key * | |||
848 | struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, | 849 | struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, |
849 | struct sock *addr_sk) | 850 | struct sock *addr_sk) |
850 | { | 851 | { |
851 | return tcp_v4_md5_do_lookup(sk, inet_sk(addr_sk)->daddr); | 852 | return tcp_v4_md5_do_lookup(sk, inet_sk(addr_sk)->inet_daddr); |
852 | } | 853 | } |
853 | 854 | ||
854 | EXPORT_SYMBOL(tcp_v4_md5_lookup); | 855 | EXPORT_SYMBOL(tcp_v4_md5_lookup); |
@@ -923,7 +924,7 @@ EXPORT_SYMBOL(tcp_v4_md5_do_add); | |||
923 | static int tcp_v4_md5_add_func(struct sock *sk, struct sock *addr_sk, | 924 | static int tcp_v4_md5_add_func(struct sock *sk, struct sock *addr_sk, |
924 | u8 *newkey, u8 newkeylen) | 925 | u8 *newkey, u8 newkeylen) |
925 | { | 926 | { |
926 | return tcp_v4_md5_do_add(sk, inet_sk(addr_sk)->daddr, | 927 | return tcp_v4_md5_do_add(sk, inet_sk(addr_sk)->inet_daddr, |
927 | newkey, newkeylen); | 928 | newkey, newkeylen); |
928 | } | 929 | } |
929 | 930 | ||
@@ -1089,8 +1090,8 @@ int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, | |||
1089 | __be32 saddr, daddr; | 1090 | __be32 saddr, daddr; |
1090 | 1091 | ||
1091 | if (sk) { | 1092 | if (sk) { |
1092 | saddr = inet_sk(sk)->saddr; | 1093 | saddr = inet_sk(sk)->inet_saddr; |
1093 | daddr = inet_sk(sk)->daddr; | 1094 | daddr = inet_sk(sk)->inet_daddr; |
1094 | } else if (req) { | 1095 | } else if (req) { |
1095 | saddr = inet_rsk(req)->loc_addr; | 1096 | saddr = inet_rsk(req)->loc_addr; |
1096 | daddr = inet_rsk(req)->rmt_addr; | 1097 | daddr = inet_rsk(req)->rmt_addr; |
@@ -1380,9 +1381,9 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1380 | newtp = tcp_sk(newsk); | 1381 | newtp = tcp_sk(newsk); |
1381 | newinet = inet_sk(newsk); | 1382 | newinet = inet_sk(newsk); |
1382 | ireq = inet_rsk(req); | 1383 | ireq = inet_rsk(req); |
1383 | newinet->daddr = ireq->rmt_addr; | 1384 | newinet->inet_daddr = ireq->rmt_addr; |
1384 | newinet->rcv_saddr = ireq->loc_addr; | 1385 | newinet->inet_rcv_saddr = ireq->loc_addr; |
1385 | newinet->saddr = ireq->loc_addr; | 1386 | newinet->inet_saddr = ireq->loc_addr; |
1386 | newinet->opt = ireq->opt; | 1387 | newinet->opt = ireq->opt; |
1387 | ireq->opt = NULL; | 1388 | ireq->opt = NULL; |
1388 | newinet->mc_index = inet_iif(skb); | 1389 | newinet->mc_index = inet_iif(skb); |
@@ -1390,7 +1391,7 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1390 | inet_csk(newsk)->icsk_ext_hdr_len = 0; | 1391 | inet_csk(newsk)->icsk_ext_hdr_len = 0; |
1391 | if (newinet->opt) | 1392 | if (newinet->opt) |
1392 | inet_csk(newsk)->icsk_ext_hdr_len = newinet->opt->optlen; | 1393 | inet_csk(newsk)->icsk_ext_hdr_len = newinet->opt->optlen; |
1393 | newinet->id = newtp->write_seq ^ jiffies; | 1394 | newinet->inet_id = newtp->write_seq ^ jiffies; |
1394 | 1395 | ||
1395 | tcp_mtup_init(newsk); | 1396 | tcp_mtup_init(newsk); |
1396 | tcp_sync_mss(newsk, dst_mtu(dst)); | 1397 | tcp_sync_mss(newsk, dst_mtu(dst)); |
@@ -1403,7 +1404,8 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1403 | 1404 | ||
1404 | #ifdef CONFIG_TCP_MD5SIG | 1405 | #ifdef CONFIG_TCP_MD5SIG |
1405 | /* Copy over the MD5 key from the original socket */ | 1406 | /* Copy over the MD5 key from the original socket */ |
1406 | if ((key = tcp_v4_md5_do_lookup(sk, newinet->daddr)) != NULL) { | 1407 | key = tcp_v4_md5_do_lookup(sk, newinet->inet_daddr); |
1408 | if (key != NULL) { | ||
1407 | /* | 1409 | /* |
1408 | * We're using one, so create a matching key | 1410 | * We're using one, so create a matching key |
1409 | * on the newsk structure. If we fail to get | 1411 | * on the newsk structure. If we fail to get |
@@ -1412,7 +1414,7 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1412 | */ | 1414 | */ |
1413 | char *newkey = kmemdup(key->key, key->keylen, GFP_ATOMIC); | 1415 | char *newkey = kmemdup(key->key, key->keylen, GFP_ATOMIC); |
1414 | if (newkey != NULL) | 1416 | if (newkey != NULL) |
1415 | tcp_v4_md5_do_add(newsk, newinet->daddr, | 1417 | tcp_v4_md5_do_add(newsk, newinet->inet_daddr, |
1416 | newkey, key->keylen); | 1418 | newkey, key->keylen); |
1417 | newsk->sk_route_caps &= ~NETIF_F_GSO_MASK; | 1419 | newsk->sk_route_caps &= ~NETIF_F_GSO_MASK; |
1418 | } | 1420 | } |
@@ -1711,8 +1713,8 @@ int tcp_v4_remember_stamp(struct sock *sk) | |||
1711 | struct inet_peer *peer = NULL; | 1713 | struct inet_peer *peer = NULL; |
1712 | int release_it = 0; | 1714 | int release_it = 0; |
1713 | 1715 | ||
1714 | if (!rt || rt->rt_dst != inet->daddr) { | 1716 | if (!rt || rt->rt_dst != inet->inet_daddr) { |
1715 | peer = inet_getpeer(inet->daddr, 1); | 1717 | peer = inet_getpeer(inet->inet_daddr, 1); |
1716 | release_it = 1; | 1718 | release_it = 1; |
1717 | } else { | 1719 | } else { |
1718 | if (!rt->peer) | 1720 | if (!rt->peer) |
@@ -2225,7 +2227,7 @@ static void get_openreq4(struct sock *sk, struct request_sock *req, | |||
2225 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %u %d %p%n", | 2227 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %u %d %p%n", |
2226 | i, | 2228 | i, |
2227 | ireq->loc_addr, | 2229 | ireq->loc_addr, |
2228 | ntohs(inet_sk(sk)->sport), | 2230 | ntohs(inet_sk(sk)->inet_sport), |
2229 | ireq->rmt_addr, | 2231 | ireq->rmt_addr, |
2230 | ntohs(ireq->rmt_port), | 2232 | ntohs(ireq->rmt_port), |
2231 | TCP_SYN_RECV, | 2233 | TCP_SYN_RECV, |
@@ -2248,10 +2250,10 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len) | |||
2248 | struct tcp_sock *tp = tcp_sk(sk); | 2250 | struct tcp_sock *tp = tcp_sk(sk); |
2249 | const struct inet_connection_sock *icsk = inet_csk(sk); | 2251 | const struct inet_connection_sock *icsk = inet_csk(sk); |
2250 | struct inet_sock *inet = inet_sk(sk); | 2252 | struct inet_sock *inet = inet_sk(sk); |
2251 | __be32 dest = inet->daddr; | 2253 | __be32 dest = inet->inet_daddr; |
2252 | __be32 src = inet->rcv_saddr; | 2254 | __be32 src = inet->inet_rcv_saddr; |
2253 | __u16 destp = ntohs(inet->dport); | 2255 | __u16 destp = ntohs(inet->inet_dport); |
2254 | __u16 srcp = ntohs(inet->sport); | 2256 | __u16 srcp = ntohs(inet->inet_sport); |
2255 | 2257 | ||
2256 | if (icsk->icsk_pending == ICSK_TIME_RETRANS) { | 2258 | if (icsk->icsk_pending == ICSK_TIME_RETRANS) { |
2257 | timer_active = 1; | 2259 | timer_active = 1; |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index fcd278a7080e..2e2eb74ac4cc 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -661,8 +661,8 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
661 | 661 | ||
662 | /* Build TCP header and checksum it. */ | 662 | /* Build TCP header and checksum it. */ |
663 | th = tcp_hdr(skb); | 663 | th = tcp_hdr(skb); |
664 | th->source = inet->sport; | 664 | th->source = inet->inet_sport; |
665 | th->dest = inet->dport; | 665 | th->dest = inet->inet_dport; |
666 | th->seq = htonl(tcb->seq); | 666 | th->seq = htonl(tcb->seq); |
667 | th->ack_seq = htonl(tp->rcv_nxt); | 667 | th->ack_seq = htonl(tp->rcv_nxt); |
668 | *(((__be16 *)th) + 6) = htons(((tcp_header_size >> 2) << 12) | | 668 | *(((__be16 *)th) + 6) = htons(((tcp_header_size >> 2) << 12) | |
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c index 59f5b5e7c566..7a3cc2ffad84 100644 --- a/net/ipv4/tcp_probe.c +++ b/net/ipv4/tcp_probe.c | |||
@@ -94,7 +94,8 @@ static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb, | |||
94 | const struct inet_sock *inet = inet_sk(sk); | 94 | const struct inet_sock *inet = inet_sk(sk); |
95 | 95 | ||
96 | /* Only update if port matches */ | 96 | /* Only update if port matches */ |
97 | if ((port == 0 || ntohs(inet->dport) == port || ntohs(inet->sport) == port) | 97 | if ((port == 0 || ntohs(inet->inet_dport) == port || |
98 | ntohs(inet->inet_sport) == port) | ||
98 | && (full || tp->snd_cwnd != tcp_probe.lastcwnd)) { | 99 | && (full || tp->snd_cwnd != tcp_probe.lastcwnd)) { |
99 | 100 | ||
100 | spin_lock(&tcp_probe.lock); | 101 | spin_lock(&tcp_probe.lock); |
@@ -103,10 +104,10 @@ static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb, | |||
103 | struct tcp_log *p = tcp_probe.log + tcp_probe.head; | 104 | struct tcp_log *p = tcp_probe.log + tcp_probe.head; |
104 | 105 | ||
105 | p->tstamp = ktime_get(); | 106 | p->tstamp = ktime_get(); |
106 | p->saddr = inet->saddr; | 107 | p->saddr = inet->inet_saddr; |
107 | p->sport = inet->sport; | 108 | p->sport = inet->inet_sport; |
108 | p->daddr = inet->daddr; | 109 | p->daddr = inet->inet_daddr; |
109 | p->dport = inet->dport; | 110 | p->dport = inet->inet_dport; |
110 | p->length = skb->len; | 111 | p->length = skb->len; |
111 | p->snd_nxt = tp->snd_nxt; | 112 | p->snd_nxt = tp->snd_nxt; |
112 | p->snd_una = tp->snd_una; | 113 | p->snd_una = tp->snd_una; |
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index cdb2ca7684d4..6e8996cb79d0 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c | |||
@@ -303,15 +303,15 @@ void tcp_retransmit_timer(struct sock *sk) | |||
303 | struct inet_sock *inet = inet_sk(sk); | 303 | struct inet_sock *inet = inet_sk(sk); |
304 | if (sk->sk_family == AF_INET) { | 304 | if (sk->sk_family == AF_INET) { |
305 | LIMIT_NETDEBUG(KERN_DEBUG "TCP: Peer %pI4:%u/%u unexpectedly shrunk window %u:%u (repaired)\n", | 305 | LIMIT_NETDEBUG(KERN_DEBUG "TCP: Peer %pI4:%u/%u unexpectedly shrunk window %u:%u (repaired)\n", |
306 | &inet->daddr, ntohs(inet->dport), | 306 | &inet->inet_daddr, ntohs(inet->inet_dport), |
307 | inet->num, tp->snd_una, tp->snd_nxt); | 307 | inet->inet_num, tp->snd_una, tp->snd_nxt); |
308 | } | 308 | } |
309 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 309 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
310 | else if (sk->sk_family == AF_INET6) { | 310 | else if (sk->sk_family == AF_INET6) { |
311 | struct ipv6_pinfo *np = inet6_sk(sk); | 311 | struct ipv6_pinfo *np = inet6_sk(sk); |
312 | LIMIT_NETDEBUG(KERN_DEBUG "TCP: Peer %pI6:%u/%u unexpectedly shrunk window %u:%u (repaired)\n", | 312 | LIMIT_NETDEBUG(KERN_DEBUG "TCP: Peer %pI6:%u/%u unexpectedly shrunk window %u:%u (repaired)\n", |
313 | &np->daddr, ntohs(inet->dport), | 313 | &np->daddr, ntohs(inet->inet_dport), |
314 | inet->num, tp->snd_una, tp->snd_nxt); | 314 | inet->inet_num, tp->snd_una, tp->snd_nxt); |
315 | } | 315 | } |
316 | #endif | 316 | #endif |
317 | #endif | 317 | #endif |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 45a8a7e374d8..ec5c7a720c0c 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -214,7 +214,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum, | |||
214 | goto fail_unlock; | 214 | goto fail_unlock; |
215 | } | 215 | } |
216 | found: | 216 | found: |
217 | inet_sk(sk)->num = snum; | 217 | inet_sk(sk)->inet_num = snum; |
218 | sk->sk_hash = snum; | 218 | sk->sk_hash = snum; |
219 | if (sk_unhashed(sk)) { | 219 | if (sk_unhashed(sk)) { |
220 | sk_nulls_add_node_rcu(sk, &hslot->head); | 220 | sk_nulls_add_node_rcu(sk, &hslot->head); |
@@ -233,8 +233,8 @@ static int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2) | |||
233 | struct inet_sock *inet1 = inet_sk(sk1), *inet2 = inet_sk(sk2); | 233 | struct inet_sock *inet1 = inet_sk(sk1), *inet2 = inet_sk(sk2); |
234 | 234 | ||
235 | return (!ipv6_only_sock(sk2) && | 235 | return (!ipv6_only_sock(sk2) && |
236 | (!inet1->rcv_saddr || !inet2->rcv_saddr || | 236 | (!inet1->inet_rcv_saddr || !inet2->inet_rcv_saddr || |
237 | inet1->rcv_saddr == inet2->rcv_saddr)); | 237 | inet1->inet_rcv_saddr == inet2->inet_rcv_saddr)); |
238 | } | 238 | } |
239 | 239 | ||
240 | int udp_v4_get_port(struct sock *sk, unsigned short snum) | 240 | int udp_v4_get_port(struct sock *sk, unsigned short snum) |
@@ -253,18 +253,18 @@ static inline int compute_score(struct sock *sk, struct net *net, __be32 saddr, | |||
253 | struct inet_sock *inet = inet_sk(sk); | 253 | struct inet_sock *inet = inet_sk(sk); |
254 | 254 | ||
255 | score = (sk->sk_family == PF_INET ? 1 : 0); | 255 | score = (sk->sk_family == PF_INET ? 1 : 0); |
256 | if (inet->rcv_saddr) { | 256 | if (inet->inet_rcv_saddr) { |
257 | if (inet->rcv_saddr != daddr) | 257 | if (inet->inet_rcv_saddr != daddr) |
258 | return -1; | 258 | return -1; |
259 | score += 2; | 259 | score += 2; |
260 | } | 260 | } |
261 | if (inet->daddr) { | 261 | if (inet->inet_daddr) { |
262 | if (inet->daddr != saddr) | 262 | if (inet->inet_daddr != saddr) |
263 | return -1; | 263 | return -1; |
264 | score += 2; | 264 | score += 2; |
265 | } | 265 | } |
266 | if (inet->dport) { | 266 | if (inet->inet_dport) { |
267 | if (inet->dport != sport) | 267 | if (inet->inet_dport != sport) |
268 | return -1; | 268 | return -1; |
269 | score += 2; | 269 | score += 2; |
270 | } | 270 | } |
@@ -360,9 +360,10 @@ static inline struct sock *udp_v4_mcast_next(struct net *net, struct sock *sk, | |||
360 | 360 | ||
361 | if (!net_eq(sock_net(s), net) || | 361 | if (!net_eq(sock_net(s), net) || |
362 | s->sk_hash != hnum || | 362 | s->sk_hash != hnum || |
363 | (inet->daddr && inet->daddr != rmt_addr) || | 363 | (inet->inet_daddr && inet->inet_daddr != rmt_addr) || |
364 | (inet->dport != rmt_port && inet->dport) || | 364 | (inet->inet_dport != rmt_port && inet->inet_dport) || |
365 | (inet->rcv_saddr && inet->rcv_saddr != loc_addr) || | 365 | (inet->inet_rcv_saddr && |
366 | inet->inet_rcv_saddr != loc_addr) || | ||
366 | ipv6_only_sock(s) || | 367 | ipv6_only_sock(s) || |
367 | (s->sk_bound_dev_if && s->sk_bound_dev_if != dif)) | 368 | (s->sk_bound_dev_if && s->sk_bound_dev_if != dif)) |
368 | continue; | 369 | continue; |
@@ -646,14 +647,14 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
646 | } else { | 647 | } else { |
647 | if (sk->sk_state != TCP_ESTABLISHED) | 648 | if (sk->sk_state != TCP_ESTABLISHED) |
648 | return -EDESTADDRREQ; | 649 | return -EDESTADDRREQ; |
649 | daddr = inet->daddr; | 650 | daddr = inet->inet_daddr; |
650 | dport = inet->dport; | 651 | dport = inet->inet_dport; |
651 | /* Open fast path for connected socket. | 652 | /* Open fast path for connected socket. |
652 | Route will not be used, if at least one option is set. | 653 | Route will not be used, if at least one option is set. |
653 | */ | 654 | */ |
654 | connected = 1; | 655 | connected = 1; |
655 | } | 656 | } |
656 | ipc.addr = inet->saddr; | 657 | ipc.addr = inet->inet_saddr; |
657 | 658 | ||
658 | ipc.oif = sk->sk_bound_dev_if; | 659 | ipc.oif = sk->sk_bound_dev_if; |
659 | err = sock_tx_timestamp(msg, sk, &ipc.shtx); | 660 | err = sock_tx_timestamp(msg, sk, &ipc.shtx); |
@@ -708,7 +709,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
708 | .proto = sk->sk_protocol, | 709 | .proto = sk->sk_protocol, |
709 | .flags = inet_sk_flowi_flags(sk), | 710 | .flags = inet_sk_flowi_flags(sk), |
710 | .uli_u = { .ports = | 711 | .uli_u = { .ports = |
711 | { .sport = inet->sport, | 712 | { .sport = inet->inet_sport, |
712 | .dport = dport } } }; | 713 | .dport = dport } } }; |
713 | struct net *net = sock_net(sk); | 714 | struct net *net = sock_net(sk); |
714 | 715 | ||
@@ -752,7 +753,7 @@ back_from_confirm: | |||
752 | inet->cork.fl.fl4_dst = daddr; | 753 | inet->cork.fl.fl4_dst = daddr; |
753 | inet->cork.fl.fl_ip_dport = dport; | 754 | inet->cork.fl.fl_ip_dport = dport; |
754 | inet->cork.fl.fl4_src = saddr; | 755 | inet->cork.fl.fl4_src = saddr; |
755 | inet->cork.fl.fl_ip_sport = inet->sport; | 756 | inet->cork.fl.fl_ip_sport = inet->inet_sport; |
756 | up->pending = AF_INET; | 757 | up->pending = AF_INET; |
757 | 758 | ||
758 | do_append_data: | 759 | do_append_data: |
@@ -1029,15 +1030,15 @@ int udp_disconnect(struct sock *sk, int flags) | |||
1029 | */ | 1030 | */ |
1030 | 1031 | ||
1031 | sk->sk_state = TCP_CLOSE; | 1032 | sk->sk_state = TCP_CLOSE; |
1032 | inet->daddr = 0; | 1033 | inet->inet_daddr = 0; |
1033 | inet->dport = 0; | 1034 | inet->inet_dport = 0; |
1034 | sk->sk_bound_dev_if = 0; | 1035 | sk->sk_bound_dev_if = 0; |
1035 | if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK)) | 1036 | if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK)) |
1036 | inet_reset_saddr(sk); | 1037 | inet_reset_saddr(sk); |
1037 | 1038 | ||
1038 | if (!(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) { | 1039 | if (!(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) { |
1039 | sk->sk_prot->unhash(sk); | 1040 | sk->sk_prot->unhash(sk); |
1040 | inet->sport = 0; | 1041 | inet->inet_sport = 0; |
1041 | } | 1042 | } |
1042 | sk_dst_reset(sk); | 1043 | sk_dst_reset(sk); |
1043 | return 0; | 1044 | return 0; |
@@ -1053,7 +1054,7 @@ void udp_lib_unhash(struct sock *sk) | |||
1053 | 1054 | ||
1054 | spin_lock_bh(&hslot->lock); | 1055 | spin_lock_bh(&hslot->lock); |
1055 | if (sk_nulls_del_node_init_rcu(sk)) { | 1056 | if (sk_nulls_del_node_init_rcu(sk)) { |
1056 | inet_sk(sk)->num = 0; | 1057 | inet_sk(sk)->inet_num = 0; |
1057 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); | 1058 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); |
1058 | } | 1059 | } |
1059 | spin_unlock_bh(&hslot->lock); | 1060 | spin_unlock_bh(&hslot->lock); |
@@ -1752,10 +1753,10 @@ static void udp4_format_sock(struct sock *sp, struct seq_file *f, | |||
1752 | int bucket, int *len) | 1753 | int bucket, int *len) |
1753 | { | 1754 | { |
1754 | struct inet_sock *inet = inet_sk(sp); | 1755 | struct inet_sock *inet = inet_sk(sp); |
1755 | __be32 dest = inet->daddr; | 1756 | __be32 dest = inet->inet_daddr; |
1756 | __be32 src = inet->rcv_saddr; | 1757 | __be32 src = inet->inet_rcv_saddr; |
1757 | __u16 destp = ntohs(inet->dport); | 1758 | __u16 destp = ntohs(inet->inet_dport); |
1758 | __u16 srcp = ntohs(inet->sport); | 1759 | __u16 srcp = ntohs(inet->inet_sport); |
1759 | 1760 | ||
1760 | seq_printf(f, "%5d: %08X:%04X %08X:%04X" | 1761 | seq_printf(f, "%5d: %08X:%04X %08X:%04X" |
1761 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d%n", | 1762 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d%n", |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 94216519873c..b6d058818673 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -185,7 +185,7 @@ lookup_protocol: | |||
185 | inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0; | 185 | inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0; |
186 | 186 | ||
187 | if (SOCK_RAW == sock->type) { | 187 | if (SOCK_RAW == sock->type) { |
188 | inet->num = protocol; | 188 | inet->inet_num = protocol; |
189 | if (IPPROTO_RAW == protocol) | 189 | if (IPPROTO_RAW == protocol) |
190 | inet->hdrincl = 1; | 190 | inet->hdrincl = 1; |
191 | } | 191 | } |
@@ -228,12 +228,12 @@ lookup_protocol: | |||
228 | */ | 228 | */ |
229 | sk_refcnt_debug_inc(sk); | 229 | sk_refcnt_debug_inc(sk); |
230 | 230 | ||
231 | if (inet->num) { | 231 | if (inet->inet_num) { |
232 | /* It assumes that any protocol which allows | 232 | /* It assumes that any protocol which allows |
233 | * the user to assign a number at socket | 233 | * the user to assign a number at socket |
234 | * creation time automatically shares. | 234 | * creation time automatically shares. |
235 | */ | 235 | */ |
236 | inet->sport = htons(inet->num); | 236 | inet->inet_sport = htons(inet->inet_num); |
237 | sk->sk_prot->hash(sk); | 237 | sk->sk_prot->hash(sk); |
238 | } | 238 | } |
239 | if (sk->sk_prot->init) { | 239 | if (sk->sk_prot->init) { |
@@ -281,7 +281,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
281 | lock_sock(sk); | 281 | lock_sock(sk); |
282 | 282 | ||
283 | /* Check these errors (active socket, double bind). */ | 283 | /* Check these errors (active socket, double bind). */ |
284 | if (sk->sk_state != TCP_CLOSE || inet->num) { | 284 | if (sk->sk_state != TCP_CLOSE || inet->inet_num) { |
285 | err = -EINVAL; | 285 | err = -EINVAL; |
286 | goto out; | 286 | goto out; |
287 | } | 287 | } |
@@ -353,8 +353,8 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
353 | } | 353 | } |
354 | } | 354 | } |
355 | 355 | ||
356 | inet->rcv_saddr = v4addr; | 356 | inet->inet_rcv_saddr = v4addr; |
357 | inet->saddr = v4addr; | 357 | inet->inet_saddr = v4addr; |
358 | 358 | ||
359 | ipv6_addr_copy(&np->rcv_saddr, &addr->sin6_addr); | 359 | ipv6_addr_copy(&np->rcv_saddr, &addr->sin6_addr); |
360 | 360 | ||
@@ -375,9 +375,9 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
375 | } | 375 | } |
376 | if (snum) | 376 | if (snum) |
377 | sk->sk_userlocks |= SOCK_BINDPORT_LOCK; | 377 | sk->sk_userlocks |= SOCK_BINDPORT_LOCK; |
378 | inet->sport = htons(inet->num); | 378 | inet->inet_sport = htons(inet->inet_num); |
379 | inet->dport = 0; | 379 | inet->inet_dport = 0; |
380 | inet->daddr = 0; | 380 | inet->inet_daddr = 0; |
381 | out: | 381 | out: |
382 | release_sock(sk); | 382 | release_sock(sk); |
383 | return err; | 383 | return err; |
@@ -441,12 +441,12 @@ int inet6_getname(struct socket *sock, struct sockaddr *uaddr, | |||
441 | sin->sin6_flowinfo = 0; | 441 | sin->sin6_flowinfo = 0; |
442 | sin->sin6_scope_id = 0; | 442 | sin->sin6_scope_id = 0; |
443 | if (peer) { | 443 | if (peer) { |
444 | if (!inet->dport) | 444 | if (!inet->inet_dport) |
445 | return -ENOTCONN; | 445 | return -ENOTCONN; |
446 | if (((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_SYN_SENT)) && | 446 | if (((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_SYN_SENT)) && |
447 | peer == 1) | 447 | peer == 1) |
448 | return -ENOTCONN; | 448 | return -ENOTCONN; |
449 | sin->sin6_port = inet->dport; | 449 | sin->sin6_port = inet->inet_dport; |
450 | ipv6_addr_copy(&sin->sin6_addr, &np->daddr); | 450 | ipv6_addr_copy(&sin->sin6_addr, &np->daddr); |
451 | if (np->sndflow) | 451 | if (np->sndflow) |
452 | sin->sin6_flowinfo = np->flow_label; | 452 | sin->sin6_flowinfo = np->flow_label; |
@@ -456,7 +456,7 @@ int inet6_getname(struct socket *sock, struct sockaddr *uaddr, | |||
456 | else | 456 | else |
457 | ipv6_addr_copy(&sin->sin6_addr, &np->rcv_saddr); | 457 | ipv6_addr_copy(&sin->sin6_addr, &np->rcv_saddr); |
458 | 458 | ||
459 | sin->sin6_port = inet->sport; | 459 | sin->sin6_port = inet->inet_sport; |
460 | } | 460 | } |
461 | if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) | 461 | if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) |
462 | sin->sin6_scope_id = sk->sk_bound_dev_if; | 462 | sin->sin6_scope_id = sk->sk_bound_dev_if; |
@@ -655,8 +655,8 @@ int inet6_sk_rebuild_header(struct sock *sk) | |||
655 | fl.fl6_flowlabel = np->flow_label; | 655 | fl.fl6_flowlabel = np->flow_label; |
656 | fl.oif = sk->sk_bound_dev_if; | 656 | fl.oif = sk->sk_bound_dev_if; |
657 | fl.mark = sk->sk_mark; | 657 | fl.mark = sk->sk_mark; |
658 | fl.fl_ip_dport = inet->dport; | 658 | fl.fl_ip_dport = inet->inet_dport; |
659 | fl.fl_ip_sport = inet->sport; | 659 | fl.fl_ip_sport = inet->inet_sport; |
660 | security_sk_classify_flow(sk, &fl); | 660 | security_sk_classify_flow(sk, &fl); |
661 | 661 | ||
662 | if (np->opt && np->opt->srcrt) { | 662 | if (np->opt && np->opt->srcrt) { |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index dbfec7147aa5..9f70452a69e7 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
@@ -98,13 +98,14 @@ ipv4_connected: | |||
98 | if (err) | 98 | if (err) |
99 | goto out; | 99 | goto out; |
100 | 100 | ||
101 | ipv6_addr_set_v4mapped(inet->daddr, &np->daddr); | 101 | ipv6_addr_set_v4mapped(inet->inet_daddr, &np->daddr); |
102 | 102 | ||
103 | if (ipv6_addr_any(&np->saddr)) | 103 | if (ipv6_addr_any(&np->saddr)) |
104 | ipv6_addr_set_v4mapped(inet->saddr, &np->saddr); | 104 | ipv6_addr_set_v4mapped(inet->inet_saddr, &np->saddr); |
105 | 105 | ||
106 | if (ipv6_addr_any(&np->rcv_saddr)) | 106 | if (ipv6_addr_any(&np->rcv_saddr)) |
107 | ipv6_addr_set_v4mapped(inet->rcv_saddr, &np->rcv_saddr); | 107 | ipv6_addr_set_v4mapped(inet->inet_rcv_saddr, |
108 | &np->rcv_saddr); | ||
108 | 109 | ||
109 | goto out; | 110 | goto out; |
110 | } | 111 | } |
@@ -133,7 +134,7 @@ ipv4_connected: | |||
133 | ipv6_addr_copy(&np->daddr, daddr); | 134 | ipv6_addr_copy(&np->daddr, daddr); |
134 | np->flow_label = fl.fl6_flowlabel; | 135 | np->flow_label = fl.fl6_flowlabel; |
135 | 136 | ||
136 | inet->dport = usin->sin6_port; | 137 | inet->inet_dport = usin->sin6_port; |
137 | 138 | ||
138 | /* | 139 | /* |
139 | * Check for a route to destination an obtain the | 140 | * Check for a route to destination an obtain the |
@@ -145,8 +146,8 @@ ipv4_connected: | |||
145 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); | 146 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); |
146 | fl.oif = sk->sk_bound_dev_if; | 147 | fl.oif = sk->sk_bound_dev_if; |
147 | fl.mark = sk->sk_mark; | 148 | fl.mark = sk->sk_mark; |
148 | fl.fl_ip_dport = inet->dport; | 149 | fl.fl_ip_dport = inet->inet_dport; |
149 | fl.fl_ip_sport = inet->sport; | 150 | fl.fl_ip_sport = inet->inet_sport; |
150 | 151 | ||
151 | if (!fl.oif && (addr_type&IPV6_ADDR_MULTICAST)) | 152 | if (!fl.oif && (addr_type&IPV6_ADDR_MULTICAST)) |
152 | fl.oif = np->mcast_oif; | 153 | fl.oif = np->mcast_oif; |
@@ -188,7 +189,7 @@ ipv4_connected: | |||
188 | 189 | ||
189 | if (ipv6_addr_any(&np->rcv_saddr)) { | 190 | if (ipv6_addr_any(&np->rcv_saddr)) { |
190 | ipv6_addr_copy(&np->rcv_saddr, &fl.fl6_src); | 191 | ipv6_addr_copy(&np->rcv_saddr, &fl.fl6_src); |
191 | inet->rcv_saddr = LOOPBACK4_IPV6; | 192 | inet->inet_rcv_saddr = LOOPBACK4_IPV6; |
192 | } | 193 | } |
193 | 194 | ||
194 | ip6_dst_store(sk, dst, | 195 | ip6_dst_store(sk, dst, |
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index a9f4a21b31ea..19dceef4fcca 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
@@ -132,7 +132,7 @@ void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr * uaddr) | |||
132 | 132 | ||
133 | sin6->sin6_family = AF_INET6; | 133 | sin6->sin6_family = AF_INET6; |
134 | ipv6_addr_copy(&sin6->sin6_addr, &np->daddr); | 134 | ipv6_addr_copy(&sin6->sin6_addr, &np->daddr); |
135 | sin6->sin6_port = inet_sk(sk)->dport; | 135 | sin6->sin6_port = inet_sk(sk)->inet_dport; |
136 | /* We do not store received flowlabel for TCP */ | 136 | /* We do not store received flowlabel for TCP */ |
137 | sin6->sin6_flowinfo = 0; | 137 | sin6->sin6_flowinfo = 0; |
138 | sin6->sin6_scope_id = 0; | 138 | sin6->sin6_scope_id = 0; |
@@ -195,8 +195,8 @@ int inet6_csk_xmit(struct sk_buff *skb, int ipfragok) | |||
195 | IP6_ECN_flow_xmit(sk, fl.fl6_flowlabel); | 195 | IP6_ECN_flow_xmit(sk, fl.fl6_flowlabel); |
196 | fl.oif = sk->sk_bound_dev_if; | 196 | fl.oif = sk->sk_bound_dev_if; |
197 | fl.mark = sk->sk_mark; | 197 | fl.mark = sk->sk_mark; |
198 | fl.fl_ip_sport = inet->sport; | 198 | fl.fl_ip_sport = inet->inet_sport; |
199 | fl.fl_ip_dport = inet->dport; | 199 | fl.fl_ip_dport = inet->inet_dport; |
200 | security_sk_classify_flow(sk, &fl); | 200 | security_sk_classify_flow(sk, &fl); |
201 | 201 | ||
202 | if (np->opt && np->opt->srcrt) { | 202 | if (np->opt && np->opt->srcrt) { |
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index 874aed86e1a2..00c6a3e6cddf 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c | |||
@@ -125,7 +125,7 @@ static int inline compute_score(struct sock *sk, struct net *net, | |||
125 | { | 125 | { |
126 | int score = -1; | 126 | int score = -1; |
127 | 127 | ||
128 | if (net_eq(sock_net(sk), net) && inet_sk(sk)->num == hnum && | 128 | if (net_eq(sock_net(sk), net) && inet_sk(sk)->inet_num == hnum && |
129 | sk->sk_family == PF_INET6) { | 129 | sk->sk_family == PF_INET6) { |
130 | const struct ipv6_pinfo *np = inet6_sk(sk); | 130 | const struct ipv6_pinfo *np = inet6_sk(sk); |
131 | 131 | ||
@@ -214,10 +214,10 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row, | |||
214 | const struct in6_addr *daddr = &np->rcv_saddr; | 214 | const struct in6_addr *daddr = &np->rcv_saddr; |
215 | const struct in6_addr *saddr = &np->daddr; | 215 | const struct in6_addr *saddr = &np->daddr; |
216 | const int dif = sk->sk_bound_dev_if; | 216 | const int dif = sk->sk_bound_dev_if; |
217 | const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport); | 217 | const __portpair ports = INET_COMBINED_PORTS(inet->inet_dport, lport); |
218 | struct net *net = sock_net(sk); | 218 | struct net *net = sock_net(sk); |
219 | const unsigned int hash = inet6_ehashfn(net, daddr, lport, saddr, | 219 | const unsigned int hash = inet6_ehashfn(net, daddr, lport, saddr, |
220 | inet->dport); | 220 | inet->inet_dport); |
221 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); | 221 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); |
222 | spinlock_t *lock = inet_ehash_lockp(hinfo, hash); | 222 | spinlock_t *lock = inet_ehash_lockp(hinfo, hash); |
223 | struct sock *sk2; | 223 | struct sock *sk2; |
@@ -248,8 +248,8 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row, | |||
248 | unique: | 248 | unique: |
249 | /* Must record num and sport now. Otherwise we will see | 249 | /* Must record num and sport now. Otherwise we will see |
250 | * in hash table socket with a funny identity. */ | 250 | * in hash table socket with a funny identity. */ |
251 | inet->num = lport; | 251 | inet->inet_num = lport; |
252 | inet->sport = htons(lport); | 252 | inet->inet_sport = htons(lport); |
253 | WARN_ON(!sk_unhashed(sk)); | 253 | WARN_ON(!sk_unhashed(sk)); |
254 | __sk_nulls_add_node_rcu(sk, &head->chain); | 254 | __sk_nulls_add_node_rcu(sk, &head->chain); |
255 | sk->sk_hash = hash; | 255 | sk->sk_hash = hash; |
@@ -279,7 +279,7 @@ static inline u32 inet6_sk_port_offset(const struct sock *sk) | |||
279 | const struct ipv6_pinfo *np = inet6_sk(sk); | 279 | const struct ipv6_pinfo *np = inet6_sk(sk); |
280 | return secure_ipv6_port_ephemeral(np->rcv_saddr.s6_addr32, | 280 | return secure_ipv6_port_ephemeral(np->rcv_saddr.s6_addr32, |
281 | np->daddr.s6_addr32, | 281 | np->daddr.s6_addr32, |
282 | inet->dport); | 282 | inet->inet_dport); |
283 | } | 283 | } |
284 | 284 | ||
285 | int inet6_hash_connect(struct inet_timewait_death_row *death_row, | 285 | int inet6_hash_connect(struct inet_timewait_death_row *death_row, |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 716153941fc4..85849b4f5a36 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -1297,7 +1297,7 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns | |||
1297 | switch (optname) { | 1297 | switch (optname) { |
1298 | case MRT6_INIT: | 1298 | case MRT6_INIT: |
1299 | if (sk->sk_type != SOCK_RAW || | 1299 | if (sk->sk_type != SOCK_RAW || |
1300 | inet_sk(sk)->num != IPPROTO_ICMPV6) | 1300 | inet_sk(sk)->inet_num != IPPROTO_ICMPV6) |
1301 | return -EOPNOTSUPP; | 1301 | return -EOPNOTSUPP; |
1302 | if (optlen < sizeof(int)) | 1302 | if (optlen < sizeof(int)) |
1303 | return -EINVAL; | 1303 | return -EINVAL; |
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index dc0f7366073d..39e10ac88019 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -64,7 +64,7 @@ int ip6_ra_control(struct sock *sk, int sel) | |||
64 | struct ip6_ra_chain *ra, *new_ra, **rap; | 64 | struct ip6_ra_chain *ra, *new_ra, **rap; |
65 | 65 | ||
66 | /* RA packet may be delivered ONLY to IPPROTO_RAW socket */ | 66 | /* RA packet may be delivered ONLY to IPPROTO_RAW socket */ |
67 | if (sk->sk_type != SOCK_RAW || inet_sk(sk)->num != IPPROTO_RAW) | 67 | if (sk->sk_type != SOCK_RAW || inet_sk(sk)->inet_num != IPPROTO_RAW) |
68 | return -ENOPROTOOPT; | 68 | return -ENOPROTOOPT; |
69 | 69 | ||
70 | new_ra = (sel>=0) ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL; | 70 | new_ra = (sel>=0) ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL; |
@@ -106,7 +106,7 @@ struct ipv6_txoptions *ipv6_update_options(struct sock *sk, | |||
106 | if (inet_sk(sk)->is_icsk) { | 106 | if (inet_sk(sk)->is_icsk) { |
107 | if (opt && | 107 | if (opt && |
108 | !((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) && | 108 | !((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) && |
109 | inet_sk(sk)->daddr != LOOPBACK4_IPV6) { | 109 | inet_sk(sk)->inet_daddr != LOOPBACK4_IPV6) { |
110 | struct inet_connection_sock *icsk = inet_csk(sk); | 110 | struct inet_connection_sock *icsk = inet_csk(sk); |
111 | icsk->icsk_ext_hdr_len = opt->opt_flen + opt->opt_nflen; | 111 | icsk->icsk_ext_hdr_len = opt->opt_flen + opt->opt_nflen; |
112 | icsk->icsk_sync_mss(sk, icsk->icsk_pmtu_cookie); | 112 | icsk->icsk_sync_mss(sk, icsk->icsk_pmtu_cookie); |
@@ -234,7 +234,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, | |||
234 | 234 | ||
235 | case IPV6_V6ONLY: | 235 | case IPV6_V6ONLY: |
236 | if (optlen < sizeof(int) || | 236 | if (optlen < sizeof(int) || |
237 | inet_sk(sk)->num) | 237 | inet_sk(sk)->inet_num) |
238 | goto e_inval; | 238 | goto e_inval; |
239 | np->ipv6only = valbool; | 239 | np->ipv6only = valbool; |
240 | retv = 0; | 240 | retv = 0; |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index fd737efed96c..52ed7d7f9dab 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -72,7 +72,7 @@ static struct sock *__raw_v6_lookup(struct net *net, struct sock *sk, | |||
72 | int is_multicast = ipv6_addr_is_multicast(loc_addr); | 72 | int is_multicast = ipv6_addr_is_multicast(loc_addr); |
73 | 73 | ||
74 | sk_for_each_from(sk, node) | 74 | sk_for_each_from(sk, node) |
75 | if (inet_sk(sk)->num == num) { | 75 | if (inet_sk(sk)->inet_num == num) { |
76 | struct ipv6_pinfo *np = inet6_sk(sk); | 76 | struct ipv6_pinfo *np = inet6_sk(sk); |
77 | 77 | ||
78 | if (!net_eq(sock_net(sk), net)) | 78 | if (!net_eq(sock_net(sk), net)) |
@@ -298,7 +298,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
298 | dev_put(dev); | 298 | dev_put(dev); |
299 | } | 299 | } |
300 | 300 | ||
301 | inet->rcv_saddr = inet->saddr = v4addr; | 301 | inet->inet_rcv_saddr = inet->inet_saddr = v4addr; |
302 | ipv6_addr_copy(&np->rcv_saddr, &addr->sin6_addr); | 302 | ipv6_addr_copy(&np->rcv_saddr, &addr->sin6_addr); |
303 | if (!(addr_type & IPV6_ADDR_MULTICAST)) | 303 | if (!(addr_type & IPV6_ADDR_MULTICAST)) |
304 | ipv6_addr_copy(&np->saddr, &addr->sin6_addr); | 304 | ipv6_addr_copy(&np->saddr, &addr->sin6_addr); |
@@ -415,14 +415,14 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb) | |||
415 | skb_network_header_len(skb)); | 415 | skb_network_header_len(skb)); |
416 | if (!csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | 416 | if (!csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
417 | &ipv6_hdr(skb)->daddr, | 417 | &ipv6_hdr(skb)->daddr, |
418 | skb->len, inet->num, skb->csum)) | 418 | skb->len, inet->inet_num, skb->csum)) |
419 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 419 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
420 | } | 420 | } |
421 | if (!skb_csum_unnecessary(skb)) | 421 | if (!skb_csum_unnecessary(skb)) |
422 | skb->csum = ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | 422 | skb->csum = ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
423 | &ipv6_hdr(skb)->daddr, | 423 | &ipv6_hdr(skb)->daddr, |
424 | skb->len, | 424 | skb->len, |
425 | inet->num, 0)); | 425 | inet->inet_num, 0)); |
426 | 426 | ||
427 | if (inet->hdrincl) { | 427 | if (inet->hdrincl) { |
428 | if (skb_checksum_complete(skb)) { | 428 | if (skb_checksum_complete(skb)) { |
@@ -765,8 +765,8 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
765 | proto = ntohs(sin6->sin6_port); | 765 | proto = ntohs(sin6->sin6_port); |
766 | 766 | ||
767 | if (!proto) | 767 | if (!proto) |
768 | proto = inet->num; | 768 | proto = inet->inet_num; |
769 | else if (proto != inet->num) | 769 | else if (proto != inet->inet_num) |
770 | return(-EINVAL); | 770 | return(-EINVAL); |
771 | 771 | ||
772 | if (proto > 255) | 772 | if (proto > 255) |
@@ -799,7 +799,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
799 | if (sk->sk_state != TCP_ESTABLISHED) | 799 | if (sk->sk_state != TCP_ESTABLISHED) |
800 | return -EDESTADDRREQ; | 800 | return -EDESTADDRREQ; |
801 | 801 | ||
802 | proto = inet->num; | 802 | proto = inet->inet_num; |
803 | daddr = &np->daddr; | 803 | daddr = &np->daddr; |
804 | fl.fl6_flowlabel = np->flow_label; | 804 | fl.fl6_flowlabel = np->flow_label; |
805 | } | 805 | } |
@@ -966,7 +966,7 @@ static int do_rawv6_setsockopt(struct sock *sk, int level, int optname, | |||
966 | 966 | ||
967 | switch (optname) { | 967 | switch (optname) { |
968 | case IPV6_CHECKSUM: | 968 | case IPV6_CHECKSUM: |
969 | if (inet_sk(sk)->num == IPPROTO_ICMPV6 && | 969 | if (inet_sk(sk)->inet_num == IPPROTO_ICMPV6 && |
970 | level == IPPROTO_IPV6) { | 970 | level == IPPROTO_IPV6) { |
971 | /* | 971 | /* |
972 | * RFC3542 tells that IPV6_CHECKSUM socket | 972 | * RFC3542 tells that IPV6_CHECKSUM socket |
@@ -1006,7 +1006,7 @@ static int rawv6_setsockopt(struct sock *sk, int level, int optname, | |||
1006 | break; | 1006 | break; |
1007 | 1007 | ||
1008 | case SOL_ICMPV6: | 1008 | case SOL_ICMPV6: |
1009 | if (inet_sk(sk)->num != IPPROTO_ICMPV6) | 1009 | if (inet_sk(sk)->inet_num != IPPROTO_ICMPV6) |
1010 | return -EOPNOTSUPP; | 1010 | return -EOPNOTSUPP; |
1011 | return rawv6_seticmpfilter(sk, level, optname, optval, | 1011 | return rawv6_seticmpfilter(sk, level, optname, optval, |
1012 | optlen); | 1012 | optlen); |
@@ -1029,7 +1029,7 @@ static int compat_rawv6_setsockopt(struct sock *sk, int level, int optname, | |||
1029 | case SOL_RAW: | 1029 | case SOL_RAW: |
1030 | break; | 1030 | break; |
1031 | case SOL_ICMPV6: | 1031 | case SOL_ICMPV6: |
1032 | if (inet_sk(sk)->num != IPPROTO_ICMPV6) | 1032 | if (inet_sk(sk)->inet_num != IPPROTO_ICMPV6) |
1033 | return -EOPNOTSUPP; | 1033 | return -EOPNOTSUPP; |
1034 | return rawv6_seticmpfilter(sk, level, optname, optval, optlen); | 1034 | return rawv6_seticmpfilter(sk, level, optname, optval, optlen); |
1035 | case SOL_IPV6: | 1035 | case SOL_IPV6: |
@@ -1086,7 +1086,7 @@ static int rawv6_getsockopt(struct sock *sk, int level, int optname, | |||
1086 | break; | 1086 | break; |
1087 | 1087 | ||
1088 | case SOL_ICMPV6: | 1088 | case SOL_ICMPV6: |
1089 | if (inet_sk(sk)->num != IPPROTO_ICMPV6) | 1089 | if (inet_sk(sk)->inet_num != IPPROTO_ICMPV6) |
1090 | return -EOPNOTSUPP; | 1090 | return -EOPNOTSUPP; |
1091 | return rawv6_geticmpfilter(sk, level, optname, optval, | 1091 | return rawv6_geticmpfilter(sk, level, optname, optval, |
1092 | optlen); | 1092 | optlen); |
@@ -1109,7 +1109,7 @@ static int compat_rawv6_getsockopt(struct sock *sk, int level, int optname, | |||
1109 | case SOL_RAW: | 1109 | case SOL_RAW: |
1110 | break; | 1110 | break; |
1111 | case SOL_ICMPV6: | 1111 | case SOL_ICMPV6: |
1112 | if (inet_sk(sk)->num != IPPROTO_ICMPV6) | 1112 | if (inet_sk(sk)->inet_num != IPPROTO_ICMPV6) |
1113 | return -EOPNOTSUPP; | 1113 | return -EOPNOTSUPP; |
1114 | return rawv6_geticmpfilter(sk, level, optname, optval, optlen); | 1114 | return rawv6_geticmpfilter(sk, level, optname, optval, optlen); |
1115 | case SOL_IPV6: | 1115 | case SOL_IPV6: |
@@ -1156,7 +1156,7 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
1156 | 1156 | ||
1157 | static void rawv6_close(struct sock *sk, long timeout) | 1157 | static void rawv6_close(struct sock *sk, long timeout) |
1158 | { | 1158 | { |
1159 | if (inet_sk(sk)->num == IPPROTO_RAW) | 1159 | if (inet_sk(sk)->inet_num == IPPROTO_RAW) |
1160 | ip6_ra_control(sk, -1); | 1160 | ip6_ra_control(sk, -1); |
1161 | ip6mr_sk_done(sk); | 1161 | ip6mr_sk_done(sk); |
1162 | sk_common_release(sk); | 1162 | sk_common_release(sk); |
@@ -1175,7 +1175,7 @@ static int rawv6_init_sk(struct sock *sk) | |||
1175 | { | 1175 | { |
1176 | struct raw6_sock *rp = raw6_sk(sk); | 1176 | struct raw6_sock *rp = raw6_sk(sk); |
1177 | 1177 | ||
1178 | switch (inet_sk(sk)->num) { | 1178 | switch (inet_sk(sk)->inet_num) { |
1179 | case IPPROTO_ICMPV6: | 1179 | case IPPROTO_ICMPV6: |
1180 | rp->checksum = 1; | 1180 | rp->checksum = 1; |
1181 | rp->offset = 2; | 1181 | rp->offset = 2; |
@@ -1225,7 +1225,7 @@ static void raw6_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) | |||
1225 | dest = &np->daddr; | 1225 | dest = &np->daddr; |
1226 | src = &np->rcv_saddr; | 1226 | src = &np->rcv_saddr; |
1227 | destp = 0; | 1227 | destp = 0; |
1228 | srcp = inet_sk(sp)->num; | 1228 | srcp = inet_sk(sp)->inet_num; |
1229 | seq_printf(seq, | 1229 | seq_printf(seq, |
1230 | "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " | 1230 | "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " |
1231 | "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n", | 1231 | "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n", |
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c index cbe55e5d9f96..c46da533888a 100644 --- a/net/ipv6/syncookies.c +++ b/net/ipv6/syncookies.c | |||
@@ -254,7 +254,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) | |||
254 | fl.oif = sk->sk_bound_dev_if; | 254 | fl.oif = sk->sk_bound_dev_if; |
255 | fl.mark = sk->sk_mark; | 255 | fl.mark = sk->sk_mark; |
256 | fl.fl_ip_dport = inet_rsk(req)->rmt_port; | 256 | fl.fl_ip_dport = inet_rsk(req)->rmt_port; |
257 | fl.fl_ip_sport = inet_sk(sk)->sport; | 257 | fl.fl_ip_sport = inet_sk(sk)->inet_sport; |
258 | security_req_classify_flow(req, &fl); | 258 | security_req_classify_flow(req, &fl); |
259 | if (ip6_dst_lookup(sk, &dst, &fl)) | 259 | if (ip6_dst_lookup(sk, &dst, &fl)) |
260 | goto out_free; | 260 | goto out_free; |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 451763059142..c54ec3615ded 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -226,8 +226,9 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
226 | #endif | 226 | #endif |
227 | goto failure; | 227 | goto failure; |
228 | } else { | 228 | } else { |
229 | ipv6_addr_set_v4mapped(inet->saddr, &np->saddr); | 229 | ipv6_addr_set_v4mapped(inet->inet_saddr, &np->saddr); |
230 | ipv6_addr_set_v4mapped(inet->rcv_saddr, &np->rcv_saddr); | 230 | ipv6_addr_set_v4mapped(inet->inet_rcv_saddr, |
231 | &np->rcv_saddr); | ||
231 | } | 232 | } |
232 | 233 | ||
233 | return err; | 234 | return err; |
@@ -243,7 +244,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
243 | fl.oif = sk->sk_bound_dev_if; | 244 | fl.oif = sk->sk_bound_dev_if; |
244 | fl.mark = sk->sk_mark; | 245 | fl.mark = sk->sk_mark; |
245 | fl.fl_ip_dport = usin->sin6_port; | 246 | fl.fl_ip_dport = usin->sin6_port; |
246 | fl.fl_ip_sport = inet->sport; | 247 | fl.fl_ip_sport = inet->inet_sport; |
247 | 248 | ||
248 | if (np->opt && np->opt->srcrt) { | 249 | if (np->opt && np->opt->srcrt) { |
249 | struct rt0_hdr *rt0 = (struct rt0_hdr *)np->opt->srcrt; | 250 | struct rt0_hdr *rt0 = (struct rt0_hdr *)np->opt->srcrt; |
@@ -275,7 +276,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
275 | 276 | ||
276 | /* set the source address */ | 277 | /* set the source address */ |
277 | ipv6_addr_copy(&np->saddr, saddr); | 278 | ipv6_addr_copy(&np->saddr, saddr); |
278 | inet->rcv_saddr = LOOPBACK4_IPV6; | 279 | inet->inet_rcv_saddr = LOOPBACK4_IPV6; |
279 | 280 | ||
280 | sk->sk_gso_type = SKB_GSO_TCPV6; | 281 | sk->sk_gso_type = SKB_GSO_TCPV6; |
281 | __ip6_dst_store(sk, dst, NULL, NULL); | 282 | __ip6_dst_store(sk, dst, NULL, NULL); |
@@ -287,7 +288,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
287 | 288 | ||
288 | tp->rx_opt.mss_clamp = IPV6_MIN_MTU - sizeof(struct tcphdr) - sizeof(struct ipv6hdr); | 289 | tp->rx_opt.mss_clamp = IPV6_MIN_MTU - sizeof(struct tcphdr) - sizeof(struct ipv6hdr); |
289 | 290 | ||
290 | inet->dport = usin->sin6_port; | 291 | inet->inet_dport = usin->sin6_port; |
291 | 292 | ||
292 | tcp_set_state(sk, TCP_SYN_SENT); | 293 | tcp_set_state(sk, TCP_SYN_SENT); |
293 | err = inet6_hash_connect(&tcp_death_row, sk); | 294 | err = inet6_hash_connect(&tcp_death_row, sk); |
@@ -297,8 +298,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
297 | if (!tp->write_seq) | 298 | if (!tp->write_seq) |
298 | tp->write_seq = secure_tcpv6_sequence_number(np->saddr.s6_addr32, | 299 | tp->write_seq = secure_tcpv6_sequence_number(np->saddr.s6_addr32, |
299 | np->daddr.s6_addr32, | 300 | np->daddr.s6_addr32, |
300 | inet->sport, | 301 | inet->inet_sport, |
301 | inet->dport); | 302 | inet->inet_dport); |
302 | 303 | ||
303 | err = tcp_connect(sk); | 304 | err = tcp_connect(sk); |
304 | if (err) | 305 | if (err) |
@@ -310,7 +311,7 @@ late_failure: | |||
310 | tcp_set_state(sk, TCP_CLOSE); | 311 | tcp_set_state(sk, TCP_CLOSE); |
311 | __sk_dst_reset(sk); | 312 | __sk_dst_reset(sk); |
312 | failure: | 313 | failure: |
313 | inet->dport = 0; | 314 | inet->inet_dport = 0; |
314 | sk->sk_route_caps = 0; | 315 | sk->sk_route_caps = 0; |
315 | return err; | 316 | return err; |
316 | } | 317 | } |
@@ -383,8 +384,8 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
383 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); | 384 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); |
384 | fl.oif = sk->sk_bound_dev_if; | 385 | fl.oif = sk->sk_bound_dev_if; |
385 | fl.mark = sk->sk_mark; | 386 | fl.mark = sk->sk_mark; |
386 | fl.fl_ip_dport = inet->dport; | 387 | fl.fl_ip_dport = inet->inet_dport; |
387 | fl.fl_ip_sport = inet->sport; | 388 | fl.fl_ip_sport = inet->inet_sport; |
388 | security_skb_classify_flow(skb, &fl); | 389 | security_skb_classify_flow(skb, &fl); |
389 | 390 | ||
390 | if ((err = ip6_dst_lookup(sk, &dst, &fl))) { | 391 | if ((err = ip6_dst_lookup(sk, &dst, &fl))) { |
@@ -1291,9 +1292,9 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1291 | 1292 | ||
1292 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); | 1293 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); |
1293 | 1294 | ||
1294 | ipv6_addr_set_v4mapped(newinet->daddr, &newnp->daddr); | 1295 | ipv6_addr_set_v4mapped(newinet->inet_daddr, &newnp->daddr); |
1295 | 1296 | ||
1296 | ipv6_addr_set_v4mapped(newinet->saddr, &newnp->saddr); | 1297 | ipv6_addr_set_v4mapped(newinet->inet_saddr, &newnp->saddr); |
1297 | 1298 | ||
1298 | ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr); | 1299 | ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr); |
1299 | 1300 | ||
@@ -1431,7 +1432,8 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1431 | newtp->advmss = dst_metric(dst, RTAX_ADVMSS); | 1432 | newtp->advmss = dst_metric(dst, RTAX_ADVMSS); |
1432 | tcp_initialize_rcv_mss(newsk); | 1433 | tcp_initialize_rcv_mss(newsk); |
1433 | 1434 | ||
1434 | newinet->daddr = newinet->saddr = newinet->rcv_saddr = LOOPBACK4_IPV6; | 1435 | newinet->inet_daddr = newinet->inet_saddr = LOOPBACK4_IPV6; |
1436 | newinet->inet_rcv_saddr = LOOPBACK4_IPV6; | ||
1435 | 1437 | ||
1436 | #ifdef CONFIG_TCP_MD5SIG | 1438 | #ifdef CONFIG_TCP_MD5SIG |
1437 | /* Copy over the MD5 key from the original socket */ | 1439 | /* Copy over the MD5 key from the original socket */ |
@@ -1931,8 +1933,8 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) | |||
1931 | 1933 | ||
1932 | dest = &np->daddr; | 1934 | dest = &np->daddr; |
1933 | src = &np->rcv_saddr; | 1935 | src = &np->rcv_saddr; |
1934 | destp = ntohs(inet->dport); | 1936 | destp = ntohs(inet->inet_dport); |
1935 | srcp = ntohs(inet->sport); | 1937 | srcp = ntohs(inet->inet_sport); |
1936 | 1938 | ||
1937 | if (icsk->icsk_pending == ICSK_TIME_RETRANS) { | 1939 | if (icsk->icsk_pending == ICSK_TIME_RETRANS) { |
1938 | timer_active = 1; | 1940 | timer_active = 1; |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index b86425b7ea22..829d300a6f35 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -53,7 +53,7 @@ int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2) | |||
53 | { | 53 | { |
54 | const struct in6_addr *sk_rcv_saddr6 = &inet6_sk(sk)->rcv_saddr; | 54 | const struct in6_addr *sk_rcv_saddr6 = &inet6_sk(sk)->rcv_saddr; |
55 | const struct in6_addr *sk2_rcv_saddr6 = inet6_rcv_saddr(sk2); | 55 | const struct in6_addr *sk2_rcv_saddr6 = inet6_rcv_saddr(sk2); |
56 | __be32 sk_rcv_saddr = inet_sk(sk)->rcv_saddr; | 56 | __be32 sk1_rcv_saddr = inet_sk(sk)->inet_rcv_saddr; |
57 | __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2); | 57 | __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2); |
58 | int sk_ipv6only = ipv6_only_sock(sk); | 58 | int sk_ipv6only = ipv6_only_sock(sk); |
59 | int sk2_ipv6only = inet_v6_ipv6only(sk2); | 59 | int sk2_ipv6only = inet_v6_ipv6only(sk2); |
@@ -63,8 +63,8 @@ int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2) | |||
63 | /* if both are mapped, treat as IPv4 */ | 63 | /* if both are mapped, treat as IPv4 */ |
64 | if (addr_type == IPV6_ADDR_MAPPED && addr_type2 == IPV6_ADDR_MAPPED) | 64 | if (addr_type == IPV6_ADDR_MAPPED && addr_type2 == IPV6_ADDR_MAPPED) |
65 | return (!sk2_ipv6only && | 65 | return (!sk2_ipv6only && |
66 | (!sk_rcv_saddr || !sk2_rcv_saddr || | 66 | (!sk1_rcv_saddr || !sk2_rcv_saddr || |
67 | sk_rcv_saddr == sk2_rcv_saddr)); | 67 | sk1_rcv_saddr == sk2_rcv_saddr)); |
68 | 68 | ||
69 | if (addr_type2 == IPV6_ADDR_ANY && | 69 | if (addr_type2 == IPV6_ADDR_ANY && |
70 | !(sk2_ipv6only && addr_type == IPV6_ADDR_MAPPED)) | 70 | !(sk2_ipv6only && addr_type == IPV6_ADDR_MAPPED)) |
@@ -100,8 +100,8 @@ static inline int compute_score(struct sock *sk, struct net *net, | |||
100 | struct inet_sock *inet = inet_sk(sk); | 100 | struct inet_sock *inet = inet_sk(sk); |
101 | 101 | ||
102 | score = 0; | 102 | score = 0; |
103 | if (inet->dport) { | 103 | if (inet->inet_dport) { |
104 | if (inet->dport != sport) | 104 | if (inet->inet_dport != sport) |
105 | return -1; | 105 | return -1; |
106 | score++; | 106 | score++; |
107 | } | 107 | } |
@@ -417,8 +417,8 @@ static struct sock *udp_v6_mcast_next(struct net *net, struct sock *sk, | |||
417 | 417 | ||
418 | if (s->sk_hash == num && s->sk_family == PF_INET6) { | 418 | if (s->sk_hash == num && s->sk_family == PF_INET6) { |
419 | struct ipv6_pinfo *np = inet6_sk(s); | 419 | struct ipv6_pinfo *np = inet6_sk(s); |
420 | if (inet->dport) { | 420 | if (inet->inet_dport) { |
421 | if (inet->dport != rmt_port) | 421 | if (inet->inet_dport != rmt_port) |
422 | continue; | 422 | continue; |
423 | } | 423 | } |
424 | if (!ipv6_addr_any(&np->daddr) && | 424 | if (!ipv6_addr_any(&np->daddr) && |
@@ -792,7 +792,7 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
792 | if (ipv6_addr_v4mapped(daddr)) { | 792 | if (ipv6_addr_v4mapped(daddr)) { |
793 | struct sockaddr_in sin; | 793 | struct sockaddr_in sin; |
794 | sin.sin_family = AF_INET; | 794 | sin.sin_family = AF_INET; |
795 | sin.sin_port = sin6 ? sin6->sin6_port : inet->dport; | 795 | sin.sin_port = sin6 ? sin6->sin6_port : inet->inet_dport; |
796 | sin.sin_addr.s_addr = daddr->s6_addr32[3]; | 796 | sin.sin_addr.s_addr = daddr->s6_addr32[3]; |
797 | msg->msg_name = &sin; | 797 | msg->msg_name = &sin; |
798 | msg->msg_namelen = sizeof(sin); | 798 | msg->msg_namelen = sizeof(sin); |
@@ -865,7 +865,7 @@ do_udp_sendmsg: | |||
865 | if (sk->sk_state != TCP_ESTABLISHED) | 865 | if (sk->sk_state != TCP_ESTABLISHED) |
866 | return -EDESTADDRREQ; | 866 | return -EDESTADDRREQ; |
867 | 867 | ||
868 | fl.fl_ip_dport = inet->dport; | 868 | fl.fl_ip_dport = inet->inet_dport; |
869 | daddr = &np->daddr; | 869 | daddr = &np->daddr; |
870 | fl.fl6_flowlabel = np->flow_label; | 870 | fl.fl6_flowlabel = np->flow_label; |
871 | connected = 1; | 871 | connected = 1; |
@@ -911,7 +911,7 @@ do_udp_sendmsg: | |||
911 | fl.fl6_dst.s6_addr[15] = 0x1; /* :: means loopback (BSD'ism) */ | 911 | fl.fl6_dst.s6_addr[15] = 0x1; /* :: means loopback (BSD'ism) */ |
912 | if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr)) | 912 | if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr)) |
913 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); | 913 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); |
914 | fl.fl_ip_sport = inet->sport; | 914 | fl.fl_ip_sport = inet->inet_sport; |
915 | 915 | ||
916 | /* merge ip6_build_xmit from ip6_output */ | 916 | /* merge ip6_build_xmit from ip6_output */ |
917 | if (opt && opt->srcrt) { | 917 | if (opt && opt->srcrt) { |
@@ -1192,8 +1192,8 @@ static void udp6_sock_seq_show(struct seq_file *seq, struct sock *sp, int bucket | |||
1192 | 1192 | ||
1193 | dest = &np->daddr; | 1193 | dest = &np->daddr; |
1194 | src = &np->rcv_saddr; | 1194 | src = &np->rcv_saddr; |
1195 | destp = ntohs(inet->dport); | 1195 | destp = ntohs(inet->inet_dport); |
1196 | srcp = ntohs(inet->sport); | 1196 | srcp = ntohs(inet->inet_sport); |
1197 | seq_printf(seq, | 1197 | seq_printf(seq, |
1198 | "%5d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " | 1198 | "%5d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " |
1199 | "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n", | 1199 | "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n", |
diff --git a/net/netfilter/xt_socket.c b/net/netfilter/xt_socket.c index ebf00ad5b194..362afbd60a96 100644 --- a/net/netfilter/xt_socket.c +++ b/net/netfilter/xt_socket.c | |||
@@ -149,7 +149,7 @@ socket_match(const struct sk_buff *skb, const struct xt_match_param *par, | |||
149 | 149 | ||
150 | /* Ignore sockets listening on INADDR_ANY */ | 150 | /* Ignore sockets listening on INADDR_ANY */ |
151 | wildcard = (sk->sk_state != TCP_TIME_WAIT && | 151 | wildcard = (sk->sk_state != TCP_TIME_WAIT && |
152 | inet_sk(sk)->rcv_saddr == 0); | 152 | inet_sk(sk)->inet_rcv_saddr == 0); |
153 | 153 | ||
154 | /* Ignore non-transparent sockets, | 154 | /* Ignore non-transparent sockets, |
155 | if XT_SOCKET_TRANSPARENT is used */ | 155 | if XT_SOCKET_TRANSPARENT is used */ |
diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c index 24b743eb0b1b..45474a436862 100644 --- a/net/rds/tcp_listen.c +++ b/net/rds/tcp_listen.c | |||
@@ -67,11 +67,11 @@ static int rds_tcp_accept_one(struct socket *sock) | |||
67 | inet = inet_sk(new_sock->sk); | 67 | inet = inet_sk(new_sock->sk); |
68 | 68 | ||
69 | rdsdebug("accepted tcp %u.%u.%u.%u:%u -> %u.%u.%u.%u:%u\n", | 69 | rdsdebug("accepted tcp %u.%u.%u.%u:%u -> %u.%u.%u.%u:%u\n", |
70 | NIPQUAD(inet->saddr), ntohs(inet->sport), | 70 | NIPQUAD(inet->inet_saddr), ntohs(inet->inet_sport), |
71 | NIPQUAD(inet->daddr), ntohs(inet->dport)); | 71 | NIPQUAD(inet->inet_daddr), ntohs(inet->inet_dport)); |
72 | 72 | ||
73 | conn = rds_conn_create(inet->saddr, inet->daddr, &rds_tcp_transport, | 73 | conn = rds_conn_create(inet->inet_saddr, inet->inet_daddr, |
74 | GFP_KERNEL); | 74 | &rds_tcp_transport, GFP_KERNEL); |
75 | if (IS_ERR(conn)) { | 75 | if (IS_ERR(conn)) { |
76 | ret = PTR_ERR(conn); | 76 | ret = PTR_ERR(conn); |
77 | goto out; | 77 | goto out; |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 612dc878e05c..d9f4cc2c7869 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -296,19 +296,19 @@ static void sctp_v4_from_sk(union sctp_addr *addr, struct sock *sk) | |||
296 | { | 296 | { |
297 | addr->v4.sin_family = AF_INET; | 297 | addr->v4.sin_family = AF_INET; |
298 | addr->v4.sin_port = 0; | 298 | addr->v4.sin_port = 0; |
299 | addr->v4.sin_addr.s_addr = inet_sk(sk)->rcv_saddr; | 299 | addr->v4.sin_addr.s_addr = inet_sk(sk)->inet_rcv_saddr; |
300 | } | 300 | } |
301 | 301 | ||
302 | /* Initialize sk->sk_rcv_saddr from sctp_addr. */ | 302 | /* Initialize sk->sk_rcv_saddr from sctp_addr. */ |
303 | static void sctp_v4_to_sk_saddr(union sctp_addr *addr, struct sock *sk) | 303 | static void sctp_v4_to_sk_saddr(union sctp_addr *addr, struct sock *sk) |
304 | { | 304 | { |
305 | inet_sk(sk)->rcv_saddr = addr->v4.sin_addr.s_addr; | 305 | inet_sk(sk)->inet_rcv_saddr = addr->v4.sin_addr.s_addr; |
306 | } | 306 | } |
307 | 307 | ||
308 | /* Initialize sk->sk_daddr from sctp_addr. */ | 308 | /* Initialize sk->sk_daddr from sctp_addr. */ |
309 | static void sctp_v4_to_sk_daddr(union sctp_addr *addr, struct sock *sk) | 309 | static void sctp_v4_to_sk_daddr(union sctp_addr *addr, struct sock *sk) |
310 | { | 310 | { |
311 | inet_sk(sk)->daddr = addr->v4.sin_addr.s_addr; | 311 | inet_sk(sk)->inet_daddr = addr->v4.sin_addr.s_addr; |
312 | } | 312 | } |
313 | 313 | ||
314 | /* Initialize a sctp_addr from an address parameter. */ | 314 | /* Initialize a sctp_addr from an address parameter. */ |
@@ -598,7 +598,7 @@ static struct sock *sctp_v4_create_accept_sk(struct sock *sk, | |||
598 | 598 | ||
599 | newinet = inet_sk(newsk); | 599 | newinet = inet_sk(newsk); |
600 | 600 | ||
601 | newinet->daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr; | 601 | newinet->inet_daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr; |
602 | 602 | ||
603 | sk_refcnt_debug_inc(newsk); | 603 | sk_refcnt_debug_inc(newsk); |
604 | 604 | ||
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 0970e92c6acd..4085db99033d 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -394,7 +394,7 @@ SCTP_STATIC int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len) | |||
394 | 394 | ||
395 | /* Refresh ephemeral port. */ | 395 | /* Refresh ephemeral port. */ |
396 | if (!bp->port) | 396 | if (!bp->port) |
397 | bp->port = inet_sk(sk)->num; | 397 | bp->port = inet_sk(sk)->inet_num; |
398 | 398 | ||
399 | /* Add the address to the bind address list. | 399 | /* Add the address to the bind address list. |
400 | * Use GFP_ATOMIC since BHs will be disabled. | 400 | * Use GFP_ATOMIC since BHs will be disabled. |
@@ -403,7 +403,7 @@ SCTP_STATIC int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len) | |||
403 | 403 | ||
404 | /* Copy back into socket for getsockname() use. */ | 404 | /* Copy back into socket for getsockname() use. */ |
405 | if (!ret) { | 405 | if (!ret) { |
406 | inet_sk(sk)->sport = htons(inet_sk(sk)->num); | 406 | inet_sk(sk)->inet_sport = htons(inet_sk(sk)->inet_num); |
407 | af->to_sk_saddr(addr, sk); | 407 | af->to_sk_saddr(addr, sk); |
408 | } | 408 | } |
409 | 409 | ||
@@ -1115,7 +1115,7 @@ static int __sctp_connect(struct sock* sk, | |||
1115 | } | 1115 | } |
1116 | 1116 | ||
1117 | /* Initialize sk's dport and daddr for getpeername() */ | 1117 | /* Initialize sk's dport and daddr for getpeername() */ |
1118 | inet_sk(sk)->dport = htons(asoc->peer.port); | 1118 | inet_sk(sk)->inet_dport = htons(asoc->peer.port); |
1119 | af = sctp_get_af_specific(sa_addr->sa.sa_family); | 1119 | af = sctp_get_af_specific(sa_addr->sa.sa_family); |
1120 | af->to_sk_daddr(sa_addr, sk); | 1120 | af->to_sk_daddr(sa_addr, sk); |
1121 | sk->sk_err = 0; | 1121 | sk->sk_err = 0; |
@@ -5851,7 +5851,7 @@ pp_not_found: | |||
5851 | */ | 5851 | */ |
5852 | success: | 5852 | success: |
5853 | if (!sctp_sk(sk)->bind_hash) { | 5853 | if (!sctp_sk(sk)->bind_hash) { |
5854 | inet_sk(sk)->num = snum; | 5854 | inet_sk(sk)->inet_num = snum; |
5855 | sk_add_bind_node(sk, &pp->owner); | 5855 | sk_add_bind_node(sk, &pp->owner); |
5856 | sctp_sk(sk)->bind_hash = pp; | 5856 | sctp_sk(sk)->bind_hash = pp; |
5857 | } | 5857 | } |
@@ -5923,7 +5923,7 @@ SCTP_STATIC int sctp_listen_start(struct sock *sk, int backlog) | |||
5923 | if (sctp_autobind(sk)) | 5923 | if (sctp_autobind(sk)) |
5924 | return -EAGAIN; | 5924 | return -EAGAIN; |
5925 | } else { | 5925 | } else { |
5926 | if (sctp_get_port(sk, inet_sk(sk)->num)) { | 5926 | if (sctp_get_port(sk, inet_sk(sk)->inet_num)) { |
5927 | sk->sk_state = SCTP_SS_CLOSED; | 5927 | sk->sk_state = SCTP_SS_CLOSED; |
5928 | return -EADDRINUSE; | 5928 | return -EADDRINUSE; |
5929 | } | 5929 | } |
@@ -6094,14 +6094,14 @@ static void sctp_bucket_destroy(struct sctp_bind_bucket *pp) | |||
6094 | static inline void __sctp_put_port(struct sock *sk) | 6094 | static inline void __sctp_put_port(struct sock *sk) |
6095 | { | 6095 | { |
6096 | struct sctp_bind_hashbucket *head = | 6096 | struct sctp_bind_hashbucket *head = |
6097 | &sctp_port_hashtable[sctp_phashfn(inet_sk(sk)->num)]; | 6097 | &sctp_port_hashtable[sctp_phashfn(inet_sk(sk)->inet_num)]; |
6098 | struct sctp_bind_bucket *pp; | 6098 | struct sctp_bind_bucket *pp; |
6099 | 6099 | ||
6100 | sctp_spin_lock(&head->lock); | 6100 | sctp_spin_lock(&head->lock); |
6101 | pp = sctp_sk(sk)->bind_hash; | 6101 | pp = sctp_sk(sk)->bind_hash; |
6102 | __sk_del_bind_node(sk); | 6102 | __sk_del_bind_node(sk); |
6103 | sctp_sk(sk)->bind_hash = NULL; | 6103 | sctp_sk(sk)->bind_hash = NULL; |
6104 | inet_sk(sk)->num = 0; | 6104 | inet_sk(sk)->inet_num = 0; |
6105 | sctp_bucket_destroy(pp); | 6105 | sctp_bucket_destroy(pp); |
6106 | sctp_spin_unlock(&head->lock); | 6106 | sctp_spin_unlock(&head->lock); |
6107 | } | 6107 | } |
@@ -6128,7 +6128,7 @@ static int sctp_autobind(struct sock *sk) | |||
6128 | /* Initialize a local sockaddr structure to INADDR_ANY. */ | 6128 | /* Initialize a local sockaddr structure to INADDR_ANY. */ |
6129 | af = sctp_sk(sk)->pf->af; | 6129 | af = sctp_sk(sk)->pf->af; |
6130 | 6130 | ||
6131 | port = htons(inet_sk(sk)->num); | 6131 | port = htons(inet_sk(sk)->inet_num); |
6132 | af->inaddr_any(&autoaddr, port); | 6132 | af->inaddr_any(&autoaddr, port); |
6133 | 6133 | ||
6134 | return sctp_do_bind(sk, &autoaddr, af->sockaddr_len); | 6134 | return sctp_do_bind(sk, &autoaddr, af->sockaddr_len); |
@@ -6697,12 +6697,12 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk, | |||
6697 | /* Initialize sk's sport, dport, rcv_saddr and daddr for | 6697 | /* Initialize sk's sport, dport, rcv_saddr and daddr for |
6698 | * getsockname() and getpeername() | 6698 | * getsockname() and getpeername() |
6699 | */ | 6699 | */ |
6700 | newinet->sport = inet->sport; | 6700 | newinet->inet_sport = inet->inet_sport; |
6701 | newinet->saddr = inet->saddr; | 6701 | newinet->inet_saddr = inet->inet_saddr; |
6702 | newinet->rcv_saddr = inet->rcv_saddr; | 6702 | newinet->inet_rcv_saddr = inet->inet_rcv_saddr; |
6703 | newinet->dport = htons(asoc->peer.port); | 6703 | newinet->inet_dport = htons(asoc->peer.port); |
6704 | newinet->pmtudisc = inet->pmtudisc; | 6704 | newinet->pmtudisc = inet->pmtudisc; |
6705 | newinet->id = asoc->next_tsn ^ jiffies; | 6705 | newinet->inet_id = asoc->next_tsn ^ jiffies; |
6706 | 6706 | ||
6707 | newinet->uc_ttl = inet->uc_ttl; | 6707 | newinet->uc_ttl = inet->uc_ttl; |
6708 | newinet->mc_loop = 1; | 6708 | newinet->mc_loop = 1; |
@@ -6741,13 +6741,13 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
6741 | newsp->hmac = NULL; | 6741 | newsp->hmac = NULL; |
6742 | 6742 | ||
6743 | /* Hook this new socket in to the bind_hash list. */ | 6743 | /* Hook this new socket in to the bind_hash list. */ |
6744 | head = &sctp_port_hashtable[sctp_phashfn(inet_sk(oldsk)->num)]; | 6744 | head = &sctp_port_hashtable[sctp_phashfn(inet_sk(oldsk)->inet_num)]; |
6745 | sctp_local_bh_disable(); | 6745 | sctp_local_bh_disable(); |
6746 | sctp_spin_lock(&head->lock); | 6746 | sctp_spin_lock(&head->lock); |
6747 | pp = sctp_sk(oldsk)->bind_hash; | 6747 | pp = sctp_sk(oldsk)->bind_hash; |
6748 | sk_add_bind_node(newsk, &pp->owner); | 6748 | sk_add_bind_node(newsk, &pp->owner); |
6749 | sctp_sk(newsk)->bind_hash = pp; | 6749 | sctp_sk(newsk)->bind_hash = pp; |
6750 | inet_sk(newsk)->num = inet_sk(oldsk)->num; | 6750 | inet_sk(newsk)->inet_num = inet_sk(oldsk)->inet_num; |
6751 | sctp_spin_unlock(&head->lock); | 6751 | sctp_spin_unlock(&head->lock); |
6752 | sctp_local_bh_enable(); | 6752 | sctp_local_bh_enable(); |
6753 | 6753 | ||
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index ccc5e83cae5d..c2a17876defd 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -272,14 +272,14 @@ static int svc_one_sock_name(struct svc_sock *svsk, char *buf, int remaining) | |||
272 | case PF_INET: | 272 | case PF_INET: |
273 | len = snprintf(buf, remaining, "ipv4 %s %pI4 %d\n", | 273 | len = snprintf(buf, remaining, "ipv4 %s %pI4 %d\n", |
274 | proto_name, | 274 | proto_name, |
275 | &inet_sk(sk)->rcv_saddr, | 275 | &inet_sk(sk)->inet_rcv_saddr, |
276 | inet_sk(sk)->num); | 276 | inet_sk(sk)->inet_num); |
277 | break; | 277 | break; |
278 | case PF_INET6: | 278 | case PF_INET6: |
279 | len = snprintf(buf, remaining, "ipv6 %s %pI6 %d\n", | 279 | len = snprintf(buf, remaining, "ipv6 %s %pI6 %d\n", |
280 | proto_name, | 280 | proto_name, |
281 | &inet6_sk(sk)->rcv_saddr, | 281 | &inet6_sk(sk)->rcv_saddr, |
282 | inet_sk(sk)->num); | 282 | inet_sk(sk)->inet_num); |
283 | break; | 283 | break; |
284 | default: | 284 | default: |
285 | len = snprintf(buf, remaining, "*unknown-%d*\n", | 285 | len = snprintf(buf, remaining, "*unknown-%d*\n", |
@@ -1311,7 +1311,7 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv, | |||
1311 | /* Register socket with portmapper */ | 1311 | /* Register socket with portmapper */ |
1312 | if (*errp >= 0 && pmap_register) | 1312 | if (*errp >= 0 && pmap_register) |
1313 | *errp = svc_register(serv, inet->sk_family, inet->sk_protocol, | 1313 | *errp = svc_register(serv, inet->sk_family, inet->sk_protocol, |
1314 | ntohs(inet_sk(inet)->sport)); | 1314 | ntohs(inet_sk(inet)->inet_sport)); |
1315 | 1315 | ||
1316 | if (*errp < 0) { | 1316 | if (*errp < 0) { |
1317 | kfree(svsk); | 1317 | kfree(svsk); |
diff --git a/security/lsm_audit.c b/security/lsm_audit.c index 3bb90b6f1dd3..e04566a2c4e5 100644 --- a/security/lsm_audit.c +++ b/security/lsm_audit.c | |||
@@ -273,11 +273,11 @@ static void dump_common_audit_data(struct audit_buffer *ab, | |||
273 | case AF_INET: { | 273 | case AF_INET: { |
274 | struct inet_sock *inet = inet_sk(sk); | 274 | struct inet_sock *inet = inet_sk(sk); |
275 | 275 | ||
276 | print_ipv4_addr(ab, inet->rcv_saddr, | 276 | print_ipv4_addr(ab, inet->inet_rcv_saddr, |
277 | inet->sport, | 277 | inet->inet_sport, |
278 | "laddr", "lport"); | 278 | "laddr", "lport"); |
279 | print_ipv4_addr(ab, inet->daddr, | 279 | print_ipv4_addr(ab, inet->inet_daddr, |
280 | inet->dport, | 280 | inet->inet_dport, |
281 | "faddr", "fport"); | 281 | "faddr", "fport"); |
282 | break; | 282 | break; |
283 | } | 283 | } |
@@ -286,10 +286,10 @@ static void dump_common_audit_data(struct audit_buffer *ab, | |||
286 | struct ipv6_pinfo *inet6 = inet6_sk(sk); | 286 | struct ipv6_pinfo *inet6 = inet6_sk(sk); |
287 | 287 | ||
288 | print_ipv6_addr(ab, &inet6->rcv_saddr, | 288 | print_ipv6_addr(ab, &inet6->rcv_saddr, |
289 | inet->sport, | 289 | inet->inet_sport, |
290 | "laddr", "lport"); | 290 | "laddr", "lport"); |
291 | print_ipv6_addr(ab, &inet6->daddr, | 291 | print_ipv6_addr(ab, &inet6->daddr, |
292 | inet->dport, | 292 | inet->inet_dport, |
293 | "faddr", "fport"); | 293 | "faddr", "fport"); |
294 | break; | 294 | break; |
295 | } | 295 | } |