ethernet: check destination mac for L3 in ethernet-input node 56/40756/4
authorSteven Luong <[email protected]>
Fri, 19 Apr 2024 16:49:20 +0000 (09:49 -0700)
committerDamjan Marion <[email protected]>
Wed, 8 May 2024 09:42:23 +0000 (09:42 +0000)
commite4238aa34f89ff8b60243978ade55828662d268a
tree6be930259b344ad78610587d2c63b0ebddd0f726
parentdba5c4194292b67f6825ef3eee0640b9970b026b
ethernet: check destination mac for L3 in ethernet-input node

When the NIC does not support mac filter, we rely on ethernet-input
node to do the destination mac check, ie, when the interface is in L3,
the mac address for the packet must be the mac address of the
interface where the packet arrives. This works fine in ethernet-input
node when all packets in the frame might have different interfaces, ie,
ETH_INPUT_FRAME_F_SINGLE_SW_IF_ID is not set in the frame. However,
when all packets are having the same interface,
ETH_INPUT_FRAME_F_SINGLE_SW_IF_ID is set, ethernet-input node goes
through the optimized routine eth_input_single_int -> eth_input_process_frame.
That is where dmac check has a bug when all packets in the frame are
either, ip4, ip6, or mpls without vlan tags. Because without vlan tags,
the code handles all packets in fast path and ignores dmac check.
With vlan tags, the code goes to slow path where dmac check is handled
properly.

The fix is to check if we have a bad dmac in the fast path and force the
code to go to slow path which will handle dmac check properly.

Also do a wholesale correction on all the testcases which do not use
the proper dmac when sending L3 packets.

Type: fix

Change-Id: I73153a805cecdc24c4eefcc781676de04737ae2c
Signed-off-by: Steven Luong <[email protected]>
20 files changed:
src/vnet/ethernet/node.c
test/test_abf.py
test/test_flowprobe.py
test/test_gso.py
test/test_gtpu.py
test/test_ip6.py
test/test_ip6_nd_mirror_proxy.py
test/test_ipip.py
test/test_l3xc.py
test/test_linux_cp.py
test/test_map.py
test/test_map_br.py
test/test_mpls.py
test/test_nat44_ed_output.py
test/test_neighbor.py
test/test_pcap.py
test/test_reassembly.py
test/test_srv6_mobile.py
test/test_trace_filter.py
test/test_vxlan.py