X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fgeneve%2Fgeneve.c;h=501ab7f9845f4cb485209e864689e2cc2a9adb4e;hb=282872127;hp=fe35c6c242937984b6fb7e49dc8d4e6a7aebdcb8;hpb=55333d76c6501e78ed234a81301e844edc1863b2;p=vpp.git diff --git a/src/vnet/geneve/geneve.c b/src/vnet/geneve/geneve.c index fe35c6c2429..501ab7f9845 100644 --- a/src/vnet/geneve/geneve.c +++ b/src/vnet/geneve/geneve.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -311,7 +312,7 @@ vtep_addr_unref (ip46_address_t * ip) uword *vtep = ip46_address_is_ip4 (ip) ? hash_get (geneve_main.vtep4, ip->ip4.as_u32) : hash_get_mem (geneve_main.vtep6, &ip->ip6); - ASSERT (vtep); + ALWAYS_ASSERT (vtep); if (--(*vtep) != 0) return *vtep; ip46_address_is_ip4 (ip) ? @@ -334,7 +335,7 @@ mcast_shared_get (ip46_address_t * ip) { ASSERT (ip46_address_is_multicast (ip)); uword *p = hash_get_mem (geneve_main.mcast_shared, ip); - ASSERT (p); + ALWAYS_ASSERT (p); return (mcast_shared_t) { .as_u64 = *p}; @@ -498,12 +499,11 @@ int vnet_geneve_add_del_tunnel * re-stack accordingly */ vtep_addr_ref (&t->local); - t->fib_entry_index = fib_table_entry_special_add - (t->encap_fib_index, &tun_remote_pfx, FIB_SOURCE_RR, - FIB_ENTRY_FLAG_NONE); - t->sibling_index = fib_entry_child_add - (t->fib_entry_index, FIB_NODE_TYPE_GENEVE_TUNNEL, - t - vxm->tunnels); + t->fib_entry_index = fib_entry_track (t->encap_fib_index, + &tun_remote_pfx, + FIB_NODE_TYPE_GENEVE_TUNNEL, + t - vxm->tunnels, + &t->sibling_index); geneve_tunnel_restack_dpo (t); } else @@ -524,8 +524,9 @@ int vnet_geneve_add_del_tunnel .frp_addr = zero_addr, .frp_sw_if_index = 0xffffffff, .frp_fib_index = ~0, - .frp_weight = 0, + .frp_weight = 1, .frp_flags = FIB_ROUTE_PATH_LOCAL, + .frp_mitf_flags = MFIB_ITF_FLAG_FORWARD, }; const mfib_prefix_t mpfx = { .fp_proto = fp, @@ -539,17 +540,14 @@ int vnet_geneve_add_del_tunnel * - the accepting interface is that from the API */ mfib_table_entry_path_update (t->encap_fib_index, - &mpfx, - MFIB_SOURCE_GENEVE, - &path, MFIB_ITF_FLAG_FORWARD); + &mpfx, MFIB_SOURCE_GENEVE, &path); path.frp_sw_if_index = a->mcast_sw_if_index; path.frp_flags = FIB_ROUTE_PATH_FLAG_NONE; + path.frp_mitf_flags = MFIB_ITF_FLAG_ACCEPT; mfei = mfib_table_entry_path_update (t->encap_fib_index, &mpfx, - MFIB_SOURCE_GENEVE, - &path, - MFIB_ITF_FLAG_ACCEPT); + MFIB_SOURCE_GENEVE, &path); /* * Create the mcast adjacency to send traffic to the group @@ -607,8 +605,7 @@ int vnet_geneve_add_del_tunnel if (!ip46_address_is_multicast (&t->remote)) { vtep_addr_unref (&t->local); - fib_entry_child_remove (t->fib_entry_index, t->sibling_index); - fib_table_entry_delete_index (t->fib_entry_index, FIB_SOURCE_RR); + fib_entry_untrack (t->fib_entry_index, t->sibling_index); } else if (vtep_addr_unref (&t->remote) == 0) { @@ -623,6 +620,17 @@ int vnet_geneve_add_del_tunnel if (sw_if_indexp) *sw_if_indexp = sw_if_index; + if (a->is_add) + { + /* register udp ports */ + if (!is_ip6 && !udp_is_valid_dst_port (UDP_DST_PORT_geneve, 1)) + udp_register_dst_port (vxm->vlib_main, UDP_DST_PORT_geneve, + geneve4_input_node.index, 1); + if (is_ip6 && !udp_is_valid_dst_port (UDP_DST_PORT_geneve6, 0)) + udp_register_dst_port (vxm->vlib_main, UDP_DST_PORT_geneve6, + geneve6_input_node.index, 0); + } + return 0; } @@ -1094,7 +1102,7 @@ set_ip6_geneve_bypass (vlib_main_t * vm, VLIB_CLI_COMMAND (set_interface_ip6_geneve_bypass_command, static) = { .path = "set interface ip6 geneve-bypass", .function = set_ip6_geneve_bypass, - .short_help = "set interface ip geneve-bypass [del]", + .short_help = "set interface ip6 geneve-bypass [del]", }; /* *INDENT-ON* */ @@ -1115,11 +1123,6 @@ geneve_init (vlib_main_t * vm) sizeof (ip46_address_t), sizeof (mcast_shared_t)); - udp_register_dst_port (vm, UDP_DST_PORT_geneve, - geneve4_input_node.index, /* is_ip4 */ 1); - udp_register_dst_port (vm, UDP_DST_PORT_geneve6, - geneve6_input_node.index, /* is_ip4 */ 0); - fib_node_register_type (FIB_NODE_TYPE_GENEVE_TUNNEL, &geneve_vft); return 0;