MTU of outgoing Interface

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

 



Hi

I have a need to get the MTU of the outgoing interface given an IPv4 or IPv6 destination address.

I have had several attempts at getting this information using different hacks.

The first hack I tried was using RTNETLINK. However, given the destination address, I was given the Path MTU which might be less than the MTU of the outgoing interface. The code is at

http://www.wand.net.nz/~mjl12/netlink-mtu.c

The caveat with that code is that IPv6 routes seem to have an expiry set that is not related to any PMTU caching. I can get the interface's MTU using an IPv4 address flushing the route cache first, and then quering for the destination.

The second attempt I had was using a similar technique to tracepath. That too returned the path MTU given a destination.

http://www.wand.net.nz/~mjl12/udp-mtu.c

The third attempt was to use SIOCGIFCONF to get a list of interfaces and addresses, and then match the interface address with whatever was returned by getsockname. I found that I was only returned AF_INET addresses, which does not fulfill my desire to have both AF_INET and AF_INET6.

http://www.wand.net.nz/~mjl12/ioctl-mtu.c

What is the suggested way to get the outgoing interface's MTU under Linux?

Matthew
-
: 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