summaryrefslogtreecommitdiffstats
path: root/src/plugins/gbp/gbp_learn_node.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-03-04 14:08:11 -0800
committerNeale Ranns <nranns@cisco.com>2019-03-06 10:31:38 +0000
commit8da9fc659badc016e409f772673002f021c0cc4a (patch)
tree0223180b7344b652ab8c45bb38f47f335bbed7c5 /src/plugins/gbp/gbp_learn_node.c
parentdc8d93b02949f508d5eed312a51aa91102224b39 (diff)
GBP: learn from ARP and L2 packets
Change-Id: I8af7bca566ec7c9bd2b72529d49e04c6e649b44a Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/plugins/gbp/gbp_learn_node.c')
-rw-r--r--src/plugins/gbp/gbp_learn_node.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/plugins/gbp/gbp_learn_node.c b/src/plugins/gbp/gbp_learn_node.c
index ebb121716b2..461d209e0a6 100644
--- a/src/plugins/gbp/gbp_learn_node.c
+++ b/src/plugins/gbp/gbp_learn_node.c
@@ -22,6 +22,7 @@
#include <vnet/l2/l2_input.h>
#include <vnet/fib/fib_table.h>
#include <vnet/vxlan-gbp/vxlan_gbp_packet.h>
+#include <vnet/ethernet/arp_packet.h>
#define GBP_LEARN_DBG(...) \
vlib_log_debug (gbp_learn_main.gl_logger, __VA_ARGS__);
@@ -72,10 +73,8 @@ gbp_learn_l2_cp (const gbp_learn_l2_t * gl2)
format_mac_address_t, &gl2->mac,
format_ip46_address, &gl2->ip, IP46_TYPE_ANY, gl2->epg);
- vec_add1 (ips, gl2->ip);
-
- ASSERT (!ip46_address_is_zero (&gl2->outer_src));
- ASSERT (!ip46_address_is_zero (&gl2->outer_dst));
+ if (!ip46_address_is_zero (&gl2->ip))
+ vec_add1 (ips, gl2->ip);
/*
* flip the source and dst, since that's how it was received, this API
@@ -107,9 +106,6 @@ gbp_learn_l2_ip4_dp (const u8 * mac, const ip4_address_t * ip,
};
mac_address_from_bytes (&gl2.mac, mac);
- ASSERT (!ip46_address_is_zero (&gl2.outer_src));
- ASSERT (!ip46_address_is_zero (&gl2.outer_dst));
-
vl_api_rpc_call_main_thread (gbp_learn_l2_cp, (u8 *) & gl2, sizeof (gl2));
}
@@ -260,6 +256,12 @@ VLIB_NODE_FN (gbp_learn_l2_node) (vlib_main_t * vm,
{
gbp_learn_get_outer (eh0, &outer_src, &outer_dst);
+ if (outer_src.as_u32 == 0 || outer_dst.as_u32 == 0)
+ {
+ t0 = 2;
+ goto trace;
+ }
+
switch (clib_net_to_host_u16 (eh0->type))
{
case ETHERNET_TYPE_IP4:
@@ -290,6 +292,19 @@ VLIB_NODE_FN (gbp_learn_l2_node) (vlib_main_t * vm,
break;
}
+ case ETHERNET_TYPE_ARP:
+ {
+ const ethernet_arp_header_t *arp0;
+
+ arp0 = (ethernet_arp_header_t *) (eh0 + 1);
+
+ gbp_learn_l2_ip4_dp (eh0->src_address,
+ &arp0->ip4_over_ethernet[0].ip4,
+ vnet_buffer (b0)->l2.bd_index,
+ sw_if_index0, epg0,
+ &outer_src, &outer_dst);
+ break;
+ }
default:
gbp_learn_l2_dp (eh0->src_address,
vnet_buffer (b0)->l2.bd_index,