How can i detect if a received UDP got fragmented from userland?

Bruce M Simpson bms at spc.org
Tue Mar 21 17:36:19 UTC 2006


On Tue, Mar 21, 2006 at 04:15:44AM +0100, Sten Daniel Sørsdal wrote:
> Our first assumption was that adding DF to UDP would solve it, and it
> does in our small tests, but it has a noticable negative effect on the 
> network.

Sounds like you need to implement Path MTU Discovery in userland for your
application. In FreeBSD, PMTU-D only happens in the kernel for TCP traffic.
So you would need to implement it yourself to avoid fragmentation along
the path.

> Are there any way i can read whether a message's packet was fragmented 
> into smaller pieces and preferably how large the largest fragment was?

I think the MSG_TRUNC flag can tell you about this (data discarded before
delivery). You'd have to experiment to see if UDP will set this flag, I'm
not sure if it will.

> Are there any feasible way to do this?

I don't think it would be feasible to report this per datagram. Take
a look at Ping Pan's paper on PF_IPOPTION if you wish to explore further.

Regards,
BMS


More information about the freebsd-net mailing list