mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-05 01:54:09 +08:00
d0087b29f7
At Facebook, we do Layer-3 DSR via IP-in-IP tunneling. Our load balancers wrap an extra IP header on incoming packets so they can be routed to the backend. In the v4 tunnel driver, when these packets fall on the default tunl0 device, the behavior is to decapsulate them and drop them back on the stack. So our setup is that tunl0 has the VIP and eth0 has (obviously) the backend's real address. In IPv6 we do the same thing, but the v6 tunnel driver didn't have this same behavior - if you didn't have an explicit tunnel setup, it would drop the packet. This patch brings that v4 feature to the v6 driver. The same IPv6 address checks are performed as with any normal tunnel, but as the fallback tunnel endpoint addresses are unspecified, the checks must be performed on a per-packet basis, rather than at tunnel configuration time. [Patch description modified by phil@ipom.com] Signed-off-by: Ville Nuorvala <ville.nuorvala@gmail.com> Tested-by: Phil Dibowitz <phil@ipom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
35 lines
969 B
C
35 lines
969 B
C
#ifndef _NET_IP6_TUNNEL_H
|
|
#define _NET_IP6_TUNNEL_H
|
|
|
|
#include <linux/ipv6.h>
|
|
#include <linux/netdevice.h>
|
|
#include <linux/ip6_tunnel.h>
|
|
|
|
/* capable of sending packets */
|
|
#define IP6_TNL_F_CAP_XMIT 0x10000
|
|
/* capable of receiving packets */
|
|
#define IP6_TNL_F_CAP_RCV 0x20000
|
|
/* determine capability on a per-packet basis */
|
|
#define IP6_TNL_F_CAP_PER_PACKET 0x40000
|
|
|
|
/* IPv6 tunnel */
|
|
|
|
struct ip6_tnl {
|
|
struct ip6_tnl __rcu *next; /* next tunnel in list */
|
|
struct net_device *dev; /* virtual device associated with tunnel */
|
|
struct ip6_tnl_parm parms; /* tunnel configuration parameters */
|
|
struct flowi fl; /* flowi template for xmit */
|
|
struct dst_entry *dst_cache; /* cached dst */
|
|
u32 dst_cookie;
|
|
};
|
|
|
|
/* Tunnel encapsulation limit destination sub-option */
|
|
|
|
struct ipv6_tlv_tnl_enc_lim {
|
|
__u8 type; /* type-code for option */
|
|
__u8 length; /* option length */
|
|
__u8 encap_limit; /* tunnel encapsulation limit */
|
|
} __packed;
|
|
|
|
#endif
|