diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2020-09-08 06:08:05 +0000 |
---|---|---|
committer | Beno�t Ganne <bganne@cisco.com> | 2020-10-05 13:28:09 +0000 |
commit | 84962d19ba76eafd5c7658aa86ec61c9b81f7702 (patch) | |
tree | 15745b531b9fc6e15a53c26c46bb6d2ed80472a4 /src/plugins/ikev2/ikev2_priv.h | |
parent | 7b4e52f88fdfd7b785a2741d3b61050040d8561d (diff) |
ikev2: support ipv6 traffic selectors & overlay
Ticket: VPP-1917
Type: feature
Change-Id: Ie9f22e7336aa7807b1967c48de9843df10fb575c
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/plugins/ikev2/ikev2_priv.h')
-rw-r--r-- | src/plugins/ikev2/ikev2_priv.h | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/src/plugins/ikev2/ikev2_priv.h b/src/plugins/ikev2/ikev2_priv.h index f6f9989e4b2..68a546a0f48 100644 --- a/src/plugins/ikev2/ikev2_priv.h +++ b/src/plugins/ikev2/ikev2_priv.h @@ -81,7 +81,7 @@ do { \ } \ } while (0) \ -#define ikev2_elog_exchange(_format, _ispi, _rspi, _addr) \ +#define ikev2_elog_exchange_internal(_format, _ispi, _rspi, _addr) \ do { \ ikev2_main_t *km = &ikev2_main; \ if (PREDICT_FALSE (km->log_level >= IKEV2_LOG_DEBUG)) \ @@ -110,6 +110,17 @@ do { \ } \ } while (0) \ +#define IKE_ELOG_IP4_FMT "%d.%d.%d.%d" +#define IKE_ELOG_IP6_FMT "[v6]:%x%x:%x%x" + +#define ikev2_elog_exchange(_fmt, _ispi, _rspi, _addr, _v4) \ +do { \ + if (_v4) \ + ikev2_elog_exchange_internal (_fmt IKE_ELOG_IP4_FMT, _ispi, _rspi, _addr);\ + else \ + ikev2_elog_exchange_internal (_fmt IKE_ELOG_IP6_FMT, _ispi, _rspi, _addr);\ +} while (0) + #define ikev2_elog_uint(_level, _format, _val) \ do { \ ikev2_main_t *km = &ikev2_main; \ @@ -156,31 +167,6 @@ do { \ } \ } while (0) -#define ikev2_elog_peers(_level, _format, _ip1, _ip2) \ -do { \ - ikev2_main_t *km = &ikev2_main; \ - if (PREDICT_FALSE (km->log_level >= _level)) \ - { \ - ELOG_TYPE_DECLARE (e) = \ - { \ - .format = "ikev2: " _format, \ - .format_args = "i1i1i1i1i1i1i1i1", \ - }; \ - CLIB_PACKED(struct { \ - u8 i11; u8 i12; u8 i13; u8 i14; \ - u8 i21; u8 i22; u8 i23; u8 i24; }) *ed; \ - ed = ELOG_DATA (&vlib_global_main.elog_main, e); \ - ed->i14 = (_ip1) >> 24; \ - ed->i13 = (_ip1) >> 16; \ - ed->i12 = (_ip1) >> 8; \ - ed->i11 = (_ip1); \ - ed->i24 = (_ip2) >> 24; \ - ed->i23 = (_ip2) >> 16; \ - ed->i22 = (_ip2) >> 8; \ - ed->i21 = (_ip2); \ - } \ -} while (0) - #define ikev2_elog_error(_msg) \ _ikev2_elog(IKEV2_LOG_ERROR, "[error] " _msg) #define ikev2_elog_warning(_msg) \ @@ -258,19 +244,19 @@ typedef struct typedef struct { - u8 ts_type; + ikev2_traffic_selector_type_t ts_type; u8 protocol_id; u16 selector_len; u16 start_port; u16 end_port; - ip4_address_t start_addr; - ip4_address_t end_addr; + ip_address_t start_addr; + ip_address_t end_addr; } ikev2_ts_t; typedef struct { u32 sw_if_index; - ip4_address_t ip4; + ip_address_t addr; } ikev2_responder_t; typedef struct @@ -368,8 +354,8 @@ typedef struct ikev2_state_t state; u8 unsupported_cp; u8 initial_contact; - ip4_address_t iaddr; - ip4_address_t raddr; + ip_address_t iaddr; + ip_address_t raddr; u64 ispi; u64 rspi; u8 *i_nonce; |