VPP-45 Fix crash when GRE packet received on new i/f 21/1021/2
authorChris Luke <chrisy@flirble.org>
Fri, 6 May 2016 15:51:54 +0000 (11:51 -0400)
committerDave Barach <openvpp@barachs.net>
Sat, 7 May 2016 13:01:23 +0000 (13:01 +0000)
If a GRE tunnel is created, no other interface added and the GRE tunnel
is not set "up" then a crash occurs on the first packet for this tunnel
because fib_index_by_sw_if_index[] does not yet have a mapping to the fib
the new interface is in. The code to set this is missing from
gre/interface.c

Change-Id: I567ad74a2af3ea5afe4a40ed39a1d4395642f77c
Signed-off-by: Chris Luke <chrisy@flirble.org>
vnet/vnet/gre/interface.c

index c1b9ddd..1e442bc 100644 (file)
@@ -102,6 +102,9 @@ int vnet_gre_add_del_tunnel
     vec_validate_init_empty (gm->tunnel_index_by_sw_if_index, sw_if_index, ~0);
     gm->tunnel_index_by_sw_if_index[sw_if_index] = t - gm->tunnels;
 
+    vec_validate (im->fib_index_by_sw_if_index, sw_if_index);
+    im->fib_index_by_sw_if_index[sw_if_index] = t->outer_fib_index;
+
     hi->min_packet_bytes = 64 + sizeof (gre_header_t) + sizeof (ip4_header_t);
     hi->per_packet_overhead_bytes =
       /* preamble */ 8 + /* inter frame gap */ 12;