Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: use IS_ENABLED() macro

replace:
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
with
#if IS_ENABLED(CONFIG_NF_CT_NETLINK)

replace:
#if !defined(CONFIG_NF_NAT) && !defined(CONFIG_NF_NAT_MODULE)
with
#if !IS_ENABLED(CONFIG_NF_NAT)

replace:
#if !defined(CONFIG_NF_CONNTRACK) && !defined(CONFIG_NF_CONNTRACK_MODULE)
with
#if !IS_ENABLED(CONFIG_NF_CONNTRACK)

And add missing:
IS_ENABLED(CONFIG_NF_CT_NETLINK)

in net/ipv{4,6}/netfilter/nf_nat_l3proto_ipv{4,6}.c

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Duan Jiong and committed by
Pablo Neira Ayuso
24de3d37 5cbfda20

+25 -17
+2 -2
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
··· 314 314 return -ENOENT; 315 315 } 316 316 317 - #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) 317 + #if IS_ENABLED(CONFIG_NF_CT_NETLINK) 318 318 319 319 #include <linux/netfilter/nfnetlink.h> 320 320 #include <linux/netfilter/nfnetlink_conntrack.h> ··· 388 388 .invert_tuple = ipv4_invert_tuple, 389 389 .print_tuple = ipv4_print_tuple, 390 390 .get_l4proto = ipv4_get_l4proto, 391 - #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) 391 + #if IS_ENABLED(CONFIG_NF_CT_NETLINK) 392 392 .tuple_to_nlattr = ipv4_tuple_to_nlattr, 393 393 .nlattr_tuple_size = ipv4_nlattr_tuple_size, 394 394 .nlattr_to_tuple = ipv4_nlattr_to_tuple,
+2 -2
net/ipv4/netfilter/nf_conntrack_proto_icmp.c
··· 226 226 return icmp_error_message(net, tmpl, skb, ctinfo, hooknum); 227 227 } 228 228 229 - #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) 229 + #if IS_ENABLED(CONFIG_NF_CT_NETLINK) 230 230 231 231 #include <linux/netfilter/nfnetlink.h> 232 232 #include <linux/netfilter/nfnetlink_conntrack.h> ··· 408 408 .error = icmp_error, 409 409 .destroy = NULL, 410 410 .me = NULL, 411 - #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) 411 + #if IS_ENABLED(CONFIG_NF_CT_NETLINK) 412 412 .tuple_to_nlattr = icmp_tuple_to_nlattr, 413 413 .nlattr_tuple_size = icmp_nlattr_tuple_size, 414 414 .nlattr_to_tuple = icmp_nlattr_to_tuple,
+4 -4
net/ipv4/netfilter/nf_defrag_ipv4.c
··· 17 17 #include <linux/netfilter_bridge.h> 18 18 #include <linux/netfilter_ipv4.h> 19 19 #include <net/netfilter/ipv4/nf_defrag_ipv4.h> 20 - #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 20 + #if IS_ENABLED(CONFIG_NF_CONNTRACK) 21 21 #include <net/netfilter/nf_conntrack.h> 22 22 #endif 23 23 #include <net/netfilter/nf_conntrack_zones.h> ··· 45 45 { 46 46 u16 zone = NF_CT_DEFAULT_ZONE; 47 47 48 - #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 48 + #if IS_ENABLED(CONFIG_NF_CONNTRACK) 49 49 if (skb->nfct) 50 50 zone = nf_ct_zone((struct nf_conn *)skb->nfct); 51 51 #endif ··· 74 74 inet->nodefrag) 75 75 return NF_ACCEPT; 76 76 77 - #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 78 - #if !defined(CONFIG_NF_NAT) && !defined(CONFIG_NF_NAT_MODULE) 77 + #if IS_ENABLED(CONFIG_NF_CONNTRACK) 78 + #if !IS_ENABLED(CONFIG_NF_NAT) 79 79 /* Previously seen (loopback)? Ignore. Do this before 80 80 fragment check. */ 81 81 if (skb->nfct && !nf_ct_is_template((struct nf_conn *)skb->nfct))
+4
net/ipv4/netfilter/nf_nat_l3proto_ipv4.c
··· 154 154 htons(oldlen), htons(datalen), 1); 155 155 } 156 156 157 + #if IS_ENABLED(CONFIG_NF_CT_NETLINK) 157 158 static int nf_nat_ipv4_nlattr_to_range(struct nlattr *tb[], 158 159 struct nf_nat_range *range) 159 160 { ··· 170 169 171 170 return 0; 172 171 } 172 + #endif 173 173 174 174 static const struct nf_nat_l3proto nf_nat_l3proto_ipv4 = { 175 175 .l3proto = NFPROTO_IPV4, ··· 179 177 .manip_pkt = nf_nat_ipv4_manip_pkt, 180 178 .csum_update = nf_nat_ipv4_csum_update, 181 179 .csum_recalc = nf_nat_ipv4_csum_recalc, 180 + #if IS_ENABLED(CONFIG_NF_CT_NETLINK) 182 181 .nlattr_to_range = nf_nat_ipv4_nlattr_to_range, 182 + #endif 183 183 #ifdef CONFIG_XFRM 184 184 .decode_session = nf_nat_ipv4_decode_session, 185 185 #endif
+1 -1
net/ipv4/netfilter/nf_nat_proto_gre.c
··· 124 124 .manip_pkt = gre_manip_pkt, 125 125 .in_range = nf_nat_l4proto_in_range, 126 126 .unique_tuple = gre_unique_tuple, 127 - #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) 127 + #if IS_ENABLED(CONFIG_NF_CT_NETLINK) 128 128 .nlattr_to_range = nf_nat_l4proto_nlattr_to_range, 129 129 #endif 130 130 };
+1 -1
net/ipv4/netfilter/nf_nat_proto_icmp.c
··· 77 77 .manip_pkt = icmp_manip_pkt, 78 78 .in_range = icmp_in_range, 79 79 .unique_tuple = icmp_unique_tuple, 80 - #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) 80 + #if IS_ENABLED(CONFIG_NF_CT_NETLINK) 81 81 .nlattr_to_range = nf_nat_l4proto_nlattr_to_range, 82 82 #endif 83 83 };
+4
net/ipv6/netfilter/nf_nat_l3proto_ipv6.c
··· 158 158 htons(oldlen), htons(datalen), 1); 159 159 } 160 160 161 + #if IS_ENABLED(CONFIG_NF_CT_NETLINK) 161 162 static int nf_nat_ipv6_nlattr_to_range(struct nlattr *tb[], 162 163 struct nf_nat_range *range) 163 164 { ··· 176 175 177 176 return 0; 178 177 } 178 + #endif 179 179 180 180 static const struct nf_nat_l3proto nf_nat_l3proto_ipv6 = { 181 181 .l3proto = NFPROTO_IPV6, ··· 185 183 .manip_pkt = nf_nat_ipv6_manip_pkt, 186 184 .csum_update = nf_nat_ipv6_csum_update, 187 185 .csum_recalc = nf_nat_ipv6_csum_recalc, 186 + #if IS_ENABLED(CONFIG_NF_CT_NETLINK) 188 187 .nlattr_to_range = nf_nat_ipv6_nlattr_to_range, 188 + #endif 189 189 #ifdef CONFIG_XFRM 190 190 .decode_session = nf_nat_ipv6_decode_session, 191 191 #endif
+1 -1
net/netfilter/nf_nat_core.c
··· 677 677 .flags = NF_CT_EXT_F_PREALLOC, 678 678 }; 679 679 680 - #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) 680 + #if IS_ENABLED(CONFIG_NF_CT_NETLINK) 681 681 682 682 #include <linux/netfilter/nfnetlink.h> 683 683 #include <linux/netfilter/nfnetlink_conntrack.h>
+1 -1
net/netfilter/nf_nat_proto_common.c
··· 95 95 } 96 96 EXPORT_SYMBOL_GPL(nf_nat_l4proto_unique_tuple); 97 97 98 - #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) 98 + #if IS_ENABLED(CONFIG_NF_CT_NETLINK) 99 99 int nf_nat_l4proto_nlattr_to_range(struct nlattr *tb[], 100 100 struct nf_nat_range *range) 101 101 {
+1 -1
net/netfilter/nf_nat_proto_dccp.c
··· 78 78 .manip_pkt = dccp_manip_pkt, 79 79 .in_range = nf_nat_l4proto_in_range, 80 80 .unique_tuple = dccp_unique_tuple, 81 - #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) 81 + #if IS_ENABLED(CONFIG_NF_CT_NETLINK) 82 82 .nlattr_to_range = nf_nat_l4proto_nlattr_to_range, 83 83 #endif 84 84 };
+1 -1
net/netfilter/nf_nat_proto_sctp.c
··· 59 59 .manip_pkt = sctp_manip_pkt, 60 60 .in_range = nf_nat_l4proto_in_range, 61 61 .unique_tuple = sctp_unique_tuple, 62 - #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) 62 + #if IS_ENABLED(CONFIG_NF_CT_NETLINK) 63 63 .nlattr_to_range = nf_nat_l4proto_nlattr_to_range, 64 64 #endif 65 65 };
+1 -1
net/netfilter/nf_nat_proto_tcp.c
··· 79 79 .manip_pkt = tcp_manip_pkt, 80 80 .in_range = nf_nat_l4proto_in_range, 81 81 .unique_tuple = tcp_unique_tuple, 82 - #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) 82 + #if IS_ENABLED(CONFIG_NF_CT_NETLINK) 83 83 .nlattr_to_range = nf_nat_l4proto_nlattr_to_range, 84 84 #endif 85 85 };
+1 -1
net/netfilter/nf_nat_proto_udp.c
··· 70 70 .manip_pkt = udp_manip_pkt, 71 71 .in_range = nf_nat_l4proto_in_range, 72 72 .unique_tuple = udp_unique_tuple, 73 - #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) 73 + #if IS_ENABLED(CONFIG_NF_CT_NETLINK) 74 74 .nlattr_to_range = nf_nat_l4proto_nlattr_to_range, 75 75 #endif 76 76 };
+1 -1
net/netfilter/nf_nat_proto_udplite.c
··· 69 69 .manip_pkt = udplite_manip_pkt, 70 70 .in_range = nf_nat_l4proto_in_range, 71 71 .unique_tuple = udplite_unique_tuple, 72 - #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) 72 + #if IS_ENABLED(CONFIG_NF_CT_NETLINK) 73 73 .nlattr_to_range = nf_nat_l4proto_nlattr_to_range, 74 74 #endif 75 75 };