diff options
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r-- | net/ipv4/udp.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 45a8a7e374d8..ec5c7a720c0c 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -214,7 +214,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum, | |||
214 | goto fail_unlock; | 214 | goto fail_unlock; |
215 | } | 215 | } |
216 | found: | 216 | found: |
217 | inet_sk(sk)->num = snum; | 217 | inet_sk(sk)->inet_num = snum; |
218 | sk->sk_hash = snum; | 218 | sk->sk_hash = snum; |
219 | if (sk_unhashed(sk)) { | 219 | if (sk_unhashed(sk)) { |
220 | sk_nulls_add_node_rcu(sk, &hslot->head); | 220 | sk_nulls_add_node_rcu(sk, &hslot->head); |
@@ -233,8 +233,8 @@ static int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2) | |||
233 | struct inet_sock *inet1 = inet_sk(sk1), *inet2 = inet_sk(sk2); | 233 | struct inet_sock *inet1 = inet_sk(sk1), *inet2 = inet_sk(sk2); |
234 | 234 | ||
235 | return (!ipv6_only_sock(sk2) && | 235 | return (!ipv6_only_sock(sk2) && |
236 | (!inet1->rcv_saddr || !inet2->rcv_saddr || | 236 | (!inet1->inet_rcv_saddr || !inet2->inet_rcv_saddr || |
237 | inet1->rcv_saddr == inet2->rcv_saddr)); | 237 | inet1->inet_rcv_saddr == inet2->inet_rcv_saddr)); |
238 | } | 238 | } |
239 | 239 | ||
240 | int udp_v4_get_port(struct sock *sk, unsigned short snum) | 240 | int udp_v4_get_port(struct sock *sk, unsigned short snum) |
@@ -253,18 +253,18 @@ static inline int compute_score(struct sock *sk, struct net *net, __be32 saddr, | |||
253 | struct inet_sock *inet = inet_sk(sk); | 253 | struct inet_sock *inet = inet_sk(sk); |
254 | 254 | ||
255 | score = (sk->sk_family == PF_INET ? 1 : 0); | 255 | score = (sk->sk_family == PF_INET ? 1 : 0); |
256 | if (inet->rcv_saddr) { | 256 | if (inet->inet_rcv_saddr) { |
257 | if (inet->rcv_saddr != daddr) | 257 | if (inet->inet_rcv_saddr != daddr) |
258 | return -1; | 258 | return -1; |
259 | score += 2; | 259 | score += 2; |
260 | } | 260 | } |
261 | if (inet->daddr) { | 261 | if (inet->inet_daddr) { |
262 | if (inet->daddr != saddr) | 262 | if (inet->inet_daddr != saddr) |
263 | return -1; | 263 | return -1; |
264 | score += 2; | 264 | score += 2; |
265 | } | 265 | } |
266 | if (inet->dport) { | 266 | if (inet->inet_dport) { |
267 | if (inet->dport != sport) | 267 | if (inet->inet_dport != sport) |
268 | return -1; | 268 | return -1; |
269 | score += 2; | 269 | score += 2; |
270 | } | 270 | } |
@@ -360,9 +360,10 @@ static inline struct sock *udp_v4_mcast_next(struct net *net, struct sock *sk, | |||
360 | 360 | ||
361 | if (!net_eq(sock_net(s), net) || | 361 | if (!net_eq(sock_net(s), net) || |
362 | s->sk_hash != hnum || | 362 | s->sk_hash != hnum || |
363 | (inet->daddr && inet->daddr != rmt_addr) || | 363 | (inet->inet_daddr && inet->inet_daddr != rmt_addr) || |
364 | (inet->dport != rmt_port && inet->dport) || | 364 | (inet->inet_dport != rmt_port && inet->inet_dport) || |
365 | (inet->rcv_saddr && inet->rcv_saddr != loc_addr) || | 365 | (inet->inet_rcv_saddr && |
366 | inet->inet_rcv_saddr != loc_addr) || | ||
366 | ipv6_only_sock(s) || | 367 | ipv6_only_sock(s) || |
367 | (s->sk_bound_dev_if && s->sk_bound_dev_if != dif)) | 368 | (s->sk_bound_dev_if && s->sk_bound_dev_if != dif)) |
368 | continue; | 369 | continue; |
@@ -646,14 +647,14 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
646 | } else { | 647 | } else { |
647 | if (sk->sk_state != TCP_ESTABLISHED) | 648 | if (sk->sk_state != TCP_ESTABLISHED) |
648 | return -EDESTADDRREQ; | 649 | return -EDESTADDRREQ; |
649 | daddr = inet->daddr; | 650 | daddr = inet->inet_daddr; |
650 | dport = inet->dport; | 651 | dport = inet->inet_dport; |
651 | /* Open fast path for connected socket. | 652 | /* Open fast path for connected socket. |
652 | Route will not be used, if at least one option is set. | 653 | Route will not be used, if at least one option is set. |
653 | */ | 654 | */ |
654 | connected = 1; | 655 | connected = 1; |
655 | } | 656 | } |
656 | ipc.addr = inet->saddr; | 657 | ipc.addr = inet->inet_saddr; |
657 | 658 | ||
658 | ipc.oif = sk->sk_bound_dev_if; | 659 | ipc.oif = sk->sk_bound_dev_if; |
659 | err = sock_tx_timestamp(msg, sk, &ipc.shtx); | 660 | err = sock_tx_timestamp(msg, sk, &ipc.shtx); |
@@ -708,7 +709,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
708 | .proto = sk->sk_protocol, | 709 | .proto = sk->sk_protocol, |
709 | .flags = inet_sk_flowi_flags(sk), | 710 | .flags = inet_sk_flowi_flags(sk), |
710 | .uli_u = { .ports = | 711 | .uli_u = { .ports = |
711 | { .sport = inet->sport, | 712 | { .sport = inet->inet_sport, |
712 | .dport = dport } } }; | 713 | .dport = dport } } }; |
713 | struct net *net = sock_net(sk); | 714 | struct net *net = sock_net(sk); |
714 | 715 | ||
@@ -752,7 +753,7 @@ back_from_confirm: | |||
752 | inet->cork.fl.fl4_dst = daddr; | 753 | inet->cork.fl.fl4_dst = daddr; |
753 | inet->cork.fl.fl_ip_dport = dport; | 754 | inet->cork.fl.fl_ip_dport = dport; |
754 | inet->cork.fl.fl4_src = saddr; | 755 | inet->cork.fl.fl4_src = saddr; |
755 | inet->cork.fl.fl_ip_sport = inet->sport; | 756 | inet->cork.fl.fl_ip_sport = inet->inet_sport; |
756 | up->pending = AF_INET; | 757 | up->pending = AF_INET; |
757 | 758 | ||
758 | do_append_data: | 759 | do_append_data: |
@@ -1029,15 +1030,15 @@ int udp_disconnect(struct sock *sk, int flags) | |||
1029 | */ | 1030 | */ |
1030 | 1031 | ||
1031 | sk->sk_state = TCP_CLOSE; | 1032 | sk->sk_state = TCP_CLOSE; |
1032 | inet->daddr = 0; | 1033 | inet->inet_daddr = 0; |
1033 | inet->dport = 0; | 1034 | inet->inet_dport = 0; |
1034 | sk->sk_bound_dev_if = 0; | 1035 | sk->sk_bound_dev_if = 0; |
1035 | if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK)) | 1036 | if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK)) |
1036 | inet_reset_saddr(sk); | 1037 | inet_reset_saddr(sk); |
1037 | 1038 | ||
1038 | if (!(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) { | 1039 | if (!(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) { |
1039 | sk->sk_prot->unhash(sk); | 1040 | sk->sk_prot->unhash(sk); |
1040 | inet->sport = 0; | 1041 | inet->inet_sport = 0; |
1041 | } | 1042 | } |
1042 | sk_dst_reset(sk); | 1043 | sk_dst_reset(sk); |
1043 | return 0; | 1044 | return 0; |
@@ -1053,7 +1054,7 @@ void udp_lib_unhash(struct sock *sk) | |||
1053 | 1054 | ||
1054 | spin_lock_bh(&hslot->lock); | 1055 | spin_lock_bh(&hslot->lock); |
1055 | if (sk_nulls_del_node_init_rcu(sk)) { | 1056 | if (sk_nulls_del_node_init_rcu(sk)) { |
1056 | inet_sk(sk)->num = 0; | 1057 | inet_sk(sk)->inet_num = 0; |
1057 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); | 1058 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); |
1058 | } | 1059 | } |
1059 | spin_unlock_bh(&hslot->lock); | 1060 | spin_unlock_bh(&hslot->lock); |
@@ -1752,10 +1753,10 @@ static void udp4_format_sock(struct sock *sp, struct seq_file *f, | |||
1752 | int bucket, int *len) | 1753 | int bucket, int *len) |
1753 | { | 1754 | { |
1754 | struct inet_sock *inet = inet_sk(sp); | 1755 | struct inet_sock *inet = inet_sk(sp); |
1755 | __be32 dest = inet->daddr; | 1756 | __be32 dest = inet->inet_daddr; |
1756 | __be32 src = inet->rcv_saddr; | 1757 | __be32 src = inet->inet_rcv_saddr; |
1757 | __u16 destp = ntohs(inet->dport); | 1758 | __u16 destp = ntohs(inet->inet_dport); |
1758 | __u16 srcp = ntohs(inet->sport); | 1759 | __u16 srcp = ntohs(inet->inet_sport); |
1759 | 1760 | ||
1760 | seq_printf(f, "%5d: %08X:%04X %08X:%04X" | 1761 | seq_printf(f, "%5d: %08X:%04X %08X:%04X" |
1761 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d%n", | 1762 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d%n", |