[PATCH 1/4] net: if_arp: add ARPHRD_PUREIP type

Rocco Yue rocco.yue at mediatek.com
Wed Jun 23 20:33:53 PDT 2021


On Wed, 2021-06-23 at 19:19 +0200, Greg KH wrote:
On Wed, Jun 23, 2021 at 07:34:49PM +0800, Rocco Yue wrote:
>> This patch add the definition of ARPHRD_PUREIP which can for
>> example be used by mobile ccmni device as device type.
>> ARPHRD_PUREIP means that this device doesn't need kernel to
>> generate ipv6 link-local address in any addr_gen_mode.
>> 
>> Signed-off-by: Rocco Yue <rocco.yue at mediatek.com>
>> ---
>>  include/uapi/linux/if_arp.h | 1 +
>>  1 file changed, 1 insertion(+)
>> 
>> diff --git a/include/uapi/linux/if_arp.h b/include/uapi/linux/if_arp.h
>> index c3cc5a9e5eaf..4463c9e9e8b4 100644
>> --- a/include/uapi/linux/if_arp.h
>> +++ b/include/uapi/linux/if_arp.h
>> @@ -61,6 +61,7 @@
>>  #define ARPHRD_DDCMP    517		/* Digital's DDCMP protocol     */
>>  #define ARPHRD_RAWHDLC	518		/* Raw HDLC			*/
>>  #define ARPHRD_RAWIP    519		/* Raw IP                       */
>> +#define ARPHRD_PUREIP	520		/* Pure IP			*/
> 
> In looking at the patches, what differs "PUREIP" from "RAWIP"?  It seems

Thanks for your review.

The difference between RAWIP and PUREIP is that they generate IPv6
link-local address and IPv6 global address in different ways.

RAWIP:
~~~~~~
In the ipv6_generate_eui64() function, using RAWIP will always return 0,
which will cause the kernel to automatically generate an IPv6 link-local
address in EUI64 format and an IPv6 global address in EUI64 format.

PUREIP:
~~~~~~~
After this patch set, when using PUREIP, kernel doesn't generate IPv6
link-local address regardless of which IN6_ADDR_GEN_MODE is used.

@@  static void addrconf_dev_config(struct net_device *dev)
+       if (dev->type == ARPHRD_PUREIP)
+               return;

And after recving RA message, kernel iterates over the link-local address
that exists for the interface and uses the low 64bits of the link-local
address to generate the IPv6 global address.
The general process is as follows:
ndisc_router_discovery() -> addrconf_prefix_rcv() -> ipv6_generate_eui64() -> ipv6_inherit_eui64()

> to be the same to me.  If they are different, where is that documented?
> 
> thanks,
> 
> greg k-h

I tried to find corresponding documents about other device types, but I
am sorry I didn't find it. If it is needed, I am willing to provide.

Thanks,
Rocco


More information about the linux-arm-kernel mailing list