Commit c2bb06db authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

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: default avatarWu Fengguang <fengguang.wu@intel.com>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f69b923a
...@@ -66,12 +66,14 @@ static inline void __tcp_v6_send_check(struct sk_buff *skb, ...@@ -66,12 +66,14 @@ static inline void __tcp_v6_send_check(struct sk_buff *skb,
} }
} }
#if IS_ENABLED(CONFIG_IPV6)
static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb) static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)
{ {
struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk);
__tcp_v6_send_check(skb, &np->saddr, &sk->sk_v6_daddr); __tcp_v6_send_check(skb, &np->saddr, &sk->sk_v6_daddr);
} }
#endif
int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto); int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto);
#endif #endif
...@@ -415,10 +415,12 @@ int ping_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -415,10 +415,12 @@ int ping_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
(int)sk->sk_bound_dev_if); (int)sk->sk_bound_dev_if);
err = 0; err = 0;
if ((sk->sk_family == AF_INET && isk->inet_rcv_saddr) || if (sk->sk_family == AF_INET && isk->inet_rcv_saddr)
(sk->sk_family == AF_INET6 &&
!ipv6_addr_any(&sk->sk_v6_rcv_saddr)))
sk->sk_userlocks |= SOCK_BINDADDR_LOCK; sk->sk_userlocks |= SOCK_BINDADDR_LOCK;
#if IS_ENABLED(CONFIG_IPV6)
if (sk->sk_family == AF_INET6 && !ipv6_addr_any(&sk->sk_v6_rcv_saddr))
sk->sk_userlocks |= SOCK_BINDADDR_LOCK;
#endif
if (snum) if (snum)
sk->sk_userlocks |= SOCK_BINDPORT_LOCK; sk->sk_userlocks |= SOCK_BINDPORT_LOCK;
......
...@@ -251,10 +251,12 @@ static struct tcp_metrics_block *__tcp_get_metrics_tw(struct inet_timewait_sock ...@@ -251,10 +251,12 @@ static struct tcp_metrics_block *__tcp_get_metrics_tw(struct inet_timewait_sock
addr.addr.a4 = tw->tw_daddr; addr.addr.a4 = tw->tw_daddr;
hash = (__force unsigned int) addr.addr.a4; hash = (__force unsigned int) addr.addr.a4;
break; break;
#if IS_ENABLED(CONFIG_IPV6)
case AF_INET6: case AF_INET6:
*(struct in6_addr *)addr.addr.a6 = tw->tw_v6_daddr; *(struct in6_addr *)addr.addr.a6 = tw->tw_v6_daddr;
hash = ipv6_addr_hash(&tw->tw_v6_daddr); hash = ipv6_addr_hash(&tw->tw_v6_daddr);
break; break;
#endif
default: default:
return NULL; return NULL;
} }
...@@ -286,10 +288,12 @@ static struct tcp_metrics_block *tcp_get_metrics(struct sock *sk, ...@@ -286,10 +288,12 @@ static struct tcp_metrics_block *tcp_get_metrics(struct sock *sk,
addr.addr.a4 = inet_sk(sk)->inet_daddr; addr.addr.a4 = inet_sk(sk)->inet_daddr;
hash = (__force unsigned int) addr.addr.a4; hash = (__force unsigned int) addr.addr.a4;
break; break;
#if IS_ENABLED(CONFIG_IPV6)
case AF_INET6: case AF_INET6:
*(struct in6_addr *)addr.addr.a6 = sk->sk_v6_daddr; *(struct in6_addr *)addr.addr.a6 = sk->sk_v6_daddr;
hash = ipv6_addr_hash(&sk->sk_v6_daddr); hash = ipv6_addr_hash(&sk->sk_v6_daddr);
break; break;
#endif
default: default:
return NULL; return NULL;
} }
......
...@@ -291,12 +291,14 @@ static int svc_one_sock_name(struct svc_sock *svsk, char *buf, int remaining) ...@@ -291,12 +291,14 @@ static int svc_one_sock_name(struct svc_sock *svsk, char *buf, int remaining)
&inet_sk(sk)->inet_rcv_saddr, &inet_sk(sk)->inet_rcv_saddr,
inet_sk(sk)->inet_num); inet_sk(sk)->inet_num);
break; break;
#if IS_ENABLED(CONFIG_IPV6)
case PF_INET6: case PF_INET6:
len = snprintf(buf, remaining, "ipv6 %s %pI6 %d\n", len = snprintf(buf, remaining, "ipv6 %s %pI6 %d\n",
proto_name, proto_name,
&sk->sk_v6_rcv_saddr, &sk->sk_v6_rcv_saddr,
inet_sk(sk)->inet_num); inet_sk(sk)->inet_num);
break; break;
#endif
default: default:
len = snprintf(buf, remaining, "*unknown-%d*\n", len = snprintf(buf, remaining, "*unknown-%d*\n",
sk->sk_family); sk->sk_family);
......
...@@ -302,6 +302,7 @@ static void dump_common_audit_data(struct audit_buffer *ab, ...@@ -302,6 +302,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
"faddr", "fport"); "faddr", "fport");
break; break;
} }
#if IS_ENABLED(CONFIG_IPV6)
case AF_INET6: { case AF_INET6: {
struct inet_sock *inet = inet_sk(sk); struct inet_sock *inet = inet_sk(sk);
...@@ -313,6 +314,7 @@ static void dump_common_audit_data(struct audit_buffer *ab, ...@@ -313,6 +314,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
"faddr", "fport"); "faddr", "fport");
break; break;
} }
#endif
case AF_UNIX: case AF_UNIX:
u = unix_sk(sk); u = unix_sk(sk);
if (u->path.dentry) { if (u->path.dentry) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment