[PATCH dpdk v2 09/16] pipeline: use ipv6 addr struct

Robin Jarry rjarry at redhat.com
Fri Oct 4 13:55:42 CEST 2024


Stephen Hemminger, Oct 04, 2024 at 01:23:
> On Tue,  1 Oct 2024 10:17:21 +0200
> Robin Jarry <rjarry at redhat.com> wrote:
>
>> diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
>> index e8269ea90c11..66fdeac8f501 100644
>> --- a/examples/ip_pipeline/cli.c
>> +++ b/examples/ip_pipeline/cli.c
>> @@ -3540,8 +3540,8 @@ parse_table_action_encap(char **tokens,
>>  				parser_read_uint8(&hop_limit, tokens[5]))
>>  				return 0;
>>  
>> -			memcpy(a->encap.vxlan.ipv6.sa, sa.s6_addr, 16);
>> -			memcpy(a->encap.vxlan.ipv6.da, da.s6_addr, 16);
>> +			memcpy(&a->encap.vxlan.ipv6.sa, sa.s6_addr, 16);
>> +			memcpy(&a->encap.vxlan.ipv6.da, da.s6_addr, 16);
>>  			a->encap.vxlan.ipv6.flow_label = flow_label;
>>  			a->encap.vxlan.ipv6.dscp = dscp;
>>  			a->encap.vxlan.ipv6.hop_limit = hop_limit;
>> @@ -3615,7 +3615,7 @@ parse_table_action_nat(char **tokens,
>>  			return 0;
>>  
>>  		a->nat.ip_version = 0;
>> -		memcpy(a->nat.addr.ipv6, addr.s6_addr, 16);
>> +		memcpy(&a->nat.addr.ipv6, addr.s6_addr, 16);
>
> Why keep the memcpy when you just introduced an address copy routine?
> Or use assignment here.

These are two different types. The cmdline library uses POSIX struct 
in6_addr and I cannot assign them without risking alignment issues.



More information about the dev mailing list