diff options
author | Jon Loeliger <jdl@netgate.com> | 2019-11-08 15:05:23 -0600 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2019-11-12 20:37:55 +0000 |
commit | 9485d99bd3941b13abf7e47fc7e1d56f7b4fee55 (patch) | |
tree | d3f4e90f5cdd5966300d61c89c4bfea81ce5dab9 /src/vnet/interface_api.c | |
parent | 592a909a302262cf4088a5468b8e427f577725e8 (diff) |
interface: Allow VLAN tag-rewrite on non-sub-interfaces too.
This fix was first made in
commit fdea5c6a00b74971dbb1b7ec4e25839a871006ca
but was subsequently lost in
commit 053204ab039d34a990ff0e14c32ce3b294fcce0e
Added unit test for setting VTR on a non-sub-interface to
help ensure no future regressions of this ability.
Type: fix
Change-Id: I71ce2684fb72383741455829ae2d397ea2e95eae
Signed-off-by: Jon Loeliger <jdl@netgate.com>
Diffstat (limited to 'src/vnet/interface_api.c')
-rw-r--r-- | src/vnet/interface_api.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c index 3b0c515f013..0dad168203d 100644 --- a/src/vnet/interface_api.c +++ b/src/vnet/interface_api.c @@ -272,26 +272,26 @@ send_sw_interface_details (vpe_api_main_t * am, mp->sub_inner_vlan_id = ntohs (sub->eth.inner_vlan_id); mp->sub_if_flags = ntohl (sub->eth.raw_flags & SUB_IF_API_FLAG_MASK_VNET); + } - /* vlan tag rewrite data */ - u32 vtr_op = L2_VTR_DISABLED; - u32 vtr_push_dot1q = 0, vtr_tag1 = 0, vtr_tag2 = 0; + /* vlan tag rewrite data */ + u32 vtr_op = L2_VTR_DISABLED; + u32 vtr_push_dot1q = 0, vtr_tag1 = 0, vtr_tag2 = 0; - if (l2vtr_get (am->vlib_main, am->vnet_main, swif->sw_if_index, - &vtr_op, &vtr_push_dot1q, &vtr_tag1, &vtr_tag2) != 0) - { - // error - default to disabled - mp->vtr_op = ntohl (L2_VTR_DISABLED); - clib_warning ("cannot get vlan tag rewrite for sw_if_index %d", - swif->sw_if_index); - } - else - { - mp->vtr_op = ntohl (vtr_op); - mp->vtr_push_dot1q = ntohl (vtr_push_dot1q); - mp->vtr_tag1 = ntohl (vtr_tag1); - mp->vtr_tag2 = ntohl (vtr_tag2); - } + if (l2vtr_get (am->vlib_main, am->vnet_main, swif->sw_if_index, + &vtr_op, &vtr_push_dot1q, &vtr_tag1, &vtr_tag2) != 0) + { + // error - default to disabled + mp->vtr_op = ntohl (L2_VTR_DISABLED); + clib_warning ("cannot get vlan tag rewrite for sw_if_index %d", + swif->sw_if_index); + } + else + { + mp->vtr_op = ntohl (vtr_op); + mp->vtr_push_dot1q = ntohl (vtr_push_dot1q); + mp->vtr_tag1 = ntohl (vtr_tag1); + mp->vtr_tag2 = ntohl (vtr_tag2); } /* pbb tag rewrite data */ |