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

Sergei Antonov
2023-05-04T14:30:31Z

On Sat, 22 Apr 2023 at 03:08, <emohandesi@linux.microsoft.com> wrote:
>
> From: Ehsan Mohandesi <emohandesi@linux.microsoft.com>

Hello, Ehsan! Good patch, but one little change is needed.

> +struct icmp6_ra_prefix_info {
> + u8 type; /* Type is 3 for Prefix Information. */
> + u8 len; /* Len is 4 for Prefix Information. */
> + /* The number of leading bits in the Prefix that are valid. */
> + u8 prefix_len;
> + u8 reserved1:6, /* MUST be ignored by the receiver. */
> + aac:1, /* autonomous address-configuration flag */
> + /* Indicates that this prefix can be used for on-link determination. */
> + on_link:1;
> + /*
> + * The length of time in seconds that the prefix is valid for the
> + * purpose of on-link determination.
> + */
> + __be32 valid_lifetime;
> + /* The length of time addresses remain preferred. */
> + __be32 preferred_lifetime;
> + __be32 reserved2; /* MUST be ignored by the receiver. */
> + /*
> + * Prefix is an IP address or a prefix of an IP address. The Prefix
> + * Length field contains the number of valid leading bits in the prefix.
> + * The bits in the prefix after the prefix length are reserved and MUST
> + * be initialized to zero by the sender and ignored by the receiver.
> + */
> + struct in6_addr prefix;
> +};

Here it should end with:
} __packed;
Because this structure may be placed at a badly aligned offset within
a packet. For example, at offset 0x46 within Ethernet packet.

Other than that:
Tested-by: Sergei Antonov <saproj@gmail.com>
Reviewed-by: Sergei Antonov <saproj@gmail.com>