From: Benoît Ganne Date: Fri, 26 Feb 2021 13:46:58 +0000 (+0100) Subject: classify: fix crash if no pcap filter has been configured X-Git-Tag: v21.10-rc0~447 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F64%2F31464%2F3;p=vpp.git classify: fix crash if no pcap filter has been configured If no pcap filters have ever been configured and we try to enable pcap capture with a filter, cm->classify_table_index_by_sw_if_index is not initialized yet. Type: fix Change-Id: I2f509c58f9984951b1ad81c1c8ed912cb594fce1 Signed-off-by: Benoît Ganne --- diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c index a901e17e413..54e0673544f 100644 --- a/src/vnet/interface_cli.c +++ b/src/vnet/interface_cli.c @@ -1971,7 +1971,8 @@ vnet_pcap_dispatch_trace_configure (vnet_pcap_dispatch_trace_args_t * a) /* Classify filter specified, but no classify filter configured */ if ((a->rx_enable + a->tx_enable + a->drop_enable) && a->filter && - cm->classify_table_index_by_sw_if_index[0] == ~0) + (!cm->classify_table_index_by_sw_if_index || + cm->classify_table_index_by_sw_if_index[0] == ~0)) return VNET_API_ERROR_NO_SUCH_LABEL; if (a->rx_enable + a->tx_enable + a->drop_enable)