From: Lou Berger Date: Wed, 29 Aug 2018 13:20:24 +0000 (-0400) Subject: rfapi: debug related changes to support topotest -- add cost X-Git-Tag: frr-7.1-dev~399^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=3a022a7f18abd3003c1dbb4782e52d716d18eae9;p=matthieu%2Ffrr.git rfapi: debug related changes to support topotest -- add cost Signed-off-by: Lou Berger --- diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index 4cc08d5b43..84a5b9c70f 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -2928,6 +2928,8 @@ static void test_nexthops_callback( rfapiPrintNhl(stream, next_hops); + fp(out, "\n"); + rfapi_free_next_hop_list(next_hops); } @@ -3049,7 +3051,7 @@ DEFUN (debug_rfapi_close_rfd, DEFUN (debug_rfapi_register_vn_un, debug_rfapi_register_vn_un_cmd, - "debug rfapi-dev register vn un prefix lifetime SECONDS", + "debug rfapi-dev register vn un prefix lifetime SECONDS [cost (0-255)]", DEBUG_STR DEBUG_RFAPI_STR "rfapi_register\n" @@ -3063,7 +3065,9 @@ DEFUN (debug_rfapi_register_vn_un, "IPv4 prefix\n" "IPv6 prefix\n" "indicate lifetime follows\n" - "lifetime\n") + "lifetime\n" + "Cost (localpref = 255-cost)\n" + "0-255\n") { struct rfapi_ip_addr vn; struct rfapi_ip_addr un; @@ -3072,6 +3076,7 @@ DEFUN (debug_rfapi_register_vn_un, uint32_t lifetime; struct rfapi_ip_prefix hpfx; int rc; + uint8_t cost = 100; /* * Get VN addr @@ -3112,6 +3117,9 @@ DEFUN (debug_rfapi_register_vn_un, lifetime = strtoul(argv[10]->arg, NULL, 10); } + if (argc >= 13) + cost = (uint8_t) strtoul(argv[12]->arg, NULL, 10); + hpfx.cost = cost; rc = rfapi_register(handle, &hpfx, lifetime, NULL, NULL, RFAPI_REGISTER_ADD);