Thread (11 messages) flat view 11 messages, 3 authors, 2014-02-20

Getting a NIC's MTU size

From: David Howells <dhowells@redhat.com>
Date: 2014-02-14 15:49:21

One further question:  If I want to get the MTU size of the NIC through which
packets will go to get to a particular peer, can I do:

	struct rtable *rt;
	struct flowi4 fl4;
	unsigned if_mtu;

	rt = ip_route_output_ports(&init_net, &fl4, NULL,
				   peer->srx.transport.sin.sin_addr.s_addr, 0,
				   htons(7000), htons(7001),
				   IPPROTO_UDP, 0, 0);

	if_mtu = rt->dst->dev->mtu;

	dst_release(&rt->dst);

Or might this go wrong if rt->dst->dev changes under me?  Can it change
without replacing the dst record?

David
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help