GRE over IPv6 tunnel support
Subsystems (2)
PATCH v2 1/1 GRE over IPv6 tunnel support
GRE over IPv6 tunnel support.
Signed-off-by Dmitry Kozlov <[email protected]>
---
Changes:
Implemented 'ip link' family of commands to manage ip6gre/ip6gretap tunnels.
include/linux/if_arp.h | 15 ++ include/linux/if_tunnel.h | 21 +++ include/linux/ip6_tunnel.h | 18 ++ ip/Makefile | 2 +- ip/ip6tunnel.c | 133 +++++++++++++-- ip/link_gre6.c | 397 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 567 insertions(+), 19 deletions(-)
include/linux/if_arp.h +15 -0
@@ -92,6 +92,7 @@#define ARPHRD_PHONET 820/* PhoNet media type */ #define ARPHRD_PHONET_PIPE 821/* PhoNet pipe header */ #define ARPHRD_CAIF 822/* CAIF media type */ +#define ARPHRD_IP6GRE 823/* GRE over IPv6 */ #define ARPHRD_VOID 0xFFFF/* Void type, nothing is known */ #define ARPHRD_NONE 0xFFFE/* zero header length */
@@ -154,5 +155,19 @@ struct arphdr { }; +#ifdef __KERNEL__ +#include <linux/skbuff.h> + +static inline struct arphdr *arp_hdr (const struct sk_buff *skb) +{ +return (struct arphdr *)skb_network_header (skb); +} + +static inline int arp_hdr_len (struct net_device *dev) +{ +/* ARP header, plus 2 device addresses, plus 2 IP addresses. */ +return sizeof (struct arphdr ) + (dev->addr_len +sizeof (u32)) *2 ; +} +#endif #endif /* _LINUX_IF_ARP_H */
include/linux/if_tunnel.h +21 -0
@@ -4,6 +4,10 @@#include <linux/types.h> #include <asm/byteorder.h> +#ifdef __KERNEL__ +#include <linux/ip.h> +#include <linux/in6.h> +#endif #define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0)#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1)
@@ -71,9 +75,26 @@ enum {IFLA_GRE_TTL ,IFLA_GRE_TOS ,IFLA_GRE_PMTUDISC , +IFLA_GRE_ENCAP_LIMIT , +IFLA_GRE_FLOWINFO , +IFLA_GRE_FLAGS , __IFLA_GRE_MAX, };#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1) +/* VTI-mode i_flags */ +#define VTI_ISVTI 0x0001 + +enum { +IFLA_VTI_UNSPEC , +IFLA_VTI_LINK , +IFLA_VTI_IKEY , +IFLA_VTI_OKEY , +IFLA_VTI_LOCAL , +IFLA_VTI_REMOTE , + __IFLA_VTI_MAX, +}; + +#define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1)#endif /* _IF_TUNNEL_H_ */
include/linux/ip6_tunnel.h +18 -0
@@ -31,4 +31,22 @@ struct ip6_tnl_parm { struct in6_addr raddr; /* remote tunnel end-point address */ }; +struct ip6_tnl_parm2 { +char name[IFNAMSIZ ];/* name of tunnel device */ +int link;/* ifindex of underlying L2 interface */ +__u8 proto;/* tunnel protocol */ +__u8 encap_limit;/* encapsulation limit for tunnel */ +__u8 hop_limit;/* hop limit for tunnel */ +__be32 flowinfo;/* traffic class and flowlabel for tunnel */ +__u32 flags;/* tunnel flags */ +struct in6_addr laddr;/* local tunnel end-point address */ +struct in6_addr raddr;/* remote tunnel end-point address */ + +__be16 i_flags; +__be16 o_flags; +__be32 i_key; +__be32 o_key; +}; + +#endif
ip/Makefile +1 -1
@@ -3,7 +3,7 @@ IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \ ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o iptuntap.o \ ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o \ iplink_vlan.o link_veth.o link_gre.o iplink_can.o \ - iplink_macvlan.o iplink_macvtap.o ipl2tp.o + iplink_macvlan.o iplink_macvtap.o ipl2tp.o link_gre6.o RTMONOBJ=rtmon.o
ip/ip6tunnel.c +115 -18
240 lines not on this page · raw message
ip/link_gre6.c new file +397 -0
397 lines not on this page · raw message