aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/af_inet6.c28
-rw-r--r--net/ipv6/datagram.c15
-rw-r--r--net/ipv6/inet6_connection_sock.c6
-rw-r--r--net/ipv6/inet6_hashtables.c12
-rw-r--r--net/ipv6/ip6mr.c2
-rw-r--r--net/ipv6/ipv6_sockglue.c6
-rw-r--r--net/ipv6/raw.c30
-rw-r--r--net/ipv6/syncookies.c2
-rw-r--r--net/ipv6/tcp_ipv6.c32
-rw-r--r--net/ipv6/udp.c24
10 files changed, 80 insertions, 77 deletions
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;
381out: 381out:
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,
248unique: 248unique:
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
285int inet6_hash_connect(struct inet_timewait_death_row *death_row, 285int 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
1157static void rawv6_close(struct sock *sk, long timeout) 1157static 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);
312failure: 313failure:
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",