summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiotr Bronowski <piotrx.bronowski@intel.com>2023-02-23 09:56:49 +0000
committerFan Zhang <fanzhang.oss@gmail.com>2023-07-21 00:28:05 +0000
commit3a6bc6f1276e571b00643e4859ed193bfa76406c (patch)
tree5327102f7535f7aeb18c19a85f341edc5b4270d6
parent2da272e3daf7d51dce2fcfea02d870427c3de970 (diff)
ipsec: fix logic in ext_hdr_is_pre_esp
When _VEC128 instructions are not enabled logic is buggy. The function always returned 1. Type: fix Signed-off-by: Piotr Bronowski <piotrx.bronowski@intel.com> Change-Id: I603200637e8d65813f4e49ef15d798e74b79b9cf
-rw-r--r--src/vnet/ipsec/esp_encrypt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vnet/ipsec/esp_encrypt.c b/src/vnet/ipsec/esp_encrypt.c
index 7f9b5ed8adf..86f9094cedc 100644
--- a/src/vnet/ipsec/esp_encrypt.c
+++ b/src/vnet/ipsec/esp_encrypt.c
@@ -182,9 +182,9 @@ ext_hdr_is_pre_esp (u8 nexthdr)
return !u8x16_is_all_zero (ext_hdr_types == u8x16_splat (nexthdr));
#else
- return ((nexthdr ^ IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS) |
- (nexthdr ^ IP_PROTOCOL_IPV6_ROUTE) |
- ((nexthdr ^ IP_PROTOCOL_IPV6_FRAGMENTATION) != 0));
+ return (!(nexthdr ^ IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS) ||
+ !(nexthdr ^ IP_PROTOCOL_IPV6_ROUTE) ||
+ !(nexthdr ^ IP_PROTOCOL_IPV6_FRAGMENTATION));
#endif
}