nat: fix dhcp client on outside interface with output feature
[vpp.git] / src / plugins / nat / in2out_ed.c
index 0209a40..e524110 100644 (file)
@@ -28,7 +28,7 @@
 #include <nat/nat.h>
 #include <nat/nat_ipfix_logging.h>
 #include <nat/nat_inlines.h>
-#include <nat/nat44_inlines.h>
+#include <nat/nat44/inlines.h>
 #include <nat/nat_syslog.h>
 #include <nat/nat_ha.h>
 
@@ -211,7 +211,7 @@ slow_path_ed (snat_main_t * sm,
 
   nat44_session_try_cleanup (&key->l_addr, rx_fib_index, thread_index, now);
 
-  if (PREDICT_FALSE (maximum_sessions_exceeded (sm, thread_index)))
+  if (PREDICT_FALSE (nat44_maximum_sessions_exceeded (sm, thread_index)))
     {
       b->error = node->errors[NAT_IN2OUT_ED_ERROR_MAX_SESSIONS_EXCEEDED];
       nat_ipfix_logging_max_sessions (thread_index, sm->max_translations);
@@ -685,7 +685,7 @@ nat44_ed_in2out_unknown_proto (snat_main_t * sm,
     }
   else
     {
-      if (PREDICT_FALSE (maximum_sessions_exceeded (sm, thread_index)))
+      if (PREDICT_FALSE (nat44_maximum_sessions_exceeded (sm, thread_index)))
        {
          b->error = node->errors[NAT_IN2OUT_ED_ERROR_MAX_SESSIONS_EXCEEDED];
          nat_ipfix_logging_max_sessions (thread_index, sm->max_translations);
@@ -1001,11 +1001,11 @@ nat44_ed_in2out_node_fn_inline (vlib_main_t * vm,
                       * be able to use dhcp client on the outside interface
                       */
                      if (PREDICT_FALSE
-                         ((b0->flags & VNET_BUFFER_F_LOCALLY_ORIGINATED)
-                          && proto0 == SNAT_PROTOCOL_UDP
+                         (proto0 == SNAT_PROTOCOL_UDP
                           && (vnet_buffer (b0)->ip.reass.l4_dst_port ==
                               clib_host_to_net_u16
-                              (UDP_DST_PORT_dhcp_to_server))))
+                              (UDP_DST_PORT_dhcp_to_server))
+                          && ip0->dst_address.as_u32 == 0xffffffff))
                        goto trace00;
                    }
                  else
@@ -1245,11 +1245,11 @@ nat44_ed_in2out_node_fn_inline (vlib_main_t * vm,
                       * be able to use dhcp client on the outside interface
                       */
                      if (PREDICT_FALSE
-                         ((b1->flags & VNET_BUFFER_F_LOCALLY_ORIGINATED)
-                          && proto1 == SNAT_PROTOCOL_UDP
+                         (proto1 == SNAT_PROTOCOL_UDP
                           && (vnet_buffer (b1)->ip.reass.l4_dst_port ==
                               clib_host_to_net_u16
-                              (UDP_DST_PORT_dhcp_to_server))))
+                              (UDP_DST_PORT_dhcp_to_server))
+                          && ip1->dst_address.as_u32 == 0xffffffff))
                        goto trace01;
                    }
                  else
@@ -1538,11 +1538,11 @@ nat44_ed_in2out_node_fn_inline (vlib_main_t * vm,
                       * be able to use dhcp client on the outside interface
                       */
                      if (PREDICT_FALSE
-                         ((b0->flags & VNET_BUFFER_F_LOCALLY_ORIGINATED)
-                          && proto0 == SNAT_PROTOCOL_UDP
+                         (proto0 == SNAT_PROTOCOL_UDP
                           && (vnet_buffer (b0)->ip.reass.l4_dst_port ==
                               clib_host_to_net_u16
-                              (UDP_DST_PORT_dhcp_to_server))))
+                              (UDP_DST_PORT_dhcp_to_server))
+                          && ip0->dst_address.as_u32 == 0xffffffff))
                        goto trace0;
                    }
                  else