Simplify nd6_options() initialise logic
authorkn <kn@openbsd.org>
Fri, 6 Jan 2023 14:24:36 +0000 (14:24 +0000)
committerkn <kn@openbsd.org>
Fri, 6 Jan 2023 14:24:36 +0000 (14:24 +0000)
commit0a2b5415dce9e071f63c96dd2dbfcd2c6c2c6734
treef2b44f1a0ad3d64a328815cd5175312f0aa4cc43
parent576e5f39a29cca60c6626b950b069797dd52ffc6
Simplify nd6_options() initialise logic

nd_opts_{search,last,done} are exlusively used in the internal option
handling machinery;  the only two nd6_options() callers only use
nd_opts_{src,tgt}_lladdr.

nd6_options() always zeroes and initialises the caller's struct nd_opts.
If icmp6len is zero, i.e. if there are no ICMP6 header options left,
everything inside *ndopts is zero, except nd_opts_done=1 which is not
used by the callers.

Set the internal nd_opts_{search,last,done} members only when needed.

OK claudio
sys/netinet6/nd6.c