aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-12-10 04:48:31 -0500
committerDavid S. Miller <davem@davemloft.net>2011-12-11 18:25:16 -0500
commitdfd56b8b38fff3586f36232db58e1e9f7885a605 (patch)
tree64c7142ebf4625939f68bd3603f1d37bacb20a73 /net/ipv4
parent1ded132d4c3442aa3a619c94c245d7b5e0eb9731 (diff)
net: use IS_ENABLED(CONFIG_IPV6)
Instead of testing defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/inet_connection_sock.c2
-rw-r--r--net/ipv4/inet_diag.c16
-rw-r--r--net/ipv4/ip_gre.c8
-rw-r--r--net/ipv4/ip_sockglue.c6
-rw-r--r--net/ipv4/tcp_input.c2
-rw-r--r--net/ipv4/tcp_minisocks.c2
-rw-r--r--net/ipv4/tcp_timer.c2
-rw-r--r--net/ipv4/tunnel4.c10
-rw-r--r--net/ipv4/xfrm4_tunnel.c6
9 files changed, 27 insertions, 27 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index a598768c616c..2e4e24476c4c 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -418,7 +418,7 @@ static inline u32 inet_synq_hash(const __be32 raddr, const __be16 rport,
418 return jhash_2words((__force u32)raddr, (__force u32)rport, rnd) & (synq_hsize - 1); 418 return jhash_2words((__force u32)raddr, (__force u32)rport, rnd) & (synq_hsize - 1);
419} 419}
420 420
421#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 421#if IS_ENABLED(CONFIG_IPV6)
422#define AF_INET_FAMILY(fam) ((fam) == AF_INET) 422#define AF_INET_FAMILY(fam) ((fam) == AF_INET)
423#else 423#else
424#define AF_INET_FAMILY(fam) 1 424#define AF_INET_FAMILY(fam) 1
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 9b3e0b179cd2..575e28c57cc9 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -116,7 +116,7 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
116 if (ext & (1 << (INET_DIAG_TOS - 1))) 116 if (ext & (1 << (INET_DIAG_TOS - 1)))
117 RTA_PUT_U8(skb, INET_DIAG_TOS, inet->tos); 117 RTA_PUT_U8(skb, INET_DIAG_TOS, inet->tos);
118 118
119#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 119#if IS_ENABLED(CONFIG_IPV6)
120 if (r->idiag_family == AF_INET6) { 120 if (r->idiag_family == AF_INET6) {
121 const struct ipv6_pinfo *np = inet6_sk(sk); 121 const struct ipv6_pinfo *np = inet6_sk(sk);
122 122
@@ -234,7 +234,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
234 r->idiag_wqueue = 0; 234 r->idiag_wqueue = 0;
235 r->idiag_uid = 0; 235 r->idiag_uid = 0;
236 r->idiag_inode = 0; 236 r->idiag_inode = 0;
237#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 237#if IS_ENABLED(CONFIG_IPV6)
238 if (tw->tw_family == AF_INET6) { 238 if (tw->tw_family == AF_INET6) {
239 const struct inet6_timewait_sock *tw6 = 239 const struct inet6_timewait_sock *tw6 =
240 inet6_twsk((struct sock *)tw); 240 inet6_twsk((struct sock *)tw);
@@ -286,7 +286,7 @@ int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *in_s
286 req->id.idiag_dport, req->id.idiag_src[0], 286 req->id.idiag_dport, req->id.idiag_src[0],
287 req->id.idiag_sport, req->id.idiag_if); 287 req->id.idiag_sport, req->id.idiag_if);
288 } 288 }
289#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 289#if IS_ENABLED(CONFIG_IPV6)
290 else if (req->sdiag_family == AF_INET6) { 290 else if (req->sdiag_family == AF_INET6) {
291 sk = inet6_lookup(&init_net, hashinfo, 291 sk = inet6_lookup(&init_net, hashinfo,
292 (struct in6_addr *)req->id.idiag_dst, 292 (struct in6_addr *)req->id.idiag_dst,
@@ -473,7 +473,7 @@ int inet_diag_bc_sk(const struct nlattr *bc, struct sock *sk)
473 return 1; 473 return 1;
474 474
475 entry.family = sk->sk_family; 475 entry.family = sk->sk_family;
476#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 476#if IS_ENABLED(CONFIG_IPV6)
477 if (entry.family == AF_INET6) { 477 if (entry.family == AF_INET6) {
478 struct ipv6_pinfo *np = inet6_sk(sk); 478 struct ipv6_pinfo *np = inet6_sk(sk);
479 479
@@ -571,7 +571,7 @@ static int inet_twsk_diag_dump(struct inet_timewait_sock *tw,
571 struct inet_diag_entry entry; 571 struct inet_diag_entry entry;
572 572
573 entry.family = tw->tw_family; 573 entry.family = tw->tw_family;
574#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 574#if IS_ENABLED(CONFIG_IPV6)
575 if (tw->tw_family == AF_INET6) { 575 if (tw->tw_family == AF_INET6) {
576 struct inet6_timewait_sock *tw6 = 576 struct inet6_timewait_sock *tw6 =
577 inet6_twsk((struct sock *)tw); 577 inet6_twsk((struct sock *)tw);
@@ -633,7 +633,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk,
633 r->idiag_wqueue = 0; 633 r->idiag_wqueue = 0;
634 r->idiag_uid = sock_i_uid(sk); 634 r->idiag_uid = sock_i_uid(sk);
635 r->idiag_inode = 0; 635 r->idiag_inode = 0;
636#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 636#if IS_ENABLED(CONFIG_IPV6)
637 if (r->idiag_family == AF_INET6) { 637 if (r->idiag_family == AF_INET6) {
638 *(struct in6_addr *)r->id.idiag_src = inet6_rsk(req)->loc_addr; 638 *(struct in6_addr *)r->id.idiag_src = inet6_rsk(req)->loc_addr;
639 *(struct in6_addr *)r->id.idiag_dst = inet6_rsk(req)->rmt_addr; 639 *(struct in6_addr *)r->id.idiag_dst = inet6_rsk(req)->rmt_addr;
@@ -695,13 +695,13 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk,
695 695
696 if (bc) { 696 if (bc) {
697 entry.saddr = 697 entry.saddr =
698#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 698#if IS_ENABLED(CONFIG_IPV6)
699 (entry.family == AF_INET6) ? 699 (entry.family == AF_INET6) ?
700 inet6_rsk(req)->loc_addr.s6_addr32 : 700 inet6_rsk(req)->loc_addr.s6_addr32 :
701#endif 701#endif
702 &ireq->loc_addr; 702 &ireq->loc_addr;
703 entry.daddr = 703 entry.daddr =
704#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 704#if IS_ENABLED(CONFIG_IPV6)
705 (entry.family == AF_INET6) ? 705 (entry.family == AF_INET6) ?
706 inet6_rsk(req)->rmt_addr.s6_addr32 : 706 inet6_rsk(req)->rmt_addr.s6_addr32 :
707#endif 707#endif
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index fe070c1593ab..2b53a1f7abf6 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -46,7 +46,7 @@
46#include <net/rtnetlink.h> 46#include <net/rtnetlink.h>
47#include <net/gre.h> 47#include <net/gre.h>
48 48
49#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 49#if IS_ENABLED(CONFIG_IPV6)
50#include <net/ipv6.h> 50#include <net/ipv6.h>
51#include <net/ip6_fib.h> 51#include <net/ip6_fib.h>
52#include <net/ip6_route.h> 52#include <net/ip6_route.h>
@@ -729,7 +729,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
729 if ((dst = rt->rt_gateway) == 0) 729 if ((dst = rt->rt_gateway) == 0)
730 goto tx_error_icmp; 730 goto tx_error_icmp;
731 } 731 }
732#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 732#if IS_ENABLED(CONFIG_IPV6)
733 else if (skb->protocol == htons(ETH_P_IPV6)) { 733 else if (skb->protocol == htons(ETH_P_IPV6)) {
734 struct neighbour *neigh = dst_get_neighbour_noref(skb_dst(skb)); 734 struct neighbour *neigh = dst_get_neighbour_noref(skb_dst(skb));
735 const struct in6_addr *addr6; 735 const struct in6_addr *addr6;
@@ -799,7 +799,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
799 goto tx_error; 799 goto tx_error;
800 } 800 }
801 } 801 }
802#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 802#if IS_ENABLED(CONFIG_IPV6)
803 else if (skb->protocol == htons(ETH_P_IPV6)) { 803 else if (skb->protocol == htons(ETH_P_IPV6)) {
804 struct rt6_info *rt6 = (struct rt6_info *)skb_dst(skb); 804 struct rt6_info *rt6 = (struct rt6_info *)skb_dst(skb);
805 805
@@ -875,7 +875,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
875 if ((iph->ttl = tiph->ttl) == 0) { 875 if ((iph->ttl = tiph->ttl) == 0) {
876 if (skb->protocol == htons(ETH_P_IP)) 876 if (skb->protocol == htons(ETH_P_IP))
877 iph->ttl = old_iph->ttl; 877 iph->ttl = old_iph->ttl;
878#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 878#if IS_ENABLED(CONFIG_IPV6)
879 else if (skb->protocol == htons(ETH_P_IPV6)) 879 else if (skb->protocol == htons(ETH_P_IPV6))
880 iph->ttl = ((const struct ipv6hdr *)old_iph)->hop_limit; 880 iph->ttl = ((const struct ipv6hdr *)old_iph)->hop_limit;
881#endif 881#endif
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 80d5fa450210..8aa87c19fa00 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -37,7 +37,7 @@
37#include <net/route.h> 37#include <net/route.h>
38#include <net/xfrm.h> 38#include <net/xfrm.h>
39#include <net/compat.h> 39#include <net/compat.h>
40#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 40#if IS_ENABLED(CONFIG_IPV6)
41#include <net/transp_v6.h> 41#include <net/transp_v6.h>
42#endif 42#endif
43 43
@@ -508,7 +508,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
508 sock_owned_by_user(sk)); 508 sock_owned_by_user(sk));
509 if (inet->is_icsk) { 509 if (inet->is_icsk) {
510 struct inet_connection_sock *icsk = inet_csk(sk); 510 struct inet_connection_sock *icsk = inet_csk(sk);
511#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 511#if IS_ENABLED(CONFIG_IPV6)
512 if (sk->sk_family == PF_INET || 512 if (sk->sk_family == PF_INET ||
513 (!((1 << sk->sk_state) & 513 (!((1 << sk->sk_state) &
514 (TCPF_LISTEN | TCPF_CLOSE)) && 514 (TCPF_LISTEN | TCPF_CLOSE)) &&
@@ -519,7 +519,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
519 if (opt) 519 if (opt)
520 icsk->icsk_ext_hdr_len += opt->opt.optlen; 520 icsk->icsk_ext_hdr_len += opt->opt.optlen;
521 icsk->icsk_sync_mss(sk, icsk->icsk_pmtu_cookie); 521 icsk->icsk_sync_mss(sk, icsk->icsk_pmtu_cookie);
522#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 522#if IS_ENABLED(CONFIG_IPV6)
523 } 523 }
524#endif 524#endif
525 } 525 }
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 0cbb44076cfa..b9cbc351c511 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2663,7 +2663,7 @@ static void DBGUNDO(struct sock *sk, const char *msg)
2663 tp->snd_ssthresh, tp->prior_ssthresh, 2663 tp->snd_ssthresh, tp->prior_ssthresh,
2664 tp->packets_out); 2664 tp->packets_out);
2665 } 2665 }
2666#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 2666#if IS_ENABLED(CONFIG_IPV6)
2667 else if (sk->sk_family == AF_INET6) { 2667 else if (sk->sk_family == AF_INET6) {
2668 struct ipv6_pinfo *np = inet6_sk(sk); 2668 struct ipv6_pinfo *np = inet6_sk(sk);
2669 printk(KERN_DEBUG "Undo %s %pI6/%u c%u l%u ss%u/%u p%u\n", 2669 printk(KERN_DEBUG "Undo %s %pI6/%u c%u l%u ss%u/%u p%u\n",
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 9dc146e5ed65..550e755747e0 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -336,7 +336,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo)
336 tcptw->tw_ts_recent = tp->rx_opt.ts_recent; 336 tcptw->tw_ts_recent = tp->rx_opt.ts_recent;
337 tcptw->tw_ts_recent_stamp = tp->rx_opt.ts_recent_stamp; 337 tcptw->tw_ts_recent_stamp = tp->rx_opt.ts_recent_stamp;
338 338
339#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 339#if IS_ENABLED(CONFIG_IPV6)
340 if (tw->tw_family == PF_INET6) { 340 if (tw->tw_family == PF_INET6) {
341 struct ipv6_pinfo *np = inet6_sk(sk); 341 struct ipv6_pinfo *np = inet6_sk(sk);
342 struct inet6_timewait_sock *tw6; 342 struct inet6_timewait_sock *tw6;
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 2e0f0af76c19..aa39a692f4c8 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -340,7 +340,7 @@ void tcp_retransmit_timer(struct sock *sk)
340 &inet->inet_daddr, ntohs(inet->inet_dport), 340 &inet->inet_daddr, ntohs(inet->inet_dport),
341 inet->inet_num, tp->snd_una, tp->snd_nxt); 341 inet->inet_num, tp->snd_una, tp->snd_nxt);
342 } 342 }
343#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 343#if IS_ENABLED(CONFIG_IPV6)
344 else if (sk->sk_family == AF_INET6) { 344 else if (sk->sk_family == AF_INET6) {
345 struct ipv6_pinfo *np = inet6_sk(sk); 345 struct ipv6_pinfo *np = inet6_sk(sk);
346 LIMIT_NETDEBUG(KERN_DEBUG "TCP: Peer %pI6:%u/%u unexpectedly shrunk window %u:%u (repaired)\n", 346 LIMIT_NETDEBUG(KERN_DEBUG "TCP: Peer %pI6:%u/%u unexpectedly shrunk window %u:%u (repaired)\n",
diff --git a/net/ipv4/tunnel4.c b/net/ipv4/tunnel4.c
index ac3b3ee4b07c..01775983b997 100644
--- a/net/ipv4/tunnel4.c
+++ b/net/ipv4/tunnel4.c
@@ -105,7 +105,7 @@ drop:
105 return 0; 105 return 0;
106} 106}
107 107
108#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 108#if IS_ENABLED(CONFIG_IPV6)
109static int tunnel64_rcv(struct sk_buff *skb) 109static int tunnel64_rcv(struct sk_buff *skb)
110{ 110{
111 struct xfrm_tunnel *handler; 111 struct xfrm_tunnel *handler;
@@ -134,7 +134,7 @@ static void tunnel4_err(struct sk_buff *skb, u32 info)
134 break; 134 break;
135} 135}
136 136
137#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 137#if IS_ENABLED(CONFIG_IPV6)
138static void tunnel64_err(struct sk_buff *skb, u32 info) 138static void tunnel64_err(struct sk_buff *skb, u32 info)
139{ 139{
140 struct xfrm_tunnel *handler; 140 struct xfrm_tunnel *handler;
@@ -152,7 +152,7 @@ static const struct net_protocol tunnel4_protocol = {
152 .netns_ok = 1, 152 .netns_ok = 1,
153}; 153};
154 154
155#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 155#if IS_ENABLED(CONFIG_IPV6)
156static const struct net_protocol tunnel64_protocol = { 156static const struct net_protocol tunnel64_protocol = {
157 .handler = tunnel64_rcv, 157 .handler = tunnel64_rcv,
158 .err_handler = tunnel64_err, 158 .err_handler = tunnel64_err,
@@ -167,7 +167,7 @@ static int __init tunnel4_init(void)
167 printk(KERN_ERR "tunnel4 init: can't add protocol\n"); 167 printk(KERN_ERR "tunnel4 init: can't add protocol\n");
168 return -EAGAIN; 168 return -EAGAIN;
169 } 169 }
170#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 170#if IS_ENABLED(CONFIG_IPV6)
171 if (inet_add_protocol(&tunnel64_protocol, IPPROTO_IPV6)) { 171 if (inet_add_protocol(&tunnel64_protocol, IPPROTO_IPV6)) {
172 printk(KERN_ERR "tunnel64 init: can't add protocol\n"); 172 printk(KERN_ERR "tunnel64 init: can't add protocol\n");
173 inet_del_protocol(&tunnel4_protocol, IPPROTO_IPIP); 173 inet_del_protocol(&tunnel4_protocol, IPPROTO_IPIP);
@@ -179,7 +179,7 @@ static int __init tunnel4_init(void)
179 179
180static void __exit tunnel4_fini(void) 180static void __exit tunnel4_fini(void)
181{ 181{
182#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 182#if IS_ENABLED(CONFIG_IPV6)
183 if (inet_del_protocol(&tunnel64_protocol, IPPROTO_IPV6)) 183 if (inet_del_protocol(&tunnel64_protocol, IPPROTO_IPV6))
184 printk(KERN_ERR "tunnel64 close: can't remove protocol\n"); 184 printk(KERN_ERR "tunnel64 close: can't remove protocol\n");
185#endif 185#endif
diff --git a/net/ipv4/xfrm4_tunnel.c b/net/ipv4/xfrm4_tunnel.c
index 82806455e859..9247d9d70e9d 100644
--- a/net/ipv4/xfrm4_tunnel.c
+++ b/net/ipv4/xfrm4_tunnel.c
@@ -64,7 +64,7 @@ static struct xfrm_tunnel xfrm_tunnel_handler __read_mostly = {
64 .priority = 2, 64 .priority = 2,
65}; 65};
66 66
67#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 67#if IS_ENABLED(CONFIG_IPV6)
68static struct xfrm_tunnel xfrm64_tunnel_handler __read_mostly = { 68static struct xfrm_tunnel xfrm64_tunnel_handler __read_mostly = {
69 .handler = xfrm_tunnel_rcv, 69 .handler = xfrm_tunnel_rcv,
70 .err_handler = xfrm_tunnel_err, 70 .err_handler = xfrm_tunnel_err,
@@ -84,7 +84,7 @@ static int __init ipip_init(void)
84 xfrm_unregister_type(&ipip_type, AF_INET); 84 xfrm_unregister_type(&ipip_type, AF_INET);
85 return -EAGAIN; 85 return -EAGAIN;
86 } 86 }
87#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 87#if IS_ENABLED(CONFIG_IPV6)
88 if (xfrm4_tunnel_register(&xfrm64_tunnel_handler, AF_INET6)) { 88 if (xfrm4_tunnel_register(&xfrm64_tunnel_handler, AF_INET6)) {
89 printk(KERN_INFO "ipip init: can't add xfrm handler for AF_INET6\n"); 89 printk(KERN_INFO "ipip init: can't add xfrm handler for AF_INET6\n");
90 xfrm4_tunnel_deregister(&xfrm_tunnel_handler, AF_INET); 90 xfrm4_tunnel_deregister(&xfrm_tunnel_handler, AF_INET);
@@ -97,7 +97,7 @@ static int __init ipip_init(void)
97 97
98static void __exit ipip_fini(void) 98static void __exit ipip_fini(void)
99{ 99{
100#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 100#if IS_ENABLED(CONFIG_IPV6)
101 if (xfrm4_tunnel_deregister(&xfrm64_tunnel_handler, AF_INET6)) 101 if (xfrm4_tunnel_deregister(&xfrm64_tunnel_handler, AF_INET6))
102 printk(KERN_INFO "ipip close: can't remove xfrm handler for AF_INET6\n"); 102 printk(KERN_INFO "ipip close: can't remove xfrm handler for AF_INET6\n");
103#endif 103#endif