summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/rfapi/rfapi.c27
-rw-r--r--bgpd/rfp-example/librfp/rfp_example.c60
2 files changed, 79 insertions, 8 deletions
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index a0e9ffbbd..a427608f6 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 <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> prefix <A.B.C.D/M|X:X::X:X/M> lifetime SECONDS",
+ "debug rfapi-dev register vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> prefix <A.B.C.D/M|X:X::X:X/M> 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,8 +3117,12 @@ 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, 0);
+ rc = rfapi_register(handle, &hpfx, lifetime, NULL, NULL,
+ RFAPI_REGISTER_ADD);
if (rc) {
vty_out(vty, "rfapi_register failed with rc=%d (%s)\n", rc,
strerror(rc));
@@ -3213,7 +3222,8 @@ DEFUN (debug_rfapi_register_vn_un_l2o,
/* L2 option parsing END */
/* TBD fixme */
- rc = rfapi_register(handle, &hpfx, lifetime, NULL /* &uo */, opt, 0);
+ rc = rfapi_register(handle, &hpfx, lifetime, NULL /* &uo */, opt,
+ RFAPI_REGISTER_ADD);
if (rc) {
vty_out(vty, "rfapi_register failed with rc=%d (%s)\n", rc,
strerror(rc));
@@ -3225,7 +3235,7 @@ DEFUN (debug_rfapi_register_vn_un_l2o,
DEFUN (debug_rfapi_unregister_vn_un,
debug_rfapi_unregister_vn_un_cmd,
- "debug rfapi-dev unregister vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> prefix <A.B.C.D/M|X:X::X:X/M>",
+ "debug rfapi-dev unregister vn <A.B.C.D|X:X::X:X> un <A.B.C.D|X:X::X:X> prefix <A.B.C.D/M|X:X::X:X/M> [kill]",
DEBUG_STR
DEBUG_RFAPI_STR
"rfapi_register\n"
@@ -3233,7 +3243,8 @@ DEFUN (debug_rfapi_unregister_vn_un,
"virtual network interface address\n"
"indicate xt addr follows\n"
"underlay network interface address\n"
- "indicate prefix follows\n" "prefix")
+ "prefix to remove\n"
+ "Remove without holddown")
{
struct rfapi_ip_addr vn;
struct rfapi_ip_addr un;
@@ -3275,7 +3286,9 @@ DEFUN (debug_rfapi_unregister_vn_un,
}
rfapiQprefix2Rprefix(&pfx, &hpfx);
- rfapi_register(handle, &hpfx, 0, NULL, NULL, 1);
+ rfapi_register(handle, &hpfx, 0, NULL, NULL,
+ (argc == 10 ?
+ RFAPI_REGISTER_KILL : RFAPI_REGISTER_WITHDRAW));
return CMD_SUCCESS;
}
diff --git a/bgpd/rfp-example/librfp/rfp_example.c b/bgpd/rfp-example/librfp/rfp_example.c
index 2751e7a44..75e57a029 100644
--- a/bgpd/rfp-example/librfp/rfp_example.c
+++ b/bgpd/rfp-example/librfp/rfp_example.c
@@ -55,6 +55,54 @@ DEFUN (rfp_example_config_value,
return CMD_SUCCESS;
}
+DEFUN (rfp_holddown_factor,
+ rfp_holddown_factor_cmd,
+ "rfp holddown-factor (0-4294967295)",
+ RFP_SHOW_STR
+ "Set Hold-Down Factor as a percentage of registration lifetime.\n"
+ "Percentage of registration lifetime\n")
+{
+ struct rfp_instance_t *rfi;
+ uint32_t value = 0;
+
+ value = strtoul((argv[--argc]->arg), NULL, 10);
+ rfi = rfapi_get_rfp_start_val(VTY_GET_CONTEXT(bgp)); /* BGP_NODE */
+ if (!rfi) {
+ vty_out(vty, "VNC not configured\n");
+ return CMD_WARNING;
+ }
+ rfi->rfapi_config.holddown_factor = value;
+ rfapi_rfp_set_configuration(rfi, &rfi->rfapi_config);
+ return CMD_SUCCESS;
+}
+
+
+DEFUN (rfp_full_table_download,
+ rfp_full_table_download_cmd,
+ "rfp full-table-download <on|off>",
+ RFP_SHOW_STR
+ "RFP full table download support (default=on)\n"
+ "Enable RFP full table download\n"
+ "Disable RFP full table download\n")
+{
+ struct rfp_instance_t *rfi;
+ rfapi_rfp_download_type old;
+
+ rfi = rfapi_get_rfp_start_val(VTY_GET_CONTEXT(bgp)); /* BGP_NODE */
+ if (!rfi) {
+ vty_out(vty, "VNC not configured\n");
+ return CMD_WARNING;
+ }
+ old = rfi->rfapi_config.download_type;
+ if (argv[--argc]->arg[1] == 'n' || argv[argc]->arg[1] == 'N')
+ rfi->rfapi_config.download_type = RFAPI_RFP_DOWNLOAD_FULL;
+ else
+ rfi->rfapi_config.download_type = RFAPI_RFP_DOWNLOAD_PARTIAL;
+ if (old != rfi->rfapi_config.download_type)
+ rfapi_rfp_set_configuration(rfi, &rfi->rfapi_config);
+ return CMD_SUCCESS;
+}
+
static void rfp_vty_install()
{
static int installed = 0;
@@ -63,6 +111,8 @@ static void rfp_vty_install()
installed = 1;
/* example of new cli command */
install_element(BGP_NODE, &rfp_example_config_value_cmd);
+ install_element(BGP_NODE, &rfp_holddown_factor_cmd);
+ install_element(BGP_NODE, &rfp_full_table_download_cmd);
}
/***********************************************************************
@@ -196,7 +246,15 @@ static int rfp_cfg_write_cb(struct vty *vty, void *rfp_start_val)
vty_out(vty, "\n");
write++;
}
-
+ if (rfi->rfapi_config.holddown_factor != 0) {
+ vty_out(vty, " rfp holddown-factor %u\n",
+ rfi->rfapi_config.holddown_factor);
+ write++;
+ }
+ if (rfi->rfapi_config.download_type != RFAPI_RFP_DOWNLOAD_FULL) {
+ vty_out(vty, " rfp full-table-download off\n");
+ write++;
+ }
return write;
}