]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/net/udp_tunnel.h
udp_tunnel: Seperate ipv6 functions into its own file.
[mirror_ubuntu-bionic-kernel.git] / include / net / udp_tunnel.h
CommitLineData
8024e028
TH
1#ifndef __NET_UDP_TUNNEL_H
2#define __NET_UDP_TUNNEL_H
3
4struct udp_port_cfg {
5 u8 family;
6
7 /* Used only for kernel-created sockets */
8 union {
9 struct in_addr local_ip;
10#if IS_ENABLED(CONFIG_IPV6)
11 struct in6_addr local_ip6;
12#endif
13 };
14
15 union {
16 struct in_addr peer_ip;
17#if IS_ENABLED(CONFIG_IPV6)
18 struct in6_addr peer_ip6;
19#endif
20 };
21
22 __be16 local_udp_port;
23 __be16 peer_udp_port;
24 unsigned int use_udp_checksums:1,
25 use_udp6_tx_checksums:1,
26 use_udp6_rx_checksums:1;
27};
28
fd384412
AZ
29int udp_sock_create4(struct net *net, struct udp_port_cfg *cfg,
30 struct socket **sockp);
31
32#if IS_ENABLED(CONFIG_IPV6)
33int udp_sock_create6(struct net *net, struct udp_port_cfg *cfg,
34 struct socket **sockp);
35#else
36static inline int udp_sock_create6(struct net *net, struct udp_port_cfg *cfg,
37 struct socket **sockp)
38{
39 return 0;
40}
41#endif
42
43static inline int udp_sock_create(struct net *net,
44 struct udp_port_cfg *cfg,
45 struct socket **sockp)
46{
47 if (cfg->family == AF_INET)
48 return udp_sock_create4(net, cfg, sockp);
49
50 if (cfg->family == AF_INET6)
51 return udp_sock_create6(net, cfg, sockp);
52
53 return -EPFNOSUPPORT;
54}
8024e028
TH
55
56#endif