diff options
author | Jieqiang Wang <jieqiang.wang@arm.com> | 2022-08-14 17:49:44 +0800 |
---|---|---|
committer | Neale Ranns <neale@graphiant.com> | 2022-08-29 23:55:08 +0000 |
commit | 186b2156c02c785b16a6d3cd02d3d327928a5397 (patch) | |
tree | aff5bebc481b56373440c14e809006be8dc4a4da /src | |
parent | d2acfbc8f8beaaa544d70163da1622a72a863084 (diff) |
ethernet: fix mac address increment error
Using "ip neighbor <ip-addr> <mac-addr> static count <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 <jieqiang.wang@arm.com>
Change-Id: Iec1e00e381e4aba96639f831e7e42e070be3f278
Diffstat (limited to 'src')
-rw-r--r-- | src/vnet/ethernet/mac_address.c | 4 |
1 files changed, 2 insertions, 2 deletions
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); } /* |