summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-08-10 11:34:12 -0700
committerFlorin Coras <florin.coras@gmail.com>2017-08-11 02:55:13 +0000
commite8bad978a107bf312e194ba488603f074351e29e (patch)
tree1c30ac18418d92be9bad4ebab3651c51aed55c2a /src
parent543852a46ce107243ed92254bd88b87ca82bbd0b (diff)
the automatic addition of IP address to the magic TAP interface should only happen for one table
Change-Id: I99d3e9227c33ee42b90e4842080960fcc6c03913 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/unix/tuntap.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/vnet/unix/tuntap.c b/src/vnet/unix/tuntap.c
index ac674653df4..2c403679349 100644
--- a/src/vnet/unix/tuntap.c
+++ b/src/vnet/unix/tuntap.c
@@ -45,6 +45,7 @@
#include <vlib/unix/unix.h>
#include <vnet/ip/ip.h>
+#include <vnet/fib/fib_table.h>
#include <vnet/ethernet/ethernet.h>
#include <vnet/devices/devices.h>
@@ -692,6 +693,16 @@ tuntap_ip4_add_del_interface_address (ip4_main_t * im,
if (tm->have_normal_interface || tm->dev_tap_fd < 0)
return;
+ /* if the address is being applied to an interface that is not in
+ * the same table/VRF as this tap, then ignore it.
+ * If we don't do this overlapping address spaces in the diferent tables
+ * breaks the linux host's routing tables */
+ if (fib_table_get_index_for_sw_if_index(FIB_PROTOCOL_IP4,
+ sw_if_index) !=
+ fib_table_get_index_for_sw_if_index(FIB_PROTOCOL_IP4,
+ tm->sw_if_index))
+ return;
+
/** See if we already know about this subif */
memset (&subif_addr, 0, sizeof (subif_addr));
subif_addr.sw_if_index = sw_if_index;
@@ -799,6 +810,16 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im,
if (tm->have_normal_interface || tm->dev_tap_fd < 0)
return;
+ /* if the address is being applied to an interface that is not in
+ * the same table/VRF as this tap, then ignore it.
+ * If we don't do this overlapping address spaces in the diferent tables
+ * breaks the linux host's routing tables */
+ if (fib_table_get_index_for_sw_if_index(FIB_PROTOCOL_IP6,
+ sw_if_index) !=
+ fib_table_get_index_for_sw_if_index(FIB_PROTOCOL_IP6,
+ tm->sw_if_index))
+ return;
+
/* See if we already know about this subif */
memset (&subif_addr, 0, sizeof (subif_addr));
subif_addr.sw_if_index = sw_if_index;