Re: [PATCH v3 1/2] sierra_net: Add support for IPv6 and Dual-Stack Link Sense Indications

From: David Miller
Date: Wed Feb 08 2017 - 10:31:46 EST

From: Bjørn Mork <bjorn@xxxxxxx>
Date: Wed, 08 Feb 2017 10:55:50 +0100

> Stefan Brüns <stefan.bruens@xxxxxxxxxxxxxx> writes:
>> If a context is configured as dualstack ("IPv4v6"), the modem indicates
>> the context activation with a slightly different indication message.
>> The dual-stack indication omits the link_type (IPv4/v6) and adds
>> additional address fields.
> Great!
>> IPv6 LSIs are identical to IPv4 LSIs, but have a different link type.
>> +struct lsi_umts_dual {
>> + struct lsi_umts lsi;
>> + u8 pdp_addr4_len; /* NW-supplied PDP IPv4 address len */
>> + u8 pdp_addr4[4]; /* NW-supplied PDP IPv4 address (bigendian)) */
>> + u8 pdp_addr6_len; /* NW-supplied PDP IPv6 address len */
>> + u8 pdp_addr6[16]; /* NW-supplied PDP IPv6 address (bigendian)) */
> Maybe use "struct in_addr" and "struct in6_addr" for all the address
> fields, making them a bit more accessible and avoiding having to define
> endianness explicitly?

Can't do that, it will add padding to the structure and not match
what is really in the header.

The problem is that we get a "u8" length first which starts the
address on an odd byte.

And we don't want to use "__packed" to fix this either.