From 76b19ceafcf892b56a679d3d7fe5c6f4b93f7de7 Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Tue, 10 Aug 2021 23:44:44 +0200 Subject: ip: Fix crash in ip address add on sub-int without exact-match Type: fix Creating a sub-int without exact-match set, and subsequently adding an IPv4 or IPv6 address will crash VPP. This fix catches this situation and refuses to allow the caller to add an IPv4 or IPv6 address on an ethernet sub-int that does not have exact-match set. TESTED: Before this change, the following crashes VPP: ``` DBGvpp# cre sub TenGigabitEthernet3/0/0 1 dot1q 10 TenGigabitEthernet3/0/0.1 DBGvpp# set interface ip address TenGigabitEthernet3/0/0.1 2001:db8::1/64 ``` After the change, VPP refuses to act: ``` DBGvpp# cre sub TenGigabitEthernet3/0/0 1 dot1q 10 TenGigabitEthernet3/0/0.1 DBGvpp# set interface ip address TenGigabitEthernet3/0/0.1 192.0.2.1/30 set interface ip address: sub-interface without exact-match doesn't support IP addressing DBGvpp# set interface ip address TenGigabitEthernet3/0/0.1 2001:db8:1/64 set interface ip address: sub-interface without exact-match doesn't support IP addressing ``` Signed-off-by: Pim van Pelt Change-Id: I42997db314225cd186ebb54013b5717ace7f7bd6 --- src/vnet/interface_funcs.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/vnet/interface_funcs.h') diff --git a/src/vnet/interface_funcs.h b/src/vnet/interface_funcs.h index 3db5a2d8c11..28312d4c85a 100644 --- a/src/vnet/interface_funcs.h +++ b/src/vnet/interface_funcs.h @@ -350,6 +350,9 @@ vnet_sw_interface_is_sub (vnet_main_t *vnm, u32 sw_if_index) return (sw->sw_if_index != sw->sup_sw_if_index); } +clib_error_t *vnet_sw_interface_supports_addressing (vnet_main_t *vnm, + u32 sw_if_index); + always_inline vlib_frame_t * vnet_get_frame_to_sw_interface (vnet_main_t * vnm, u32 sw_if_index) { -- cgit 1.2.3-korg