summaryrefslogtreecommitdiffstats
path: root/src/plugins/srv6-ad/ad.c
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2020-05-13 01:38:12 -0400
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-05-13 19:02:46 +0000
commit5b960c60f61c937d0f862be8a7573922b616de75 (patch)
tree1a272492e765d6068c5401cf53cbf7f30fbc1902 /src/plugins/srv6-ad/ad.c
parent83d129837534e832dfcf7aef39f6a8619e2c021c (diff)
sr: fix srv6/srv6-ad/srv6-as promisc mode switch
Calling ethernet_set_flags() to switch interface to/from promiscuous mode must use use hw_if_index instead of sw_if_index. Type: fix Signed-off-by: John Lo <loj@cisco.com> Change-Id: I72da286b913893227e32193ee11fbbc56e04804d
Diffstat (limited to 'src/plugins/srv6-ad/ad.c')
-rw-r--r--src/plugins/srv6-ad/ad.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/plugins/srv6-ad/ad.c b/src/plugins/srv6-ad/ad.c
index 1b11037f343..045ddeb466d 100644
--- a/src/plugins/srv6-ad/ad.c
+++ b/src/plugins/srv6-ad/ad.c
@@ -105,8 +105,12 @@ srv6_ad_localsid_creation_fn (ip6_sr_localsid_t * localsid)
/* Set interface in promiscuous mode */
vnet_main_t *vnm = vnet_get_main ();
- ethernet_set_flags (vnm, ls_mem->sw_if_index_in,
- ETHERNET_INTERFACE_FLAG_ACCEPT_ALL);
+ vnet_hw_interface_t *hi =
+ vnet_get_sup_hw_interface (vnm, ls_mem->sw_if_index_in);
+ /* Make sure it is main interface */
+ if (hi->sw_if_index == ls_mem->sw_if_index_in)
+ ethernet_set_flags (vnm, hi->hw_if_index,
+ ETHERNET_INTERFACE_FLAG_ACCEPT_ALL);
/* Associate local SID index to this interface (resize vector if needed) */
if (ls_mem->sw_if_index_in >= vec_len (sm->sw_iface_localsid2))
@@ -196,7 +200,11 @@ srv6_ad_localsid_removal_fn (ip6_sr_localsid_t * localsid)
/* Disable promiscuous mode on the interface */
vnet_main_t *vnm = vnet_get_main ();
- ethernet_set_flags (vnm, ls_mem->sw_if_index_in, 0);
+ vnet_hw_interface_t *hi =
+ vnet_get_sup_hw_interface (vnm, ls_mem->sw_if_index_in);
+ /* Make sure it is main interface */
+ if (hi->sw_if_index == ls_mem->sw_if_index_in)
+ ethernet_set_flags (vnm, hi->hw_if_index, 0);
/* Remove local SID index from interface table */
sm->sw_iface_localsid2[ls_mem->sw_if_index_in] = ~(u32) 0;