Re: [PATCH v4 1/3] net: ipv6: Add support for default gateway discovery.

Ehsan Mohandesi
2023-05-05T14:13:23Z

On 5/4/2023 9:52 AM, Sergei Antonov wrote:
> On Sat, 22 Apr 2023 at 03:08,<emohandesi@linux.microsoft.com> wrote:
>
>> + if (prefix->on_link && ntohl(prefix->valid_lifetime)) {
>> + net_prefix_length = prefix->prefix_len;
>> + net_gateway6 = ip6->saddr;
>> + return 0;
> Is it OK that prefix->prefix_len is used, but prefix->prefix is not?
> Just curious.

prefix->prefix is used just before this if statement to make sure it is
not a link-local address as shown below.

if((ntohs(prefix->prefix.s6_addr16[0]) & IPV6_LINK_LOCAL_MASK) ==
IPV6_LINK_LOCAL_PREFIX) break; if(prefix->on_link &&
ntohl(prefix->valid_lifetime)) { net_prefix_length = prefix->prefix_len;
net_gateway6 = ip6->saddr; return0; }