Skip to content

Commit c2bb06d

Browse files
edumazetdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f69b923 commit c2bb06d

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

include/net/ip6_checksum.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,14 @@ static inline void __tcp_v6_send_check(struct sk_buff *skb,
6666
}
6767
}
6868

69+
#if IS_ENABLED(CONFIG_IPV6)
6970
static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)
7071
{
7172
struct ipv6_pinfo *np = inet6_sk(sk);
7273

7374
__tcp_v6_send_check(skb, &np->saddr, &sk->sk_v6_daddr);
7475
}
76+
#endif
7577

7678
int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto);
7779
#endif

net/ipv4/ping.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,12 @@ int ping_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
415415
(int)sk->sk_bound_dev_if);
416416

417417
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)
421419
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
422424

423425
if (snum)
424426
sk->sk_userlocks |= SOCK_BINDPORT_LOCK;

net/ipv4/tcp_metrics.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,12 @@ static struct tcp_metrics_block *__tcp_get_metrics_tw(struct inet_timewait_sock
251251
addr.addr.a4 = tw->tw_daddr;
252252
hash = (__force unsigned int) addr.addr.a4;
253253
break;
254+
#if IS_ENABLED(CONFIG_IPV6)
254255
case AF_INET6:
255256
*(struct in6_addr *)addr.addr.a6 = tw->tw_v6_daddr;
256257
hash = ipv6_addr_hash(&tw->tw_v6_daddr);
257258
break;
259+
#endif
258260
default:
259261
return NULL;
260262
}
@@ -286,10 +288,12 @@ static struct tcp_metrics_block *tcp_get_metrics(struct sock *sk,
286288
addr.addr.a4 = inet_sk(sk)->inet_daddr;
287289
hash = (__force unsigned int) addr.addr.a4;
288290
break;
291+
#if IS_ENABLED(CONFIG_IPV6)
289292
case AF_INET6:
290293
*(struct in6_addr *)addr.addr.a6 = sk->sk_v6_daddr;
291294
hash = ipv6_addr_hash(&sk->sk_v6_daddr);
292295
break;
296+
#endif
293297
default:
294298
return NULL;
295299
}

net/sunrpc/svcsock.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,14 @@ static int svc_one_sock_name(struct svc_sock *svsk, char *buf, int remaining)
291291
&inet_sk(sk)->inet_rcv_saddr,
292292
inet_sk(sk)->inet_num);
293293
break;
294+
#if IS_ENABLED(CONFIG_IPV6)
294295
case PF_INET6:
295296
len = snprintf(buf, remaining, "ipv6 %s %pI6 %d\n",
296297
proto_name,
297298
&sk->sk_v6_rcv_saddr,
298299
inet_sk(sk)->inet_num);
299300
break;
301+
#endif
300302
default:
301303
len = snprintf(buf, remaining, "*unknown-%d*\n",
302304
sk->sk_family);

security/lsm_audit.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
302302
"faddr", "fport");
303303
break;
304304
}
305+
#if IS_ENABLED(CONFIG_IPV6)
305306
case AF_INET6: {
306307
struct inet_sock *inet = inet_sk(sk);
307308

@@ -313,6 +314,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
313314
"faddr", "fport");
314315
break;
315316
}
317+
#endif
316318
case AF_UNIX:
317319
u = unix_sk(sk);
318320
if (u->path.dentry) {

0 commit comments

Comments
 (0)