summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/lookup.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-07-15 07:37:25 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2017-07-18 20:46:29 +0000
commit57b5860f013953ce161d05302e05370db9cd6ee2 (patch)
tree2d4cdbbc631848be4c43c599698019b2121e000b /src/vnet/ip/lookup.c
parent51822bf07a3f0fe72834ea94659faf6e262475ba (diff)
FIB path preference
Paths are given a preference, lowest value is 'best'. Only paths that are up are up contribute to fprwarding - that's unchanged. What's new is that of the path's that re up only those that have the best preference contribute. A poor man's primary and backup. It's not true primary/backup function because the FIB must converge before the lower preference paths are used. Change-Id: Ie4453c4a7b1094c6c2b51fe1594b8302103bb68e Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/ip/lookup.c')
-rwxr-xr-xsrc/vnet/ip/lookup.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/src/vnet/ip/lookup.c b/src/vnet/ip/lookup.c
index 6547cad51b1..533d010a738 100755
--- a/src/vnet/ip/lookup.c
+++ b/src/vnet/ip/lookup.c
@@ -360,6 +360,7 @@ vnet_ip_route_cmd (vlib_main_t * vm,
fib_prefix_t *prefixs = NULL, pfx;
mpls_label_t out_label, via_label;
clib_error_t *error = NULL;
+ u32 weight, preference;
u32 table_id, is_del;
vnet_main_t *vnm;
u32 fib_index;
@@ -441,26 +442,6 @@ vnet_ip_route_cmd (vlib_main_t * vm,
pfx.fp_proto = FIB_PROTOCOL_IP6;
vec_add1 (prefixs, pfx);
}
- else if (unformat (line_input, "via %U %U weight %u",
- unformat_ip4_address,
- &rpath.frp_addr.ip4,
- unformat_vnet_sw_interface, vnm,
- &rpath.frp_sw_if_index, &rpath.frp_weight))
- {
- rpath.frp_proto = FIB_PROTOCOL_IP4;
- vec_add1 (rpaths, rpath);
- }
-
- else if (unformat (line_input, "via %U %U weight %u",
- unformat_ip6_address,
- &rpath.frp_addr.ip6,
- unformat_vnet_sw_interface, vnm,
- &rpath.frp_sw_if_index, &rpath.frp_weight))
- {
- rpath.frp_proto = FIB_PROTOCOL_IP6;
- vec_add1 (rpaths, rpath);
- }
-
else if (unformat (line_input, "via %U %U",
unformat_ip4_address,
&rpath.frp_addr.ip4,
@@ -482,6 +463,16 @@ vnet_ip_route_cmd (vlib_main_t * vm,
rpath.frp_proto = FIB_PROTOCOL_IP6;
vec_add1 (rpaths, rpath);
}
+ else if (unformat (line_input, "weight %u", &weight))
+ {
+ ASSERT (vec_len (rpaths));
+ rpaths[vec_len (rpaths) - 1].frp_weight = weight;
+ }
+ else if (unformat (line_input, "preference %u", &preference))
+ {
+ ASSERT (vec_len (rpaths));
+ rpaths[vec_len (rpaths) - 1].frp_preference = preference;
+ }
else if (unformat (line_input, "via %U next-hop-table %d",
unformat_ip4_address,
&rpath.frp_addr.ip4, &rpath.frp_fib_index))