ip: add API to retrieve IPv6 link-layer address
[vpp.git] / src / vnet / vxlan / vxlan.c
index ea1748c..71d03f6 100644 (file)
 #include <vnet/mfib/mfib_table.h>
 #include <vnet/adj/adj_mcast.h>
 #include <vnet/adj/rewrite.h>
+#include <vnet/dpo/drop_dpo.h>
 #include <vnet/interface.h>
 #include <vnet/flow/flow.h>
+#include <vnet/udp/udp_local.h>
 #include <vlib/vlib.h>
 
 /**
@@ -150,11 +152,19 @@ vxlan_tunnel_restack_dpo (vxlan_tunnel_t * t)
    * skip single bucket load balance dpo's */
   while (DPO_LOAD_BALANCE == dpo.dpoi_type)
     {
-      load_balance_t *lb = load_balance_get (dpo.dpoi_index);
+      const load_balance_t *lb;
+      const dpo_id_t *choice;
+
+      lb = load_balance_get (dpo.dpoi_index);
       if (lb->lb_n_buckets > 1)
        break;
 
-      dpo_copy (&dpo, load_balance_get_bucket_i (lb, 0));
+      choice = load_balance_get_bucket_i (lb, 0);
+
+      if (DPO_RECEIVE == choice->dpoi_type)
+       dpo_copy (&dpo, drop_dpo_get (choice->dpoi_proto));
+      else
+       dpo_copy (&dpo, choice);
     }
 
   u32 encap_index = is_ip4 ?
@@ -861,10 +871,10 @@ show_vxlan_tunnel_command_fn (vlib_main_t * vm,
     vlib_cli_output (vm, "No vxlan tunnels configured...");
 
 /* *INDENT-OFF* */
-  pool_foreach (t, vxm->tunnels,
-  ({
+  pool_foreach (t, vxm->tunnels)
+   {
     vlib_cli_output (vm, "%U", format_vxlan_tunnel, t);
-  }));
+  }
 /* *INDENT-ON* */
 
   if (raw)
@@ -1114,9 +1124,13 @@ vnet_vxlan_add_del_rx_flow (u32 hw_if_index, u32 t_index, int is_add)
            .buffer_advance = sizeof (ethernet_header_t),
            .type = VNET_FLOW_TYPE_IP4_VXLAN,
            .ip4_vxlan = {
-                         .src_addr = t->dst.ip4,
-                         .dst_addr = t->src.ip4,
-                         .dst_port = UDP_DST_PORT_vxlan,
+                         .protocol.prot = IP_PROTOCOL_UDP,
+                         .src_addr.addr = t->dst.ip4,
+                         .dst_addr.addr = t->src.ip4,
+                         .src_addr.mask.as_u32 = ~0,
+                         .dst_addr.mask.as_u32 = ~0,
+                         .dst_port.port = UDP_DST_PORT_vxlan,
+                         .dst_port.mask = 0xFF,
                          .vni = t->vni,
                          }
            ,