From 186b2156c02c785b16a6d3cd02d3d327928a5397 Mon Sep 17 00:00:00 2001 From: Jieqiang Wang Date: Sun, 14 Aug 2022 17:49:44 +0800 Subject: ethernet: fix mac address increment error Using "ip neighbor static count " to add static ARP entries will output wrong mac addresses due to lack of big/little endian conversion. Fix this error by converting mac address from big endian to little endian before doing the self-increment. Before patched: vpp# ip neighbor rdma-0 198.18.1.1 01:aa:bb:cc:dd:e0 static count 5 vpp# show ip neighbor Time IP Flags Ethernet Interface 4.4400 198.18.1.5 S 05:aa:bb:cc:dd:e0 rdma-0 4.4399 198.18.1.4 S 04:aa:bb:cc:dd:e0 rdma-0 4.4399 198.18.1.3 S 03:aa:bb:cc:dd:e0 rdma-0 4.4399 198.18.1.2 S 02:aa:bb:cc:dd:e0 rdma-0 4.4399 198.18.1.1 S 01:aa:bb:cc:dd:e0 rdma-0 After patched: vpp# ip neighbor rdma-0 198.18.1.1 01:aa:bb:cc:dd:e0 static count 5 vpp# show ip neighbor Time IP Flags Ethernet Interface 4.4528 198.18.1.5 S 01:aa:bb:cc:dd:e4 rdma-0 4.4528 198.18.1.4 S 01:aa:bb:cc:dd:e3 rdma-0 4.4528 198.18.1.3 S 01:aa:bb:cc:dd:e2 rdma-0 4.4527 198.18.1.2 S 01:aa:bb:cc:dd:e1 rdma-0 4.4527 198.18.1.1 S 01:aa:bb:cc:dd:e0 rdma-0 Type: fix Signed-off-by: Jieqiang Wang Change-Id: Iec1e00e381e4aba96639f831e7e42e070be3f278 --- src/vnet/ethernet/mac_address.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/vnet/ethernet/mac_address.c b/src/vnet/ethernet/mac_address.c index b7981299700..2237c3772b8 100644 --- a/src/vnet/ethernet/mac_address.c +++ b/src/vnet/ethernet/mac_address.c @@ -66,9 +66,9 @@ mac_address_increment (mac_address_t * mac) { u64 a; - a = mac_address_as_u64 (mac); + a = ethernet_mac_address_u64 (mac->bytes); a++; - mac_address_from_u64 (mac, a); + ethernet_mac_address_from_u64 (a, mac->bytes); } /* -- cgit 1.2.3-korg