ipsec: Honour IPSec SA table-ID over API 15/30815/3
authorNeale Ranns <neale@graphiant.com>
Tue, 19 Jan 2021 13:30:23 +0000 (13:30 +0000)
committerOle Tr�an <otroan@employees.org>
Thu, 21 Jan 2021 10:58:39 +0000 (10:58 +0000)
Type: fix

Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: Ib08fe356e4dc710dd60a96736c48b27129f06786

src/vnet/ipsec/ipsec_api.c
src/vnet/ipsec/ipsec_format.c

index 335996e..1a419e5 100644 (file)
@@ -454,15 +454,11 @@ static void vl_api_ipsec_sad_entry_add_del_v2_t_handler
   ip_address_decode (&mp->entry.tunnel_dst, &tun_dst);
 
   if (mp->is_add)
-    rv = ipsec_sa_add_and_lock (id, spi, proto,
-                               crypto_alg, &crypto_key,
-                               integ_alg, &integ_key, flags,
-                               0, mp->entry.salt, &tun_src, &tun_dst,
-                               tunnel_flags,
-                               ip_dscp_decode (mp->entry.dscp),
-                               &sa_index,
-                               htons (mp->entry.udp_src_port),
-                               htons (mp->entry.udp_dst_port));
+    rv = ipsec_sa_add_and_lock (
+      id, spi, proto, crypto_alg, &crypto_key, integ_alg, &integ_key, flags,
+      htonl (mp->entry.tx_table_id), mp->entry.salt, &tun_src, &tun_dst,
+      tunnel_flags, ip_dscp_decode (mp->entry.dscp), &sa_index,
+      htons (mp->entry.udp_src_port), htons (mp->entry.udp_dst_port));
   else
     rv = ipsec_sa_unlock_id (id);
 
index 552d446..909254a 100644 (file)
@@ -320,8 +320,10 @@ format_ipsec_sa (u8 * s, va_list * args)
 
   if (ipsec_sa_is_set_IS_TUNNEL (sa))
     {
-      tx_table_id = fib_table_get_table_id (sa->tx_fib_index,
-                                           FIB_PROTOCOL_IP4);
+      tx_table_id = fib_table_get_table_id (
+       sa->tx_fib_index,
+       (ipsec_sa_is_set_IS_TUNNEL_V6 (sa) ? FIB_PROTOCOL_IP6 :
+                                            FIB_PROTOCOL_IP4));
       s = format (s, "\n   table-ID %d tunnel %U src %U dst %U flags %U",
                  tx_table_id,
                  format_ip_dscp, sa->dscp,