Skip to contentSkip to conversation

Output on raw sockets ignores IP_DF when packet is bigger than pmtu

DISCUSSION Raghurama 'REDDY' 2 participants 2 messages Mar 6, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello!

We are looking at the "traceroute" code, in particular the behavior of the "-M" option (path MTU discovery) on a 2.4.20 kernel.

In attempting to get a "Framentation required message" from an intermediate router, the code does the following:

- Open a raw socket
- Send a packet that is smaller than interface MTU but bigger than the MTU of an intermediate router with IP_DF set (the NIC has an MTU of 4400, and pmtu is 1500).

What is observed is that when route cache is flushed, it works as expected. We get a "Framentation Required" message from the intermediate router.

But when the cache is *not* flushed, the packets are fragmented based on pmtu before sending the packets out on the net, inspite of the fact that IP_DF is set (based on the tcpdump observations). Is this the right behavior?

But looking at 2.4.20 kernel code in "include/net/ip.h":

Not sure if "ip_send" is the in the call tree or not; I am *not*
intimately familiar with the code ... :-(

------------------
static inline int ip_send(struct sk_buff *skb)

{
        if (skb->len > skb->dst->pmtu)
                return ip_fragment(skb, ip_finish_output);
        else
                return ip_finish_output(skb);
}

------------------

This seems to indicate that it would fragment the packet if the packet is bigger than path MTU irrespetive of the IP_DF flag.

Is there a way to get the host to not fragment when IP_DF is set, iresspective what the pmtu is?

Thanks!

--rr

#1 lore raw
Quoted 2 lines · Raghurama 'REDDY

Is there a way to get the host to not fragment when IP_DF is set, iresspective what the pmtu is?

You can disable pmtu discovery on a socket using the IP level socket option IP_MTU_DISCOVER.

System wide pmtu discovery can be disabled by setting

	/proc/sys/net/ipv4/ip_no_pmtu_disc

-Sridhar