ip_tunnels.h (46fa062ad63146dd138ec0f017e71224471e8ea5) ip_tunnels.h (7f9562a1f405306eacb97f95d78cb996e33f27f5)
1#ifndef __NET_IP_TUNNELS_H
2#define __NET_IP_TUNNELS_H 1
3
4#include <linux/if_tunnel.h>
5#include <linux/netdevice.h>
6#include <linux/skbuff.h>
1#ifndef __NET_IP_TUNNELS_H
2#define __NET_IP_TUNNELS_H 1
3
4#include <linux/if_tunnel.h>
5#include <linux/netdevice.h>
6#include <linux/skbuff.h>
7#include <linux/socket.h>
7#include <linux/types.h>
8#include <linux/u64_stats_sync.h>
9#include <net/dsfield.h>
10#include <net/gro_cells.h>
11#include <net/inet_ecn.h>
12#include <net/netns/generic.h>
13#include <net/rtnetlink.h>
14#include <net/lwtunnel.h>

--- 32 unchanged lines hidden (view full) ---

47 u8 tos; /* TOS for IPv4, TC for IPv6 */
48 u8 ttl; /* TTL for IPv4, HL for IPv6 */
49 __be16 tp_src;
50 __be16 tp_dst;
51};
52
53/* Flags for ip_tunnel_info mode. */
54#define IP_TUNNEL_INFO_TX 0x01 /* represents tx tunnel parameters */
8#include <linux/types.h>
9#include <linux/u64_stats_sync.h>
10#include <net/dsfield.h>
11#include <net/gro_cells.h>
12#include <net/inet_ecn.h>
13#include <net/netns/generic.h>
14#include <net/rtnetlink.h>
15#include <net/lwtunnel.h>

--- 32 unchanged lines hidden (view full) ---

48 u8 tos; /* TOS for IPv4, TC for IPv6 */
49 u8 ttl; /* TTL for IPv4, HL for IPv6 */
50 __be16 tp_src;
51 __be16 tp_dst;
52};
53
54/* Flags for ip_tunnel_info mode. */
55#define IP_TUNNEL_INFO_TX 0x01 /* represents tx tunnel parameters */
56#define IP_TUNNEL_INFO_IPV6 0x02 /* key contains IPv6 addresses */
55
56struct ip_tunnel_info {
57 struct ip_tunnel_key key;
58 const void *options;
59 u8 options_len;
60 u8 mode;
61};
62

--- 140 unchanged lines hidden (view full) ---

203
204 /* Clear struct padding. */
205 if (sizeof(tun_info->key) != IP_TUNNEL_KEY_SIZE)
206 memset((unsigned char *)&tun_info->key + IP_TUNNEL_KEY_SIZE,
207 0, sizeof(tun_info->key) - IP_TUNNEL_KEY_SIZE);
208
209 tun_info->options = opts;
210 tun_info->options_len = opts_len;
57
58struct ip_tunnel_info {
59 struct ip_tunnel_key key;
60 const void *options;
61 u8 options_len;
62 u8 mode;
63};
64

--- 140 unchanged lines hidden (view full) ---

205
206 /* Clear struct padding. */
207 if (sizeof(tun_info->key) != IP_TUNNEL_KEY_SIZE)
208 memset((unsigned char *)&tun_info->key + IP_TUNNEL_KEY_SIZE,
209 0, sizeof(tun_info->key) - IP_TUNNEL_KEY_SIZE);
210
211 tun_info->options = opts;
212 tun_info->options_len = opts_len;
213
214 tun_info->mode = 0;
211}
212
213static inline void ip_tunnel_info_init(struct ip_tunnel_info *tun_info,
214 const struct iphdr *iph,
215 __be16 tp_src, __be16 tp_dst,
216 __be64 tun_id, __be16 tun_flags,
217 const void *opts, u8 opts_len)
218{
219 __ip_tunnel_info_init(tun_info, iph->saddr, iph->daddr,
220 iph->tos, iph->ttl, tp_src, tp_dst,
221 tun_id, tun_flags, opts, opts_len);
222}
223
215}
216
217static inline void ip_tunnel_info_init(struct ip_tunnel_info *tun_info,
218 const struct iphdr *iph,
219 __be16 tp_src, __be16 tp_dst,
220 __be64 tun_id, __be16 tun_flags,
221 const void *opts, u8 opts_len)
222{
223 __ip_tunnel_info_init(tun_info, iph->saddr, iph->daddr,
224 iph->tos, iph->ttl, tp_src, tp_dst,
225 tun_id, tun_flags, opts, opts_len);
226}
227
228static inline unsigned short ip_tunnel_info_af(const struct ip_tunnel_info
229 *tun_info)
230{
231 return tun_info->mode & IP_TUNNEL_INFO_IPV6 ? AF_INET6 : AF_INET;
232}
233
224#ifdef CONFIG_INET
225
226int ip_tunnel_init(struct net_device *dev);
227void ip_tunnel_uninit(struct net_device *dev);
228void ip_tunnel_dellink(struct net_device *dev, struct list_head *head);
229struct net *ip_tunnel_get_link_net(const struct net_device *dev);
230int ip_tunnel_get_iflink(const struct net_device *dev);
231int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,

--- 119 unchanged lines hidden ---
234#ifdef CONFIG_INET
235
236int ip_tunnel_init(struct net_device *dev);
237void ip_tunnel_uninit(struct net_device *dev);
238void ip_tunnel_dellink(struct net_device *dev, struct list_head *head);
239struct net *ip_tunnel_get_link_net(const struct net_device *dev);
240int ip_tunnel_get_iflink(const struct net_device *dev);
241int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,

--- 119 unchanged lines hidden ---