diff options
author | Neale Ranns <nranns@cisco.com> | 2019-04-10 08:24:03 +0000 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2019-04-10 08:24:03 +0000 |
commit | 9b208ced585d3b4620d6fde586cd047fe2027ecf (patch) | |
tree | 6f20f6297c58bf15b98c1fb3576ad59a14aa5e15 /src/vnet/ipsec/ipsec_input.c | |
parent | 1cf0007f394fde9beda3aa5150aac581a1075cf2 (diff) |
IPSEC: remove double byte swap of IP addresses
Change-Id: I8c03c4aa90fb0056e11e0f234999c25d7839d759
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/ipsec/ipsec_input.c')
-rw-r--r-- | src/vnet/ipsec/ipsec_input.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/vnet/ipsec/ipsec_input.c b/src/vnet/ipsec/ipsec_input.c index 5be72c3a161..778570a41d4 100644 --- a/src/vnet/ipsec/ipsec_input.c +++ b/src/vnet/ipsec/ipsec_input.c @@ -86,25 +86,25 @@ ipsec_input_protect_policy_match (ipsec_spd_t * spd, u32 sa, u32 da, u32 spi) if (ipsec_sa_is_set_IS_TUNNEL (s)) { - if (da != clib_net_to_host_u32 (s->tunnel_dst_addr.ip4.as_u32)) + if (da != s->tunnel_dst_addr.ip4.as_u32) continue; - if (sa != clib_net_to_host_u32 (s->tunnel_src_addr.ip4.as_u32)) + if (sa != s->tunnel_src_addr.ip4.as_u32) continue; return p; } - if (da < clib_net_to_host_u32 (p->laddr.start.ip4.as_u32)) + if (da < p->laddr.start.ip4.as_u32) continue; - if (da > clib_net_to_host_u32 (p->laddr.stop.ip4.as_u32)) + if (da > p->laddr.stop.ip4.as_u32) continue; - if (sa < clib_net_to_host_u32 (p->raddr.start.ip4.as_u32)) + if (sa < p->raddr.start.ip4.as_u32) continue; - if (sa > clib_net_to_host_u32 (p->raddr.stop.ip4.as_u32)) + if (sa > p->raddr.stop.ip4.as_u32) continue; return p; @@ -233,12 +233,8 @@ VLIB_NODE_FN (ipsec4_input_node) (vlib_main_t * vm, /* FIXME TODO missing check whether there is enough data inside * IP/UDP to contain ESP header & stuff ? */ p0 = ipsec_input_protect_policy_match (spd0, - clib_net_to_host_u32 - (ip0->src_address. - as_u32), - clib_net_to_host_u32 - (ip0->dst_address. - as_u32), + ip0->src_address.as_u32, + ip0->dst_address.as_u32, clib_net_to_host_u32 (esp0->spi)); @@ -283,12 +279,8 @@ VLIB_NODE_FN (ipsec4_input_node) (vlib_main_t * vm, { ah0 = (ah_header_t *) ((u8 *) ip0 + ip4_header_bytes (ip0)); p0 = ipsec_input_protect_policy_match (spd0, - clib_net_to_host_u32 - (ip0->src_address. - as_u32), - clib_net_to_host_u32 - (ip0->dst_address. - as_u32), + ip0->src_address.as_u32, + ip0->dst_address.as_u32, clib_net_to_host_u32 (ah0->spi)); |