On 2023/02/21 1:35, Simon Horman wrote:
> On Tue, Feb 14, 2023 at 12:39:04PM +0900, Nobuhiro MIKI wrote:
>> This is useful in test cases where multiple IPv4/IPv6 addresses
>> are assigned together.
>>
>> Signed-off-by: Nobuhiro MIKI <nm...@yahoo-corp.jp>
>> ---
>>  lib/netdev-dummy.c | 66 +++++++++++++++++++++++++++++-----------------
>>  1 file changed, 42 insertions(+), 24 deletions(-)
>>
>> diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
>> index 5d59c9c0312b..abeb99f3e3d6 100644
>> --- a/lib/netdev-dummy.c
>> +++ b/lib/netdev-dummy.c
> 
> ...
> 
>> @@ -1178,7 +1184,10 @@ netdev_dummy_send(struct netdev *netdev, int qid,
>>          dummy_packet_conn_send(&dev->conn, buffer, size);
>>  
>>          /* Reply to ARP requests for 'dev''s assigned IP address. */
>> -        if (dev->address.s_addr) {
>> +        struct netdev_addr_dummy *addr_dummy;
>> +        LIST_FOR_EACH (addr_dummy, node, &dev->addrs) {
>> +            ovs_be32 address = 
>> in6_addr_get_mapped_ipv4(&addr_dummy->address);
>> +
>>              struct dp_packet dp;
>>              struct flow flow;
>>  
>> @@ -1186,7 +1195,7 @@ netdev_dummy_send(struct netdev *netdev, int qid,
>>              flow_extract(&dp, &flow);
>>              if (flow.dl_type == htons(ETH_TYPE_ARP)
>>                  && flow.nw_proto == ARP_OP_REQUEST
>> -                && flow.nw_dst == dev->address.s_addr) {
>> +                && flow.nw_dst == address) {
>>                  struct dp_packet *reply = dp_packet_new(0);
>>                  compose_arp(reply, ARP_OP_REPLY, dev->hwaddr, flow.dl_src,
>>                              false, flow.nw_dst, flow.nw_src);
> 
> The next few lines of this function are.
> 
>                 netdev_dummy_queue_packet(dev, reply, NULL, 0);
>             }
>         }
> 
> I wonder if it would be appropriate to add a break; after
> the call to netdev_dummy_queue_packet(). I don't think we expect
> multiple hits. And it would save spinning over the loop unnecessarily,
> though perhaps we don't expect the list of addresses to be very long
> else we wouldn't use a list at all.
> 
> ...
> 
> Regardless, this patch looks good to me.
> 
> Reviewed-by: Simon Horman <simon.hor...@corigine.com>

Thanks for your review.

I have confirmed that adding a break; after the call to
netdev_dummy_queue_packet() works fine.
I'll submit the new patch with this fix.

Best Regards,
Nobuhiro MIKI
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to