Subject: Re: How to find I/F to destination

From: Patrick McHardy <[email-masked]>
Date: Fri, 04 May 2007 15:00:01 +0200

David Howells wrote:
> I would like to determine through which interface packets sent to a particular
> UDP destination will go through, and so determine the MTU size for that
> interface.  Can anyone suggest a good way of doing this from within the
> kernel?

Do a route lookup (ip_route_output_key), then either use dst_mtu to get
the PMTU value or dst->dev in case you really want the device's MTU.