tunnel device fix

A.N.Kuznetsov (kuznet@ms2.inr.ac.ru)
Wed, 10 Jul 1996 17:09:47 +0400 (MSD)


Hello!

With this fix (and fixed skb->arp bug in ip_output.c)
tunnel works. At least, I failed to break it.

It passed (all these test failed without these fixes):
ping -f -s 8000 <other end>
ping -f -s 8000 -I <our end> 224.0.0.1
Transferred 80Mb of news and ftp 180Mb file
with couple of dozens of route changes tunnel <-> ethernet!

Well, when route changes ip_fragment complains a lot at ip_fragment:
- if(skb->free==0)
- printk(KERN_ERR "IP fragmenter: BUG free!=1 in fragmenter\n");

It is wrong, fragmenting queued skb is not bug. Why not?

The only bug, that I see now: incorrect ttl value.
It can be easily fixed by adding new flag IPFWD_NOTTLDEC to is_frag
argument of ip_forward.

Alexey Kuznetsov.

drivers/net/new_tunnel.c:

- if (skb_headroom(skb) >= max_headroom) {
+ if (skb_headroom(skb) >= max_headroom && skb->free) {
skb->h.iph = (struct iphdr *) skb_push(skb, tunnel_hlen);
+ if (skb->sk)
+ {
+ atomic_sub(skb->truesize, &skb->sk->wmem_alloc);
+ skb->sk->write_space(skb->sk);
+ skb->sk = NULL;
+ }
+ skb_device_unlock(skb);
} else {

if (skb->sk)
{
....
}
seems redundant, but added just for safety.