Commit 63526e1c authored by Mathieu Xhonneux's avatar Mathieu Xhonneux Committed by Daniel Borkmann

ipv6: sr: make seg6.h includable without IPv6

include/net/seg6.h cannot be included in a source file if CONFIG_IPV6 is
not enabled:
   include/net/seg6.h: In function 'seg6_pernet':
>> include/net/seg6.h:52:14: error: 'struct net' has no member named
                                        'ipv6'; did you mean 'ipv4'?
     return net->ipv6.seg6_data;
                 ^~~~
                 ipv4

This commit makes seg6_pernet return NULL if IPv6 is not compiled, hence
allowing seg6.h to be included regardless of the configuration.
Signed-off-by: default avatarMathieu Xhonneux <m.xhonneux@gmail.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent 30cfe3b4
...@@ -49,7 +49,11 @@ struct seg6_pernet_data { ...@@ -49,7 +49,11 @@ struct seg6_pernet_data {
static inline struct seg6_pernet_data *seg6_pernet(struct net *net) static inline struct seg6_pernet_data *seg6_pernet(struct net *net)
{ {
#if IS_ENABLED(CONFIG_IPV6)
return net->ipv6.seg6_data; return net->ipv6.seg6_data;
#else
return NULL;
#endif
} }
extern int seg6_init(void); extern int seg6_init(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment