diff options
author | Andy Zhou <azhou@nicira.com> | 2014-09-17 04:31:16 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-19 23:57:15 +0400 |
commit | fd384412e199b62c3ddaabd18dce86d0e164c5b9 (patch) | |
tree | 88c3a930da306688b23767a2be6ac2826e5826b5 /include/net/udp_tunnel.h | |
parent | 79ba2b4c5d3779d68b4cd3a569d483f1778f2b5a (diff) | |
download | linux-fd384412e199b62c3ddaabd18dce86d0e164c5b9.tar.xz |
udp_tunnel: Seperate ipv6 functions into its own file.
Add ip6_udp_tunnel.c for ipv6 UDP tunnel functions to avoid ifdefs
in udp_tunnel.c
Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/udp_tunnel.h')
-rw-r--r-- | include/net/udp_tunnel.h | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h index ffd69cbded35..0b9e017c9038 100644 --- a/include/net/udp_tunnel.h +++ b/include/net/udp_tunnel.h @@ -26,7 +26,31 @@ struct udp_port_cfg { use_udp6_rx_checksums:1; }; -int udp_sock_create(struct net *net, struct udp_port_cfg *cfg, - struct socket **sockp); +int udp_sock_create4(struct net *net, struct udp_port_cfg *cfg, + struct socket **sockp); + +#if IS_ENABLED(CONFIG_IPV6) +int udp_sock_create6(struct net *net, struct udp_port_cfg *cfg, + struct socket **sockp); +#else +static inline int udp_sock_create6(struct net *net, struct udp_port_cfg *cfg, + struct socket **sockp) +{ + return 0; +} +#endif + +static inline int udp_sock_create(struct net *net, + struct udp_port_cfg *cfg, + struct socket **sockp) +{ + if (cfg->family == AF_INET) + return udp_sock_create4(net, cfg, sockp); + + if (cfg->family == AF_INET6) + return udp_sock_create6(net, cfg, sockp); + + return -EPFNOSUPPORT; +} #endif |