summaryrefslogtreecommitdiffstats
path: root/src/plugins/map/ip6_map_t.c
diff options
context:
space:
mode:
authorAlexander Chernavin <achernavin@netgate.com>2020-02-11 09:57:09 -0500
committerOle Trøan <otroan@employees.org>2020-02-20 09:04:26 +0000
commitf145c15631ba62e798395499f83a2f8a91ae83c7 (patch)
treead1f80a1f23ced8de9100f17730cc28918d050cf /src/plugins/map/ip6_map_t.c
parentb728a3c8b74127e9a7decd8ecb7dc6cbefb0ab84 (diff)
map: honor pre-resolve param in map-t
With this commit, forward the translated packet directly to the specified next-hop if pre-resolve param is enabled in MAP-T. Type: fix Change-Id: Ie26080c7820318c7982599577a4af6e4d01a0574 Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
Diffstat (limited to 'src/plugins/map/ip6_map_t.c')
-rw-r--r--src/plugins/map/ip6_map_t.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/plugins/map/ip6_map_t.c b/src/plugins/map/ip6_map_t.c
index 5a9c9af76cc..01bf0f9c281 100644
--- a/src/plugins/map/ip6_map_t.c
+++ b/src/plugins/map/ip6_map_t.c
@@ -31,6 +31,7 @@ typedef enum
typedef enum
{
IP6_MAPT_ICMP_NEXT_IP4_LOOKUP,
+ IP6_MAPT_ICMP_NEXT_IP4_REWRITE,
IP6_MAPT_ICMP_NEXT_IP4_FRAG,
IP6_MAPT_ICMP_NEXT_DROP,
IP6_MAPT_ICMP_N_NEXT
@@ -39,6 +40,7 @@ typedef enum
typedef enum
{
IP6_MAPT_TCP_UDP_NEXT_IP4_LOOKUP,
+ IP6_MAPT_TCP_UDP_NEXT_IP4_REWRITE,
IP6_MAPT_TCP_UDP_NEXT_IP4_FRAG,
IP6_MAPT_TCP_UDP_NEXT_DROP,
IP6_MAPT_TCP_UDP_N_NEXT
@@ -47,6 +49,7 @@ typedef enum
typedef enum
{
IP6_MAPT_FRAGMENTED_NEXT_IP4_LOOKUP,
+ IP6_MAPT_FRAGMENTED_NEXT_IP4_REWRITE,
IP6_MAPT_FRAGMENTED_NEXT_IP4_FRAG,
IP6_MAPT_FRAGMENTED_NEXT_DROP,
IP6_MAPT_FRAGMENTED_N_NEXT
@@ -174,6 +177,11 @@ ip6_map_t_icmp (vlib_main_t * vm,
vnet_buffer (p0)->ip_frag.next_index = IP_FRAG_NEXT_IP4_LOOKUP;
next0 = IP6_MAPT_ICMP_NEXT_IP4_FRAG;
}
+ else
+ {
+ next0 = ip6_map_ip4_lookup_bypass (p0, NULL) ?
+ IP6_MAPT_ICMP_NEXT_IP4_REWRITE : next0;
+ }
err0:
if (PREDICT_TRUE (error0 == MAP_ERROR_NONE))
{
@@ -274,8 +282,7 @@ ip6_map_t_fragmented (vlib_main_t * vm,
n_left_from -= 1;
to_next += 1;
n_left_to_next -= 1;
-
- next0 = IP6_MAPT_TCP_UDP_NEXT_IP4_LOOKUP;
+ next0 = IP6_MAPT_FRAGMENTED_NEXT_IP4_LOOKUP;
p0 = vlib_get_buffer (vm, pi0);
if (map_ip6_to_ip4_fragmented (vm, p0))
@@ -293,6 +300,11 @@ ip6_map_t_fragmented (vlib_main_t * vm,
IP_FRAG_NEXT_IP4_LOOKUP;
next0 = IP6_MAPT_FRAGMENTED_NEXT_IP4_FRAG;
}
+ else
+ {
+ next0 = ip6_map_ip4_lookup_bypass (p0, NULL) ?
+ IP6_MAPT_FRAGMENTED_NEXT_IP4_REWRITE : next0;
+ }
}
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
@@ -459,6 +471,11 @@ ip6_map_t_tcp_udp (vlib_main_t * vm,
IP_FRAG_NEXT_IP4_LOOKUP;
next0 = IP6_MAPT_TCP_UDP_NEXT_IP4_FRAG;
}
+ else
+ {
+ next0 = ip6_map_ip4_lookup_bypass (p0, NULL) ?
+ IP6_MAPT_TCP_UDP_NEXT_IP4_REWRITE : next0;
+ }
}
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
@@ -679,6 +696,7 @@ VLIB_REGISTER_NODE(ip6_map_t_fragmented_node) = {
.next_nodes =
{
[IP6_MAPT_FRAGMENTED_NEXT_IP4_LOOKUP] = "ip4-lookup",
+ [IP6_MAPT_FRAGMENTED_NEXT_IP4_REWRITE] = "ip4-load-balance",
[IP6_MAPT_FRAGMENTED_NEXT_IP4_FRAG] = IP4_FRAG_NODE_NAME,
[IP6_MAPT_FRAGMENTED_NEXT_DROP] = "error-drop",
},
@@ -700,6 +718,7 @@ VLIB_REGISTER_NODE(ip6_map_t_icmp_node) = {
.next_nodes =
{
[IP6_MAPT_ICMP_NEXT_IP4_LOOKUP] = "ip4-lookup",
+ [IP6_MAPT_ICMP_NEXT_IP4_REWRITE] = "ip4-load-balance",
[IP6_MAPT_ICMP_NEXT_IP4_FRAG] = IP4_FRAG_NODE_NAME,
[IP6_MAPT_ICMP_NEXT_DROP] = "error-drop",
},
@@ -721,6 +740,7 @@ VLIB_REGISTER_NODE(ip6_map_t_tcp_udp_node) = {
.next_nodes =
{
[IP6_MAPT_TCP_UDP_NEXT_IP4_LOOKUP] = "ip4-lookup",
+ [IP6_MAPT_TCP_UDP_NEXT_IP4_REWRITE] = "ip4-load-balance",
[IP6_MAPT_TCP_UDP_NEXT_IP4_FRAG] = IP4_FRAG_NODE_NAME,
[IP6_MAPT_TCP_UDP_NEXT_DROP] = "error-drop",
},