summaryrefslogtreecommitdiffstats
path: root/src/vnet/ipsec/ah.h
diff options
context:
space:
mode:
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__ */
/*