summaryrefslogtreecommitdiffstats
path: root/src/vnet/ipsec/ah.h
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2018-09-26 11:19:00 +0200
committerDamjan Marion <dmarion@me.com>2018-10-03 17:38:41 +0000
commit611864f4bddf787aff3323f162da589b1b26529c (patch)
tree685ae115de9e2fac60d14002ed748f4379ac8112 /src/vnet/ipsec/ah.h
parent400ded36422689c1783e220a1846447bc0058234 (diff)
ipsec: add missing ipv6 ah code & ipv6 tests
Change-Id: I89e90193ded1beb6cb0950c15737f9467efac1c3 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src/vnet/ipsec/ah.h')
-rw-r--r--src/vnet/ipsec/ah.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vnet/ipsec/ah.h b/src/vnet/ipsec/ah.h
index 37fc29a1ced..f74ad9b01c1 100644
--- a/src/vnet/ipsec/ah.h
+++ b/src/vnet/ipsec/ah.h
@@ -49,6 +49,15 @@ typedef CLIB_PACKED (struct {
}) ip6_and_ah_header_t;
/* *INDENT-ON* */
+always_inline u8
+ah_calc_icv_padding_len (u8 icv_size, int is_ipv6)
+{
+ ASSERT (0 == is_ipv6 || 1 == is_ipv6);
+ const u8 req_multiple = 4 + 4 * is_ipv6; // 4 for ipv4, 8 for ipv6
+ const u8 total_size = sizeof (ah_header_t) + icv_size;
+ return (req_multiple - total_size % req_multiple) % req_multiple;
+}
+
#endif /* __AH_H__ */
/*