aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-10-15 02:30:45 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-18 21:52:53 -0400
commitc720c7e8383aff1cb219bddf474ed89d850336e3 (patch)
tree4f12337e6690fccced376db9f501eaf98614a65e /net/ipv4
parent988ade6b8e27e79311812f83a87b5cea11fabcd7 (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>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/af_inet.c62
-rw-r--r--net/ipv4/datagram.c18
-rw-r--r--net/ipv4/inet_connection_sock.c20
-rw-r--r--net/ipv4/inet_diag.c26
-rw-r--r--net/ipv4/inet_hashtables.c34
-rw-r--r--net/ipv4/inet_timewait_sock.c12
-rw-r--r--net/ipv4/ip_input.c2
-rw-r--r--net/ipv4/ip_output.c15
-rw-r--r--net/ipv4/ip_sockglue.c8
-rw-r--r--net/ipv4/ipmr.c2
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c8
-rw-r--r--net/ipv4/raw.c30
-rw-r--r--net/ipv4/tcp.c4
-rw-r--r--net/ipv4/tcp_ipv4.c70
-rw-r--r--net/ipv4/tcp_output.c4
-rw-r--r--net/ipv4/tcp_probe.c11
-rw-r--r--net/ipv4/tcp_timer.c8
-rw-r--r--net/ipv4/udp.c51
18 files changed, 196 insertions, 189 deletions
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;
520out_release_sock: 520out_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
700EXPORT_SYMBOL_GPL(inet_csk_addr2sockaddr); 700EXPORT_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,
76static void __inet_put_port(struct sock *sk) 76static 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);
105void __inet_inherit_port(struct sock *sk, struct sock *child) 105void __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,
312unique: 313unique:
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:
341static inline u32 inet_sk_port_offset(const struct sock *sk) 342static 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
348void __inet_hash_nolisten(struct sock *sk) 350void __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;
642out: return ret; 642out: 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);
932static void raw_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) 932static 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 *
848struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, 849struct 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
854EXPORT_SYMBOL(tcp_v4_md5_lookup); 855EXPORT_SYMBOL(tcp_v4_md5_lookup);
@@ -923,7 +924,7 @@ EXPORT_SYMBOL(tcp_v4_md5_do_add);
923static int tcp_v4_md5_add_func(struct sock *sk, struct sock *addr_sk, 924static 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 }
216found: 216found:
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
240int udp_v4_get_port(struct sock *sk, unsigned short snum) 240int 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
758do_append_data: 759do_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",