nat: fix byte order error. 59/37559/6
authorHuawei LI <lihuawei_zzu@163.com>
Sat, 29 Oct 2022 13:20:07 +0000 (21:20 +0800)
committerOle Tr�an <otroan@employees.org>
Mon, 7 Nov 2022 07:58:55 +0000 (07:58 +0000)
commit9ff833d8f4ccccc475f9a302b8f70eed49963472
tree549bd4356c271427f60857f08dbdffa7bc3d4c7f
parentce1ff6a9b1ab2c4ab74165b26c92c2d551f53cf8
nat: fix byte order error.

fix byte order error about the struct snat_address_t's member net.
for example configurations:
  set interface ip table loop1 1
  set interface ip addr loop1 10.10.10.2/24
  nat44 add address 10.10.10.2 tenant-vrf 1
the snat address's net should be "as_u8 = {0xa, 0xa, 0xa, 0x0}",
but now it's "as_u8 = {0x0, 0xa, 0xa, 0x2}" because of missing
transition of byte order about the member net of snat_address_t.
(gdb) p/x *snat_main->addresses
$3 = {addr = {data = {0xa, 0xa, 0xa, 0x2}, data_u32 = 0x20a0a0a,
      as_u8 = {0xa, 0xa, 0xa, 0x2}, as_u16 = {0xa0a, 0x20a},
      as_u32 = 0x20a0a0a}, net = {data = {0x0, 0xa, 0xa, 0x2},
      data_u32 = 0x20a0a00, as_u8 = {0x0, 0xa, 0xa, 0x2},
      as_u16 = {0xa00, 0x20a}, as_u32 = 0x20a0a00},
      sw_if_index = 0x3, fib_index = 0x1,addr_len = 0x18}
(gdb)

Type: fix

Signed-off-by: Huawei LI <lihuawei_zzu@163.com>
Change-Id: I4f25f0639ae90a7f2e8715b44f825571283d994d
src/plugins/nat/nat44-ed/nat44_ed.c