Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 112219
b: refs/heads/master
c: c95b819
h: refs/heads/master
i:
  112217: aeef74a
  112215: d358039
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed Oct 9, 2008
1 parent cf36976 commit 1e86cce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 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: ec2a5652ea53c102306f08cdf516f98e32bd4b61
refs/heads/master: c95b819ad75b13102139aad0e7062d927be23cc6
15 changes: 8 additions & 7 deletions trunk/net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)

df = tiph->frag_off;
if (df)
mtu = dst_mtu(&rt->u.dst) - tunnel->hlen;
mtu = dst_mtu(&rt->u.dst) - dev->hard_header_len - tunnel->hlen;
else
mtu = skb->dst ? dst_mtu(skb->dst) : dev->mtu;

Expand Down Expand Up @@ -785,7 +785,7 @@ static void ipgre_tunnel_bind_dev(struct net_device *dev)
tunnel = netdev_priv(dev);
iph = &tunnel->parms.iph;

/* Guess output device to choose reasonable mtu and hard_header_len */
/* Guess output device to choose reasonable mtu and needed_headroom */

if (iph->daddr) {
struct flowi fl = { .oif = tunnel->parms.link,
Expand All @@ -806,7 +806,7 @@ static void ipgre_tunnel_bind_dev(struct net_device *dev)
tdev = __dev_get_by_index(dev_net(dev), tunnel->parms.link);

if (tdev) {
hlen = tdev->hard_header_len;
hlen = tdev->hard_header_len + tdev->needed_headroom;
mtu = tdev->mtu;
}
dev->iflink = tunnel->parms.link;
Expand All @@ -820,8 +820,8 @@ static void ipgre_tunnel_bind_dev(struct net_device *dev)
if (tunnel->parms.o_flags&GRE_SEQ)
addend += 4;
}
dev->hard_header_len = hlen + addend;
dev->mtu = mtu - addend;
dev->needed_headroom = addend + hlen;
dev->mtu = mtu - dev->hard_header_len - addend;
tunnel->hlen = addend;

}
Expand Down Expand Up @@ -959,7 +959,8 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu)
{
struct ip_tunnel *tunnel = netdev_priv(dev);
if (new_mtu < 68 || new_mtu > 0xFFF8 - tunnel->hlen)
if (new_mtu < 68 ||
new_mtu > 0xFFF8 - dev->hard_header_len - tunnel->hlen)
return -EINVAL;
dev->mtu = new_mtu;
return 0;
Expand Down Expand Up @@ -1085,7 +1086,7 @@ static void ipgre_tunnel_setup(struct net_device *dev)
dev->change_mtu = ipgre_tunnel_change_mtu;

dev->type = ARPHRD_IPGRE;
dev->hard_header_len = LL_MAX_HEADER + sizeof(struct iphdr) + 4;
dev->needed_headroom = LL_MAX_HEADER + sizeof(struct iphdr) + 4;
dev->mtu = ETH_DATA_LEN - sizeof(struct iphdr) - 4;
dev->flags = IFF_NOARP;
dev->iflink = 0;
Expand Down

0 comments on commit 1e86cce

Please sign in to comment.