X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Ffib%2Ffib_types.c;h=38f7926e3501bfdd740f5973028b526085f6632c;hb=30e7671c85087b5781a34bde45ef3846f5de8c17;hp=256064384913170e16a9c92d087c4c8923877f45;hpb=2646c80db8d3d1a3cd7555328d5a0038798f861e;p=vpp.git diff --git a/src/vnet/fib/fib_types.c b/src/vnet/fib/fib_types.c index 25606438491..38f7926e350 100644 --- a/src/vnet/fib/fib_types.c +++ b/src/vnet/fib/fib_types.c @@ -18,6 +18,7 @@ #include #include #include +#include #include /* @@ -101,6 +102,13 @@ fib_prefix_from_mpls_label (mpls_label_t label, pfx->fp_eos = eos; } +void +fib_prefix_copy (fib_prefix_t *dst, + const fib_prefix_t *src) +{ + clib_memcpy(dst, src, sizeof(*dst)); +} + int fib_prefix_cmp (const fib_prefix_t *p1, const fib_prefix_t *p2) @@ -158,6 +166,21 @@ fib_prefix_is_cover (const fib_prefix_t *p1, return (0); } +u8 +fib_prefix_get_host_length (fib_protocol_t proto) +{ + switch (proto) + { + case FIB_PROTOCOL_IP4: + return (32); + case FIB_PROTOCOL_IP6: + return (128); + case FIB_PROTOCOL_MPLS: + return (21); + } + return (0); +} + int fib_prefix_is_host (const fib_prefix_t *prefix) { @@ -434,13 +457,13 @@ uword unformat_fib_route_path (unformat_input_t * input, va_list * args) { fib_route_path_t *rpath = va_arg (*args, fib_route_path_t *); - u32 *payload_proto = va_arg (*args, u32*); + dpo_proto_t *payload_proto = va_arg (*args, void*); u32 weight, preference, udp_encap_id, fi; mpls_label_t out_label; vnet_main_t *vnm; vnm = vnet_get_main (); - memset(rpath, 0, sizeof(*rpath)); + clib_memset(rpath, 0, sizeof(*rpath)); rpath->frp_weight = 1; rpath->frp_sw_if_index = ~0; @@ -537,6 +560,10 @@ unformat_fib_route_path (unformat_input_t * input, va_list * args) { rpath->frp_flags |= FIB_ROUTE_PATH_RESOLVE_VIA_ATTACHED; } + else if (unformat (input, "pop-pw-cw")) + { + rpath->frp_flags |= FIB_ROUTE_PATH_POP_PW_CW; + } else if (unformat (input, "ip4-lookup-in-table %d", &rpath->frp_fib_index)) @@ -598,7 +625,17 @@ unformat_fib_route_path (unformat_input_t * input, va_list * args) rpath->frp_proto = DPO_PROTO_IP4; rpath->frp_flags = FIB_ROUTE_PATH_INTF_RX; } - else if (unformat (input, "out-labels")) + else if (unformat (input, "local")) + { + clib_memset (&rpath->frp_addr, 0, sizeof (rpath->frp_addr)); + rpath->frp_sw_if_index = ~0; + rpath->frp_weight = 1; + rpath->frp_flags |= FIB_ROUTE_PATH_LOCAL; + } + else if (unformat (input, "%U", + unformat_mfib_itf_flags, &rpath->frp_mitf_flags)) + ; + else if (unformat (input, "out-labels")) { while (unformat (input, "%U", unformat_mpls_unicast_label, &out_label)) @@ -615,6 +652,15 @@ unformat_fib_route_path (unformat_input_t * input, va_list * args) { rpath->frp_proto = *payload_proto; } + else if (unformat (input, "via")) + { + /* new path, back up and return */ + unformat_put_input (input); + unformat_put_input (input); + unformat_put_input (input); + unformat_put_input (input); + break; + } else { return (0);