Skip to content

Commit 79ecb90

Browse files
tomratbertdavem330
authored andcommitted
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: Tom Herbert <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 182a352 commit 79ecb90

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

include/net/ip6_tunnel.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ struct ip6_tnl {
5050
/* These fields used only by GRE */
5151
__u32 i_seqno; /* The last seen seqno */
5252
__u32 o_seqno; /* The last output seqno */
53-
int hlen; /* Precalculated GRE header length */
53+
int hlen; /* tun_hlen + encap_hlen */
54+
int tun_hlen; /* Precalculated header length */
5455
int mlink;
56+
5557
};
5658

5759
/* Tunnel encapsulation limit destination sub-option */
@@ -76,6 +78,7 @@ __u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr,
7678
const struct in6_addr *raddr);
7779
struct net *ip6_tnl_get_link_net(const struct net_device *dev);
7880
int ip6_tnl_get_iflink(const struct net_device *dev);
81+
int ip6_tnl_change_mtu(struct net_device *dev, int new_mtu);
7982

8083
#ifdef CONFIG_INET
8184
static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,

net/ipv6/ip6_tunnel.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,8 +1540,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
15401540
* %-EINVAL if mtu too small
15411541
**/
15421542

1543-
static int
1544-
ip6_tnl_change_mtu(struct net_device *dev, int new_mtu)
1543+
int ip6_tnl_change_mtu(struct net_device *dev, int new_mtu)
15451544
{
15461545
struct ip6_tnl *tnl = netdev_priv(dev);
15471546

@@ -1557,6 +1556,7 @@ ip6_tnl_change_mtu(struct net_device *dev, int new_mtu)
15571556
dev->mtu = new_mtu;
15581557
return 0;
15591558
}
1559+
EXPORT_SYMBOL(ip6_tnl_change_mtu);
15601560

15611561
int ip6_tnl_get_iflink(const struct net_device *dev)
15621562
{
@@ -1632,6 +1632,9 @@ ip6_tnl_dev_init_gen(struct net_device *dev)
16321632
if (ret)
16331633
goto destroy_dst;
16341634

1635+
t->hlen = 0;
1636+
t->tun_hlen = 0;
1637+
16351638
return 0;
16361639

16371640
destroy_dst:

0 commit comments

Comments
 (0)