Skip to content

Commit dfd56b8

Browse files
Eric Dumazetdavem330
authored andcommitted
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>
1 parent 1ded132 commit dfd56b8

48 files changed

Lines changed: 161 additions & 164 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎include/linux/errqueue.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct sock_extended_err {
2525
#ifdef __KERNEL__
2626

2727
#include <net/ip.h>
28-
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
28+
#if IS_ENABLED(CONFIG_IPV6)
2929
#include <linux/ipv6.h>
3030
#endif
3131

@@ -34,7 +34,7 @@ struct sock_extended_err {
3434
struct sock_exterr_skb {
3535
union {
3636
struct inet_skb_parm h4;
37-
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
37+
#if IS_ENABLED(CONFIG_IPV6)
3838
struct inet6_skb_parm h6;
3939
#endif
4040
} header;

‎include/linux/ipv6.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ struct tcp6_sock {
404404

405405
extern int inet6_sk_rebuild_header(struct sock *sk);
406406

407-
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
407+
#if IS_ENABLED(CONFIG_IPV6)
408408
static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
409409
{
410410
return inet_sk(__sk)->pinet6;
@@ -515,7 +515,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
515515
#define inet6_rcv_saddr(__sk) NULL
516516
#define tcp_twsk_ipv6only(__sk) 0
517517
#define inet_v6_ipv6only(__sk) 0
518-
#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
518+
#endif /* IS_ENABLED(CONFIG_IPV6) */
519519

520520
#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\
521521
(((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \

‎include/linux/lockd/lockd.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ static inline int __nlm_privileged_request4(const struct sockaddr *sap)
301301
return ipv4_is_loopback(sin->sin_addr.s_addr);
302302
}
303303

304-
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
304+
#if IS_ENABLED(CONFIG_IPV6)
305305
static inline int __nlm_privileged_request6(const struct sockaddr *sap)
306306
{
307307
const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
@@ -314,12 +314,12 @@ static inline int __nlm_privileged_request6(const struct sockaddr *sap)
314314

315315
return ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK;
316316
}
317-
#else /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
317+
#else /* IS_ENABLED(CONFIG_IPV6) */
318318
static inline int __nlm_privileged_request6(const struct sockaddr *sap)
319319
{
320320
return 0;
321321
}
322-
#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
322+
#endif /* IS_ENABLED(CONFIG_IPV6) */
323323

324324
/*
325325
* Ensure incoming requests are from local privileged callers.

‎include/linux/sunrpc/clnt.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ static inline bool __rpc_copy_addr4(struct sockaddr *dst,
215215
return true;
216216
}
217217

218-
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
218+
#if IS_ENABLED(CONFIG_IPV6)
219219
static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
220220
const struct sockaddr *sap2)
221221
{
@@ -240,7 +240,7 @@ static inline bool __rpc_copy_addr6(struct sockaddr *dst,
240240
dsin6->sin6_addr = ssin6->sin6_addr;
241241
return true;
242242
}
243-
#else /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
243+
#else /* !(IS_ENABLED(CONFIG_IPV6) */
244244
static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
245245
const struct sockaddr *sap2)
246246
{
@@ -252,7 +252,7 @@ static inline bool __rpc_copy_addr6(struct sockaddr *dst,
252252
{
253253
return false;
254254
}
255-
#endif /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
255+
#endif /* !(IS_ENABLED(CONFIG_IPV6) */
256256

257257
/**
258258
* rpc_cmp_addr - compare the address portion of two sockaddrs.

‎include/net/inet6_hashtables.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#define _INET6_HASHTABLES_H
1616

1717

18-
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
18+
#if IS_ENABLED(CONFIG_IPV6)
1919
#include <linux/in6.h>
2020
#include <linux/ipv6.h>
2121
#include <linux/types.h>
@@ -110,5 +110,5 @@ extern struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo
110110
const struct in6_addr *saddr, const __be16 sport,
111111
const struct in6_addr *daddr, const __be16 dport,
112112
const int dif);
113-
#endif /* defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) */
113+
#endif /* IS_ENABLED(CONFIG_IPV6) */
114114
#endif /* _INET6_HASHTABLES_H */

‎include/net/inet_sock.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ struct ip_options_data {
7171

7272
struct inet_request_sock {
7373
struct request_sock req;
74-
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
74+
#if IS_ENABLED(CONFIG_IPV6)
7575
u16 inet6_rsk_offset;
7676
#endif
7777
__be16 loc_port;
@@ -139,7 +139,7 @@ struct rtable;
139139
struct inet_sock {
140140
/* sk and pinet6 has to be the first two members of inet_sock */
141141
struct sock sk;
142-
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
142+
#if IS_ENABLED(CONFIG_IPV6)
143143
struct ipv6_pinfo *pinet6;
144144
#endif
145145
/* Socket demultiplex comparisons on incoming packets. */
@@ -188,7 +188,7 @@ static inline void __inet_sk_copy_descendant(struct sock *sk_to,
188188
memcpy(inet_sk(sk_to) + 1, inet_sk(sk_from) + 1,
189189
sk_from->sk_prot->obj_size - ancestor_size);
190190
}
191-
#if !(defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE))
191+
#if !(IS_ENABLED(CONFIG_IPV6))
192192
static inline void inet_sk_copy_descendant(struct sock *sk_to,
193193
const struct sock *sk_from)
194194
{

‎include/net/ip.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,14 +353,14 @@ static inline void ip_ipgre_mc_map(__be32 naddr, const unsigned char *broadcast,
353353
memcpy(buf, &naddr, sizeof(naddr));
354354
}
355355

356-
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
356+
#if IS_ENABLED(CONFIG_IPV6)
357357
#include <linux/ipv6.h>
358358
#endif
359359

360360
static __inline__ void inet_reset_saddr(struct sock *sk)
361361
{
362362
inet_sk(sk)->inet_rcv_saddr = inet_sk(sk)->inet_saddr = 0;
363-
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
363+
#if IS_ENABLED(CONFIG_IPV6)
364364
if (sk->sk_family == PF_INET6) {
365365
struct ipv6_pinfo *np = inet6_sk(sk);
366366

@@ -379,7 +379,7 @@ static inline int sk_mc_loop(struct sock *sk)
379379
switch (sk->sk_family) {
380380
case AF_INET:
381381
return inet_sk(sk)->mc_loop;
382-
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
382+
#if IS_ENABLED(CONFIG_IPV6)
383383
case AF_INET6:
384384
return inet6_sk(sk)->mc_loop;
385385
#endif

‎include/net/net_namespace.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct net {
7777
struct netns_packet packet;
7878
struct netns_unix unx;
7979
struct netns_ipv4 ipv4;
80-
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
80+
#if IS_ENABLED(CONFIG_IPV6)
8181
struct netns_ipv6 ipv6;
8282
#endif
8383
#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE)

‎include/net/netfilter/nf_tproxy_core.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ nf_tproxy_get_sock_v4(struct net *net, const u8 protocol,
131131
return sk;
132132
}
133133

134-
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
134+
#if IS_ENABLED(CONFIG_IPV6)
135135
static inline struct sock *
136136
nf_tproxy_get_sock_v6(struct net *net, const u8 protocol,
137137
const struct in6_addr *saddr, const struct in6_addr *daddr,

‎include/net/netns/mib.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct netns_mib {
1212
DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics);
1313
DEFINE_SNMP_STAT_ATOMIC(struct icmpmsg_mib, icmpmsg_statistics);
1414

15-
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
15+
#if IS_ENABLED(CONFIG_IPV6)
1616
struct proc_dir_entry *proc_net_devsnmp6;
1717
DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6);
1818
DEFINE_SNMP_STAT(struct udp_mib, udplite_stats_in6);

0 commit comments

Comments
 (0)