When either CONFIG_IPV6 or CONFIG_SYN_COOKIES are disabled, the kernel fails to build: include/linux/netfilter_ipv6.h:180:9: error: implicit declaration of function '__cookie_v6_init_sequence' [-Werror,-Wimplicit-function-declaration] return __cookie_v6_init_sequence(iph, th, mssp); include/linux/netfilter_ipv6.h:194:9: error: implicit declaration of function '__cookie_v6_check' [-Werror,-Wimplicit-function-declaration] return __cookie_v6_check(iph, th, cookie); net/ipv6/netfilter.c:237:26: error: use of undeclared identifier '__cookie_v6_init_sequence'; did you mean 'cookie_init_sequence'? net/ipv6/netfilter.c:238:21: error: use of undeclared identifier '__cookie_v6_check'; did you mean '__cookie_v4_check'? Fix the IS_ENABLED() checks to match the function declaration and definitions for these.
Unified · Split
| @@ -163,31 +163,33 @@ static inline u32 nf_ipv6_cookie_init_sequence(const struct ipv6hdr *iph, · 162 unmodified lines | ||
| 163 | 163 | const struct tcphdr *th, |
| 164 | 164 | u16 *mssp) |
| 165 | 165 | { |
| 166 | +#if IS_ENABLED(CONFIG_SYN_COOKIES) | |
| 166 | 167 | #if IS_MODULE(CONFIG_IPV6) |
| 167 | 168 | const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops(); |
| 168 | 169 | |
| 169 | 170 | if (v6_ops) |
| 170 | 171 | return v6_ops->cookie_init_sequence(iph, th, mssp); |
| 171 | − | |
| 172 | − return 0; | |
| 173 | −#else | |
| 172 | +#elif IS_BUILTIN(CONFIG_IPV6) | |
| 174 | 173 | return __cookie_v6_init_sequence(iph, th, mssp); |
| 175 | 174 | #endif |
| 175 | +#endif | |
| 176 | + return 0; | |
| 176 | 177 | } |
| 177 | 178 | |
| 178 | 179 | static inline int nf_cookie_v6_check(const struct ipv6hdr *iph, |
| 179 | 180 | const struct tcphdr *th, __u32 cookie) |
| 180 | 181 | { |
| 182 | +#if IS_ENABLED(CONFIG_SYN_COOKIES) | |
| 181 | 183 | #if IS_MODULE(CONFIG_IPV6) |
| 182 | 184 | const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops(); |
| 183 | 185 | |
| 184 | 186 | if (v6_ops) |
| 185 | 187 | return v6_ops->cookie_v6_check(iph, th, cookie); |
| 186 | − | |
| 187 | − return 0; | |
| 188 | −#else | |
| 188 | +#elif IS_BUILTIN(CONFIG_IPV6) | |
| 189 | 189 | return __cookie_v6_check(iph, th, cookie); |
| 190 | 190 | #endif |
| 191 | +#endif | |
| 192 | + return 0; | |
| 191 | 193 | } |
| 192 | 194 | |
| 193 | 195 | __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, |
| @@ -234,8 +234,10 @@ static const struct nf_ipv6_ops ipv6ops = { · 233 unmodified lines | ||
| 234 | 234 | .route_me_harder = ip6_route_me_harder, |
| 235 | 235 | .dev_get_saddr = ipv6_dev_get_saddr, |
| 236 | 236 | .route = __nf_ip6_route, |
| 237 | +#if IS_ENABLED(CONFIG_SYN_COOKIES) | |
| 237 | 238 | .cookie_init_sequence = __cookie_v6_init_sequence, |
| 238 | 239 | .cookie_v6_check = __cookie_v6_check, |
| 240 | +#endif | |
| 239 | 241 | #endif |
| 240 | 242 | .route_input = ip6_route_input, |
| 241 | 243 | .fragment = ip6_fragment, |