Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: fix build errors if ipv6 is disabled

CONFIG_IPV6=n is still a valid choice ;)

It appears we can remove dead code.

Reported-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eric Dumazet and committed by
David S. Miller
c2bb06db f69b923a

+15 -3
+2
include/net/ip6_checksum.h
··· 66 66 } 67 67 } 68 68 69 + #if IS_ENABLED(CONFIG_IPV6) 69 70 static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb) 70 71 { 71 72 struct ipv6_pinfo *np = inet6_sk(sk); 72 73 73 74 __tcp_v6_send_check(skb, &np->saddr, &sk->sk_v6_daddr); 74 75 } 76 + #endif 75 77 76 78 int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto); 77 79 #endif
+5 -3
net/ipv4/ping.c
··· 415 415 (int)sk->sk_bound_dev_if); 416 416 417 417 err = 0; 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))) 418 + if (sk->sk_family == AF_INET && isk->inet_rcv_saddr) 421 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 425 if (snum) 424 426 sk->sk_userlocks |= SOCK_BINDPORT_LOCK;
+4
net/ipv4/tcp_metrics.c
··· 251 251 addr.addr.a4 = tw->tw_daddr; 252 252 hash = (__force unsigned int) addr.addr.a4; 253 253 break; 254 + #if IS_ENABLED(CONFIG_IPV6) 254 255 case AF_INET6: 255 256 *(struct in6_addr *)addr.addr.a6 = tw->tw_v6_daddr; 256 257 hash = ipv6_addr_hash(&tw->tw_v6_daddr); 257 258 break; 259 + #endif 258 260 default: 259 261 return NULL; 260 262 } ··· 288 286 addr.addr.a4 = inet_sk(sk)->inet_daddr; 289 287 hash = (__force unsigned int) addr.addr.a4; 290 288 break; 289 + #if IS_ENABLED(CONFIG_IPV6) 291 290 case AF_INET6: 292 291 *(struct in6_addr *)addr.addr.a6 = sk->sk_v6_daddr; 293 292 hash = ipv6_addr_hash(&sk->sk_v6_daddr); 294 293 break; 294 + #endif 295 295 default: 296 296 return NULL; 297 297 }
+2
net/sunrpc/svcsock.c
··· 291 291 &inet_sk(sk)->inet_rcv_saddr, 292 292 inet_sk(sk)->inet_num); 293 293 break; 294 + #if IS_ENABLED(CONFIG_IPV6) 294 295 case PF_INET6: 295 296 len = snprintf(buf, remaining, "ipv6 %s %pI6 %d\n", 296 297 proto_name, 297 298 &sk->sk_v6_rcv_saddr, 298 299 inet_sk(sk)->inet_num); 299 300 break; 301 + #endif 300 302 default: 301 303 len = snprintf(buf, remaining, "*unknown-%d*\n", 302 304 sk->sk_family);
+2
security/lsm_audit.c
··· 302 302 "faddr", "fport"); 303 303 break; 304 304 } 305 + #if IS_ENABLED(CONFIG_IPV6) 305 306 case AF_INET6: { 306 307 struct inet_sock *inet = inet_sk(sk); 307 308 ··· 314 313 "faddr", "fport"); 315 314 break; 316 315 } 316 + #endif 317 317 case AF_UNIX: 318 318 u = unix_sk(sk); 319 319 if (u->path.dentry) {