aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/ip6_checksum.h2
-rw-r--r--net/ipv4/ping.c8
-rw-r--r--net/ipv4/tcp_metrics.c4
-rw-r--r--net/sunrpc/svcsock.c2
-rw-r--r--security/lsm_audit.c2
5 files changed, 15 insertions, 3 deletions
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h
index 1944406949ba..9e3c540c1b11 100644
--- a/include/net/ip6_checksum.h
+++ b/include/net/ip6_checksum.h
@@ -66,12 +66,14 @@ static inline void __tcp_v6_send_check(struct sk_buff *skb,
66 } 66 }
67} 67}
68 68
69#if IS_ENABLED(CONFIG_IPV6)
69static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb) 70static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)
70{ 71{
71 struct ipv6_pinfo *np = inet6_sk(sk); 72 struct ipv6_pinfo *np = inet6_sk(sk);
72 73
73 __tcp_v6_send_check(skb, &np->saddr, &sk->sk_v6_daddr); 74 __tcp_v6_send_check(skb, &np->saddr, &sk->sk_v6_daddr);
74} 75}
76#endif
75 77
76int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto); 78int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto);
77#endif 79#endif
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index ccefc07beacd..9afbdb19f4a2 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -415,10 +415,12 @@ int ping_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
415 (int)sk->sk_bound_dev_if); 415 (int)sk->sk_bound_dev_if);
416 416
417 err = 0; 417 err = 0;
418 if ((sk->sk_family == AF_INET && isk->inet_rcv_saddr) || 418 if (sk->sk_family == AF_INET && isk->inet_rcv_saddr)
419 (sk->sk_family == AF_INET6 &&
420 !ipv6_addr_any(&sk->sk_v6_rcv_saddr)))
421 sk->sk_userlocks |= SOCK_BINDADDR_LOCK; 419 sk->sk_userlocks |= SOCK_BINDADDR_LOCK;
420#if IS_ENABLED(CONFIG_IPV6)
421 if (sk->sk_family == AF_INET6 && !ipv6_addr_any(&sk->sk_v6_rcv_saddr))
422 sk->sk_userlocks |= SOCK_BINDADDR_LOCK;
423#endif
422 424
423 if (snum) 425 if (snum)
424 sk->sk_userlocks |= SOCK_BINDPORT_LOCK; 426 sk->sk_userlocks |= SOCK_BINDPORT_LOCK;
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
index 27535fd5ea10..8fcc2cb9dba4 100644
--- a/net/ipv4/tcp_metrics.c
+++ b/net/ipv4/tcp_metrics.c
@@ -251,10 +251,12 @@ static struct tcp_metrics_block *__tcp_get_metrics_tw(struct inet_timewait_sock
251 addr.addr.a4 = tw->tw_daddr; 251 addr.addr.a4 = tw->tw_daddr;
252 hash = (__force unsigned int) addr.addr.a4; 252 hash = (__force unsigned int) addr.addr.a4;
253 break; 253 break;
254#if IS_ENABLED(CONFIG_IPV6)
254 case AF_INET6: 255 case AF_INET6:
255 *(struct in6_addr *)addr.addr.a6 = tw->tw_v6_daddr; 256 *(struct in6_addr *)addr.addr.a6 = tw->tw_v6_daddr;
256 hash = ipv6_addr_hash(&tw->tw_v6_daddr); 257 hash = ipv6_addr_hash(&tw->tw_v6_daddr);
257 break; 258 break;
259#endif
258 default: 260 default:
259 return NULL; 261 return NULL;
260 } 262 }
@@ -286,10 +288,12 @@ static struct tcp_metrics_block *tcp_get_metrics(struct sock *sk,
286 addr.addr.a4 = inet_sk(sk)->inet_daddr; 288 addr.addr.a4 = inet_sk(sk)->inet_daddr;
287 hash = (__force unsigned int) addr.addr.a4; 289 hash = (__force unsigned int) addr.addr.a4;
288 break; 290 break;
291#if IS_ENABLED(CONFIG_IPV6)
289 case AF_INET6: 292 case AF_INET6:
290 *(struct in6_addr *)addr.addr.a6 = sk->sk_v6_daddr; 293 *(struct in6_addr *)addr.addr.a6 = sk->sk_v6_daddr;
291 hash = ipv6_addr_hash(&sk->sk_v6_daddr); 294 hash = ipv6_addr_hash(&sk->sk_v6_daddr);
292 break; 295 break;
296#endif
293 default: 297 default:
294 return NULL; 298 return NULL;
295 } 299 }
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 0045c7cf1e9e..b6e59f0a9475 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -291,12 +291,14 @@ static int svc_one_sock_name(struct svc_sock *svsk, char *buf, int remaining)
291 &inet_sk(sk)->inet_rcv_saddr, 291 &inet_sk(sk)->inet_rcv_saddr,
292 inet_sk(sk)->inet_num); 292 inet_sk(sk)->inet_num);
293 break; 293 break;
294#if IS_ENABLED(CONFIG_IPV6)
294 case PF_INET6: 295 case PF_INET6:
295 len = snprintf(buf, remaining, "ipv6 %s %pI6 %d\n", 296 len = snprintf(buf, remaining, "ipv6 %s %pI6 %d\n",
296 proto_name, 297 proto_name,
297 &sk->sk_v6_rcv_saddr, 298 &sk->sk_v6_rcv_saddr,
298 inet_sk(sk)->inet_num); 299 inet_sk(sk)->inet_num);
299 break; 300 break;
301#endif
300 default: 302 default:
301 len = snprintf(buf, remaining, "*unknown-%d*\n", 303 len = snprintf(buf, remaining, "*unknown-%d*\n",
302 sk->sk_family); 304 sk->sk_family);
diff --git a/security/lsm_audit.c b/security/lsm_audit.c
index 80554fcf9fcc..234bc2ab450c 100644
--- a/security/lsm_audit.c
+++ b/security/lsm_audit.c
@@ -302,6 +302,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
302 "faddr", "fport"); 302 "faddr", "fport");
303 break; 303 break;
304 } 304 }
305#if IS_ENABLED(CONFIG_IPV6)
305 case AF_INET6: { 306 case AF_INET6: {
306 struct inet_sock *inet = inet_sk(sk); 307 struct inet_sock *inet = inet_sk(sk);
307 308
@@ -313,6 +314,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
313 "faddr", "fport"); 314 "faddr", "fport");
314 break; 315 break;
315 } 316 }
317#endif
316 case AF_UNIX: 318 case AF_UNIX:
317 u = unix_sk(sk); 319 u = unix_sk(sk);
318 if (u->path.dentry) { 320 if (u->path.dentry) {