Skip to content

Commit

Permalink
ipv6: sr: make seg6.h includable without IPv6
Browse files Browse the repository at this point in the history
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: Mathieu Xhonneux <m.xhonneux@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
Mathieu Xhonneux authored and Daniel Borkmann committed May 24, 2018
1 parent 30cfe3b commit 63526e1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/net/seg6.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ struct seg6_pernet_data {

static inline struct seg6_pernet_data *seg6_pernet(struct net *net)
{
#if IS_ENABLED(CONFIG_IPV6)
return net->ipv6.seg6_data;
#else
return NULL;
#endif
}

extern int seg6_init(void);
Expand Down

0 comments on commit 63526e1

Please sign in to comment.