From 8da9fc659badc016e409f772673002f021c0cc4a Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Mon, 4 Mar 2019 14:08:11 -0800 Subject: GBP: learn from ARP and L2 packets Change-Id: I8af7bca566ec7c9bd2b72529d49e04c6e649b44a Signed-off-by: Neale Ranns --- src/plugins/gbp/gbp_endpoint.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/plugins/gbp/gbp_endpoint.c') diff --git a/src/plugins/gbp/gbp_endpoint.c b/src/plugins/gbp/gbp_endpoint.c index 9cae2ab9421..4bd726fec31 100644 --- a/src/plugins/gbp/gbp_endpoint.c +++ b/src/plugins/gbp/gbp_endpoint.c @@ -32,6 +32,7 @@ #include #include #include +#include static const char *gbp_endpoint_attr_names[] = GBP_ENDPOINT_ATTR_NAMES; @@ -473,6 +474,7 @@ gbp_endpoint_n_learned (int n) static void gbp_endpoint_loc_update (gbp_endpoint_loc_t * gel, + const gbp_bridge_domain_t * gb, u32 sw_if_index, index_t ggi, gbp_endpoint_flags_t flags, @@ -508,6 +510,24 @@ gbp_endpoint_loc_update (gbp_endpoint_loc_t * gel, if (NULL != tun_dst) ip46_address_copy (&gel->tun.gel_dst, tun_dst); + if (ip46_address_is_multicast (&gel->tun.gel_src)) + { + /* + * we learnt the EP from the multicast tunnel. + * Create a unicast TEP from the packet's source + * and the fixed address of the BD's parent tunnel + */ + const gbp_vxlan_tunnel_t *gt; + + gt = gbp_vxlan_tunnel_get (gb->gb_vni); + + if (NULL != gt) + { + ip46_address_copy (&gel->tun.gel_src, >->gt_src); + sw_if_index = gt->gt_sw_if_index; + } + } + /* * the input interface may be the parent GBP-vxlan interface, * create a child vlxan-gbp tunnel and use that as the endpoint's @@ -862,7 +882,8 @@ gbp_endpoint_update_and_lock (gbp_endpoint_src_t src, gei = gbp_endpoint_index (ge); gel = gbp_endpoint_loc_find_or_add (ge, src); - gbp_endpoint_loc_update (gel, sw_if_index, ggi, flags, tun_src, tun_dst); + gbp_endpoint_loc_update (gel, gbd, sw_if_index, ggi, flags, tun_src, + tun_dst); if (src <= best) { -- cgit 1.2.3-korg