net: fix build errors if ipv6 is disabled
authorEric Dumazet <edumazet@google.com>
Wed, 9 Oct 2013 10:05:48 +0000 (03:05 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Oct 2013 17:04:03 +0000 (13:04 -0400)
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>
include/net/ip6_checksum.h
net/ipv4/ping.c
net/ipv4/tcp_metrics.c
net/sunrpc/svcsock.c
security/lsm_audit.c

index 1944406949ba3e573f928615b4d8ff37467e4ba2..9e3c540c1b110c71b65003a6aac22cc6c333be5a 100644 (file)
@@ -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)
 {
        struct ipv6_pinfo *np = inet6_sk(sk);
 
        __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);
 #endif
index ccefc07beacd37d1c83298638c3de5f31bc07ba9..9afbdb19f4a2f5dc1bccb6cf5d73db795fbf5f03 100644 (file)
@@ -415,10 +415,12 @@ int ping_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
                 (int)sk->sk_bound_dev_if);
 
        err = 0;
-       if ((sk->sk_family == AF_INET && isk->inet_rcv_saddr) ||
-           (sk->sk_family == AF_INET6 &&
-            !ipv6_addr_any(&sk->sk_v6_rcv_saddr)))
+       if (sk->sk_family == AF_INET && isk->inet_rcv_saddr)
                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)
                sk->sk_userlocks |= SOCK_BINDPORT_LOCK;
index 27535fd5ea101142bf2e11852bddd5fdf96439f4..8fcc2cb9dba4e56387111ec501c18d56d65e35fa 100644 (file)
@@ -251,10 +251,12 @@ static struct tcp_metrics_block *__tcp_get_metrics_tw(struct inet_timewait_sock
                addr.addr.a4 = tw->tw_daddr;
                hash = (__force unsigned int) addr.addr.a4;
                break;
+#if IS_ENABLED(CONFIG_IPV6)
        case AF_INET6:
                *(struct in6_addr *)addr.addr.a6 = tw->tw_v6_daddr;
                hash = ipv6_addr_hash(&tw->tw_v6_daddr);
                break;
+#endif
        default:
                return NULL;
        }
@@ -286,10 +288,12 @@ static struct tcp_metrics_block *tcp_get_metrics(struct sock *sk,
                addr.addr.a4 = inet_sk(sk)->inet_daddr;
                hash = (__force unsigned int) addr.addr.a4;
                break;
+#if IS_ENABLED(CONFIG_IPV6)
        case AF_INET6:
                *(struct in6_addr *)addr.addr.a6 = sk->sk_v6_daddr;
                hash = ipv6_addr_hash(&sk->sk_v6_daddr);
                break;
+#endif
        default:
                return NULL;
        }
index 0045c7cf1e9e9f9f96611404e0a22a6aa0b77005..b6e59f0a9475d665ea1952a8428e56ed6b06b89e 100644 (file)
@@ -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_num);
                break;
+#if IS_ENABLED(CONFIG_IPV6)
        case PF_INET6:
                len = snprintf(buf, remaining, "ipv6 %s %pI6 %d\n",
                                proto_name,
                                &sk->sk_v6_rcv_saddr,
                                inet_sk(sk)->inet_num);
                break;
+#endif
        default:
                len = snprintf(buf, remaining, "*unknown-%d*\n",
                                sk->sk_family);
index 80554fcf9fcc0db18aebd24d2fa8ce37b69503cd..234bc2ab450c61b42b1db2b53f631ab72bc48a39 100644 (file)
@@ -302,6 +302,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
                                                "faddr", "fport");
                                break;
                        }
+#if IS_ENABLED(CONFIG_IPV6)
                        case AF_INET6: {
                                struct inet_sock *inet = inet_sk(sk);
 
@@ -313,6 +314,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
                                                "faddr", "fport");
                                break;
                        }
+#endif
                        case AF_UNIX:
                                u = unix_sk(sk);
                                if (u->path.dentry) {