> the value we get in *sl_index_iterate at line 870 is 0 rather than the 4.

The pointer sl_index_iterate points to what would be the next index in the list.

> why this is happening?

That is the normal thing for-loops [0] in C do, if break does not happen.
See [1].

A fix could be something simple like [2].

Vratko.

[0] 
https://github.com/FDio/vpp/blob/stable/2005/src/vppinfra/vec_bootstrap.h#L211
[1] https://stackoverflow.com/a/20302114
[2] https://gerrit.fd.io/r/c/vpp/+/27972

From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of Chinmaya Aggarwal
Sent: Monday, 2020-July-20 14:43
To: vpp-dev@lists.fd.io
Subject: [vpp-dev] Issue faced while deleting segment list in sr policy

Hi,
We are testing VAPI for sr policy.
We added two sr policies :-

Policy 1
bsid : 3d97:5fd3:fd2b:e77:a0:d358:c873:9a98
SID List at index 0 : 2001:19:a1::1,2001:19:a2::1,2001:19:a3::1
SID List at index 1 : 2001:19:b1::1,2001:19:b2::1,2001:19:b3::1
SID List at index 2 : 2001:19:c1::1,2001:19:c2::1,2001:19:c3::1

Policy 2
bsid : 6d97:5fd3:fd2b:e77:a0:d358:c873:9a98
SID List at index 3 : 2001:19:d1::1,2001:19:d3::1
SID List at index 4 : 2001:19:e1::1,2001:19:e2::1,2001:19:e3::1

We are trying to delete the segment list at index 0 for policy 2 (ideally it 
should return an error). But on executing sr_policy_mod api, our application 
along with VPP gets hanged. On debugging the code we observed that in the below 
code snippet

File : /src/vnet/srv6/sr_policy_rewrite.c
Function : sr_policy_mod

865      /* Check that the SR list does exist and is assigned to the sr policy 
*/
866      vec_foreach (sl_index_iterate, sr_policy->segments_lists)
867          if (*sl_index_iterate == sl_index)
868            break;
869
870      if (*sl_index_iterate != sl_index)

After all the indexes in sr_policy->segments_lists are iterated, the value we 
get in *sl_index_iterate at line 870 is 0 rather than the 4. Somehow, after the 
complete iteration, the index is reset to 0.

Can anyone please suggest why this is happening?


Thanks and Regards,
Chinmaya Agarwal.
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#17004): https://lists.fd.io/g/vpp-dev/message/17004
Mute This Topic: https://lists.fd.io/mt/75680646/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-
  • ... Chinmaya Aggarwal
    • ... Vratko Polak -X (vrpolak - PANTHEON TECHNOLOGIES at Cisco) via lists.fd.io

Reply via email to