Page MenuHomeFreeBSD

netinet6: store ND context directly in struct in6_ifextra
ClosedPublic

Authored by glebius on Thu, Jan 15, 3:25 AM.
Tags
None
Referenced Files
F144023225: D54725.id.diff
Tue, Feb 3, 12:43 PM
Unknown Object (File)
Sat, Jan 31, 11:58 AM
Unknown Object (File)
Thu, Jan 29, 5:57 AM
Unknown Object (File)
Tue, Jan 27, 3:57 AM
Unknown Object (File)
Mon, Jan 26, 5:40 PM
Unknown Object (File)
Mon, Jan 26, 1:24 PM
Unknown Object (File)
Mon, Jan 26, 1:23 PM
Unknown Object (File)
Mon, Jan 26, 3:00 AM

Details

Summary

Stop using struct nd_ifinfo for that, because it is an API struct for
SIOCGIFINFO_IN6. The functional changes are isolated to the protocol
attach and detach: in6_ifarrival(), nd6_ifattach(), in6_ifdeparture(),
nd6_ifdetach(), as well as to the nd6_ioctl(), nd6_ra_input(),
nd6_slowtimo() and in6_ifmtu().

The dad_failures member was just renamed to match the rest. The M_IP6NDP
malloc(9) type declaration moved to files that actually use it.

The rest of the changes are mechanical substitution of double pointer
dereference via ND_IFINFO() to a single pointer dereference. This was
achieved with a sed(1) script:

s/ND_IFINFO\(([a-z0-9>_.-]+)\)->(flags|linkmtu|basereachable|reachable|retrans|chlim)/\1->if_inet6->nd_\2/g
s/nd_chlim/nd_curhoplimit/g

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tuexen added a subscriber: tuexen.
tuexen added inline comments.
sys/netinet6/in6.c
2632–2633

Maybe use something like:

	const uint32_t linkmtu = ifp->if_inet6->nd_linkmtu;
	const uint32_t maxmtu = ifp->if_inet6->nd_maxmtu;
	const uint32_t if_mtu = ifp->if_inet6->if_mtu;

For me that is more readable and possibly more inline with style.9. But I leave that up to you.

2634

Maybe:

if (linkmtu > 0 && linkmtu < ifmtu)
	return (linkmtu);
if (maxmtu > 0 && maxmtu < ifmtu)
	return (maxmtu);
return (ifmtu);

is more easier to read. But I leave that also up to you.

This revision is now accepted and ready to land.Fri, Jan 23, 9:01 PM

In in6_ifmtu() unroll the two level ternary operator into a more readable form.

This revision now requires review to proceed.Fri, Jan 23, 9:22 PM
This revision is now accepted and ready to land.Fri, Jan 23, 10:32 PM