Commit 79ecb90e authored by Tom Herbert's avatar Tom Herbert Committed by David S. Miller

ipv6: Generic tunnel cleanup

A few generic changes to generalize tunnels in IPv6:
  - Export ip6_tnl_change_mtu so that it can be called by ip6_gre
  - Add tun_hlen to ip6_tnl structure.
Signed-off-by: default avatarTom Herbert <tom@herbertland.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 182a352d
...@@ -50,8 +50,10 @@ struct ip6_tnl { ...@@ -50,8 +50,10 @@ struct ip6_tnl {
/* These fields used only by GRE */ /* These fields used only by GRE */
__u32 i_seqno; /* The last seen seqno */ __u32 i_seqno; /* The last seen seqno */
__u32 o_seqno; /* The last output seqno */ __u32 o_seqno; /* The last output seqno */
int hlen; /* Precalculated GRE header length */ int hlen; /* tun_hlen + encap_hlen */
int tun_hlen; /* Precalculated header length */
int mlink; int mlink;
}; };
/* Tunnel encapsulation limit destination sub-option */ /* Tunnel encapsulation limit destination sub-option */
...@@ -76,6 +78,7 @@ __u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr, ...@@ -76,6 +78,7 @@ __u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr,
const struct in6_addr *raddr); const struct in6_addr *raddr);
struct net *ip6_tnl_get_link_net(const struct net_device *dev); struct net *ip6_tnl_get_link_net(const struct net_device *dev);
int ip6_tnl_get_iflink(const struct net_device *dev); int ip6_tnl_get_iflink(const struct net_device *dev);
int ip6_tnl_change_mtu(struct net_device *dev, int new_mtu);
#ifdef CONFIG_INET #ifdef CONFIG_INET
static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb, static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
......
...@@ -1540,8 +1540,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1540,8 +1540,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
* %-EINVAL if mtu too small * %-EINVAL if mtu too small
**/ **/
static int int ip6_tnl_change_mtu(struct net_device *dev, int new_mtu)
ip6_tnl_change_mtu(struct net_device *dev, int new_mtu)
{ {
struct ip6_tnl *tnl = netdev_priv(dev); struct ip6_tnl *tnl = netdev_priv(dev);
...@@ -1557,6 +1556,7 @@ ip6_tnl_change_mtu(struct net_device *dev, int new_mtu) ...@@ -1557,6 +1556,7 @@ ip6_tnl_change_mtu(struct net_device *dev, int new_mtu)
dev->mtu = new_mtu; dev->mtu = new_mtu;
return 0; return 0;
} }
EXPORT_SYMBOL(ip6_tnl_change_mtu);
int ip6_tnl_get_iflink(const struct net_device *dev) int ip6_tnl_get_iflink(const struct net_device *dev)
{ {
...@@ -1632,6 +1632,9 @@ ip6_tnl_dev_init_gen(struct net_device *dev) ...@@ -1632,6 +1632,9 @@ ip6_tnl_dev_init_gen(struct net_device *dev)
if (ret) if (ret)
goto destroy_dst; goto destroy_dst;
t->hlen = 0;
t->tun_hlen = 0;
return 0; return 0;
destroy_dst: destroy_dst:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment