Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 112220
b: refs/heads/master
c: 42aa916
h: refs/heads/master
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed Oct 9, 2008
1 parent 1e86cce commit b599f01
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c95b819ad75b13102139aad0e7062d927be23cc6
refs/heads/master: 42aa916265d740d66ac1f17290366e9494c884c2
16 changes: 11 additions & 5 deletions trunk/net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@

static int ipgre_tunnel_init(struct net_device *dev);
static void ipgre_tunnel_setup(struct net_device *dev);
static int ipgre_tunnel_bind_dev(struct net_device *dev);

/* Fallback tunnel: no source, no destination, no key, no options */

Expand Down Expand Up @@ -289,6 +290,8 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct net *net,
nt = netdev_priv(dev);
nt->parms = *parms;

dev->mtu = ipgre_tunnel_bind_dev(dev);

if (register_netdevice(dev) < 0)
goto failed_free;

Expand Down Expand Up @@ -773,7 +776,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
return 0;
}

static void ipgre_tunnel_bind_dev(struct net_device *dev)
static int ipgre_tunnel_bind_dev(struct net_device *dev)
{
struct net_device *tdev = NULL;
struct ip_tunnel *tunnel;
Expand Down Expand Up @@ -821,9 +824,14 @@ static void ipgre_tunnel_bind_dev(struct net_device *dev)
addend += 4;
}
dev->needed_headroom = addend + hlen;
dev->mtu = mtu - dev->hard_header_len - addend;
mtu -= dev->hard_header_len - addend;

if (mtu < 68)
mtu = 68;

tunnel->hlen = addend;

return mtu;
}

static int
Expand Down Expand Up @@ -917,7 +925,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
t->parms.iph.frag_off = p.iph.frag_off;
if (t->parms.link != p.link) {
t->parms.link = p.link;
ipgre_tunnel_bind_dev(dev);
dev->mtu = ipgre_tunnel_bind_dev(dev);
netdev_state_change(dev);
}
}
Expand Down Expand Up @@ -1108,8 +1116,6 @@ static int ipgre_tunnel_init(struct net_device *dev)
memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4);
memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);

ipgre_tunnel_bind_dev(dev);

if (iph->daddr) {
#ifdef CONFIG_NET_IPGRE_BROADCAST
if (ipv4_is_multicast(iph->daddr)) {
Expand Down

0 comments on commit b599f01

Please sign in to comment.