Re: IP MTU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 27, 2002 at 12:34:43PM +0800, Yuan Huailin-w19410 wrote:
> So, My question is how does the network device driver tell the IP layer its MTU in linux 2.4.17?

the ip layer gets an pointer to the device structure as a result of a
routing cache or database lookup. One field of this device structure is the
mtu of the target device.

ip_forward is called with an skb which contains the ip packet and the
decided destination. The route to the destionation is retrieved:

     rt = (struct rtable*)skb->dst;

... and the mtu of this route entry is retrieved

        mtu = rt->u.dst.pmtu;

The initial path mtu of the route is read somewhere from the device's mtu.

The mtu of a device is set by 
                case SIOCGIFMTU:        /* Get the MTU of a device */
                        ifr->ifr_mtu = dev->mtu;

in dev.c, where dev is a struct of the type net_device. I think this is dine
in route.c in the function rt_set_nexthop:

                if (fi->fib_mtu == 0) {
                        rt->u.dst.pmtu = rt->u.dst.dev->mtu;
                        if (rt->u.dst.mxlock & (1 << RTAX_MTU) &&
                            rt->rt_gateway != rt->rt_dst &&
                            rt->u.dst.pmtu > 576)
                                rt->u.dst.pmtu = 576;
                }


Greetings
Bernd
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux