if (vl_config->auth_key) {
memset(IF_DEF_PARAMS(ifp)->auth_simple, 0,
OSPF_AUTH_SIMPLE_SIZE + 1);
- strncpy((char *)IF_DEF_PARAMS(ifp)->auth_simple,
- vl_config->auth_key, OSPF_AUTH_SIMPLE_SIZE);
+ strlcpy((char *)IF_DEF_PARAMS(ifp)->auth_simple,
+ vl_config->auth_key,
+ sizeof(IF_DEF_PARAMS(ifp)->auth_simple));
} else if (vl_config->md5_key) {
if (ospf_crypt_key_lookup(IF_DEF_PARAMS(ifp)->auth_crypt,
vl_config->crypto_key_id)
ck = ospf_crypt_key_new();
ck->key_id = vl_config->crypto_key_id;
memset(ck->auth_key, 0, OSPF_AUTH_MD5_SIZE + 1);
- strncpy((char *)ck->auth_key, vl_config->md5_key,
- OSPF_AUTH_MD5_SIZE);
+ strlcpy((char *)ck->auth_key, vl_config->md5_key,
+ sizeof(ck->auth_key));
ospf_crypt_key_add(IF_DEF_PARAMS(ifp)->auth_crypt, ck);
} else if (vl_config->crypto_key_id != 0) {
if (vl_config.crypto_key_id < 0)
return CMD_WARNING_CONFIG_FAILED;
- memset(md5_key, 0, OSPF_AUTH_MD5_SIZE + 1);
- strncpy(md5_key, argv[idx + 3]->arg, OSPF_AUTH_MD5_SIZE);
+ strlcpy(md5_key, argv[idx + 3]->arg, sizeof(md5_key));
vl_config.md5_key = md5_key;
}
if (argv_find(argv, argc, "authentication-key", &idx)) {
- memset(auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
- strncpy(auth_key, argv[idx + 1]->arg, OSPF_AUTH_SIMPLE_SIZE);
+ strlcpy(auth_key, argv[idx + 1]->arg, sizeof(auth_key));
vl_config.auth_key = auth_key;
}
return CMD_WARNING_CONFIG_FAILED;
}
+ vl_data = ospf_vl_lookup(ospf, area, vl_config.vl_peer);
+ if (!vl_data) {
+ vty_out(vty, "Virtual link does not exist\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
if (argc <= 5) {
/* Basic VLink no command */
/* Thats all folks! - BUGS B. strikes again!!!*/
- if ((vl_data = ospf_vl_lookup(ospf, area, vl_config.vl_peer)))
- ospf_vl_delete(ospf, vl_data);
-
+ ospf_vl_delete(ospf, vl_data);
ospf_area_check_free(ospf, vl_config.area_id);
-
return CMD_SUCCESS;
}
if (ospf->stub_router_startup_time
!= OSPF_STUB_ROUTER_UNCONFIGURED)
json_object_int_add(
- json_vrf, "postStartEnabledMsecs",
- ospf->stub_router_startup_time / 1000);
+ json_vrf, "postStartEnabledSecs",
+ ospf->stub_router_startup_time);
if (ospf->stub_router_shutdown_time
!= OSPF_STUB_ROUTER_UNCONFIGURED)
json_object_int_add(
- json_vrf, "preShutdownEnabledMsecs",
- ospf->stub_router_shutdown_time / 1000);
+ json_vrf, "preShutdownEnabledSecs",
+ ospf->stub_router_shutdown_time);
} else {
vty_out(vty,
" Stub router advertisement is configured\n");
bool uj = use_json(argc, argv);
struct listnode *node = NULL;
char *vrf_name = NULL;
- bool all_vrf = FALSE;
+ bool all_vrf = false;
int ret = CMD_SUCCESS;
int inst = 0;
int idx_vrf = 0;
/* vrf input is provided could be all or specific vrf*/
if (vrf_name) {
- bool ospf_output = FALSE;
+ bool ospf_output = false;
use_vrf = 1;
for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) {
if (!ospf->oi_running)
continue;
- ospf_output = TRUE;
+ ospf_output = true;
ret = show_ip_ospf_common(vty, ospf, json,
use_vrf);
}
json_object_int_add(json_interface_sub, "cost",
oi->output_cost);
json_object_int_add(
- json_interface_sub, "transmitDelayMsecs",
- 1000 / OSPF_IF_PARAM(oi, transmit_delay));
+ json_interface_sub, "transmitDelaySecs",
+ OSPF_IF_PARAM(oi, transmit_delay));
json_object_string_add(json_interface_sub, "state",
lookup_msg(ospf_ism_state_msg,
oi->state, NULL));
if (OSPF_IF_PARAM(oi, fast_hello) == 0)
json_object_int_add(
json_interface_sub, "timerMsecs",
- 1000 / OSPF_IF_PARAM(oi, v_hello));
+ OSPF_IF_PARAM(oi, v_hello) * 1000);
else
json_object_int_add(
json_interface_sub, "timerMsecs",
1000 / OSPF_IF_PARAM(oi, fast_hello));
json_object_int_add(json_interface_sub,
- "timerDeadMsecs",
- 1000 / OSPF_IF_PARAM(oi, v_wait));
+ "timerDeadSecs",
+ OSPF_IF_PARAM(oi, v_wait));
json_object_int_add(json_interface_sub,
- "timerWaitMsecs",
- 1000 / OSPF_IF_PARAM(oi, v_wait));
+ "timerWaitSecs",
+ OSPF_IF_PARAM(oi, v_wait));
json_object_int_add(
- json_interface_sub, "timerRetransmit",
- 1000 / OSPF_IF_PARAM(oi, retransmit_interval));
+ json_interface_sub, "timerRetransmitSecs",
+ OSPF_IF_PARAM(oi, retransmit_interval));
} else {
vty_out(vty, " Timer intervals configured,");
vty_out(vty, " Hello ");
bool uj = use_json(argc, argv);
struct listnode *node = NULL;
char *vrf_name = NULL, *intf_name = NULL;
- bool all_vrf = FALSE;
+ bool all_vrf = false;
int ret = CMD_SUCCESS;
int inst = 0;
int idx_vrf = 0, idx_intf = 0;
struct ospf *ospf = NULL;
struct listnode *node = NULL;
char *vrf_name = NULL, *intf_name = NULL;
- bool all_vrf = FALSE;
+ bool all_vrf = false;
int inst = 0;
int idx_vrf = 0, idx_intf = 0;
bool uj = use_json(argc, argv);
bool uj = use_json(argc, argv);
struct listnode *node = NULL;
char *vrf_name = NULL;
- bool all_vrf = FALSE;
+ bool all_vrf = false;
int ret = CMD_SUCCESS;
int inst = 0;
int idx_vrf = 0;
bool uj = use_json(argc, argv);
struct listnode *node = NULL;
char *vrf_name = NULL;
- bool all_vrf = FALSE;
+ bool all_vrf = false;
int ret = CMD_SUCCESS;
int inst = 0;
int idx_vrf = 0;
bool uj = use_json(argc, argv);
struct listnode *node = NULL;
char *vrf_name = NULL;
- bool all_vrf = FALSE;
+ bool all_vrf = false;
int ret = CMD_SUCCESS;
int inst = 0;
int idx_vrf = 0;
bool uj = use_json(argc, argv);
struct listnode *node = NULL;
char *vrf_name = NULL;
- bool all_vrf = FALSE;
+ bool all_vrf = false;
int ret = CMD_SUCCESS;
int inst = 0;
int idx_vrf = 0;
bool uj = use_json(argc, argv);
struct listnode *node = NULL;
int ret = CMD_SUCCESS;
- bool ospf_output = FALSE;
+ bool ospf_output = false;
for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) {
if (!ospf->oi_running)
continue;
- ospf_output = TRUE;
+ ospf_output = true;
ret = show_ip_ospf_neighbor_int_detail_common(vty, ospf, 0,
argv, uj);
}
struct ospf *ospf = NULL;
struct listnode *node = NULL;
char *vrf_name = NULL;
- bool all_vrf = FALSE;
+ bool all_vrf = false;
int ret = CMD_SUCCESS;
int inst = 0;
int idx_vrf = 0;
OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
if (vrf_name) {
- bool ospf_output = FALSE;
+ bool ospf_output = false;
use_vrf = 1;
for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) {
if (!ospf->oi_running)
continue;
- ospf_output = TRUE;
+ ospf_output = true;
ret = show_ip_ospf_database_common(
vty, ospf, idx_vrf ? 2 : 0, argc, argv,
use_vrf);
unsigned short instance = 0;
struct listnode *node = NULL;
char *vrf_name = NULL;
- bool all_vrf = FALSE;
+ bool all_vrf = false;
int ret = CMD_SUCCESS;
int inst = 0;
int idx = 0;
unsigned short instance = 0;
struct listnode *node = NULL;
char *vrf_name = NULL;
- bool all_vrf = FALSE;
+ bool all_vrf = false;
int ret = CMD_SUCCESS;
int inst = 0;
int idx = 0, idx_vrf = 0;
OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
if (vrf_name) {
- bool ospf_output = FALSE;
+ bool ospf_output = false;
use_vrf = 1;
for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) {
if (!ospf->oi_running)
continue;
- ospf_output = TRUE;
+ ospf_output = true;
ret = show_ip_ospf_database_type_adv_router_common(
vty, ospf, idx ? 1 : 0, argc, argv,
use_vrf);
ospf_if_update_params(ifp, addr);
}
- memset(params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
- strncpy((char *)params->auth_simple, argv[3]->arg,
- OSPF_AUTH_SIMPLE_SIZE);
+ strlcpy((char *)params->auth_simple, argv[3]->arg,
+ sizeof(params->auth_simple));
SET_IF_PARAM(params, auth_simple);
return CMD_SUCCESS;
ck = ospf_crypt_key_new();
ck->key_id = (uint8_t)key_id;
- memset(ck->auth_key, 0, OSPF_AUTH_MD5_SIZE + 1);
- strncpy((char *)ck->auth_key, cryptkey, OSPF_AUTH_MD5_SIZE);
+ strlcpy((char *)ck->auth_key, cryptkey, sizeof(ck->auth_key));
ospf_crypt_key_add(params->auth_crypt, ck);
SET_IF_PARAM(params, auth_crypt);
struct ospf *ospf = NULL;
struct listnode *node = NULL;
char *vrf_name = NULL;
- bool all_vrf = FALSE;
+ bool all_vrf = false;
int ret = CMD_SUCCESS;
int inst = 0;
int idx_vrf = 0;
OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
if (vrf_name) {
- bool ospf_output = FALSE;
+ bool ospf_output = false;
use_vrf = 1;
if (!ospf->oi_running)
continue;
- ospf_output = TRUE;
+ ospf_output = true;
ret = show_ip_ospf_border_routers_common(
vty, ospf, use_vrf);
}
struct ospf *ospf = NULL;
struct listnode *node = NULL;
char *vrf_name = NULL;
- bool all_vrf = FALSE;
+ bool all_vrf = false;
int ret = CMD_SUCCESS;
int inst = 0;
int idx_vrf = 0;
/* vrf input is provided could be all or specific vrf*/
if (vrf_name) {
- bool ospf_output = FALSE;
+ bool ospf_output = false;
use_vrf = 1;
for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) {
if (!ospf->oi_running)
continue;
- ospf_output = TRUE;
+ ospf_output = true;
ret = show_ip_ospf_route_common(vty, ospf, json,
use_vrf);
}
vty_out(vty, " ip ospf network %s",
ospf_int_type_str
[params->type]);
- if (params != IF_DEF_PARAMS(ifp))
+ if (params != IF_DEF_PARAMS(ifp) && rn)
vty_out(vty, " %s",
inet_ntoa(
rn->p.u.prefix4));
vty_out(vty, " ip ospf authentication%s",
auth_str);
- if (params != IF_DEF_PARAMS(ifp))
+ if (params != IF_DEF_PARAMS(ifp) && rn)
vty_out(vty, " %s",
inet_ntoa(rn->p.u.prefix4));
vty_out(vty, "\n");
&& params->auth_simple[0] != '\0') {
vty_out(vty, " ip ospf authentication-key %s",
params->auth_simple);
- if (params != IF_DEF_PARAMS(ifp))
+ if (params != IF_DEF_PARAMS(ifp) && rn)
vty_out(vty, " %s",
inet_ntoa(rn->p.u.prefix4));
vty_out(vty, "\n");
vty_out(vty,
" ip ospf message-digest-key %d md5 %s",
ck->key_id, ck->auth_key);
- if (params != IF_DEF_PARAMS(ifp))
+ if (params != IF_DEF_PARAMS(ifp) && rn)
vty_out(vty, " %s",
inet_ntoa(
rn->p.u.prefix4));
if (OSPF_IF_PARAM_CONFIGURED(params, output_cost_cmd)) {
vty_out(vty, " ip ospf cost %u",
params->output_cost_cmd);
- if (params != IF_DEF_PARAMS(ifp))
+ if (params != IF_DEF_PARAMS(ifp) && rn)
vty_out(vty, " %s",
inet_ntoa(rn->p.u.prefix4));
vty_out(vty, "\n");
&& params->v_hello != OSPF_HELLO_INTERVAL_DEFAULT) {
vty_out(vty, " ip ospf hello-interval %u",
params->v_hello);
- if (params != IF_DEF_PARAMS(ifp))
+ if (params != IF_DEF_PARAMS(ifp) && rn)
vty_out(vty, " %s",
inet_ntoa(rn->p.u.prefix4));
vty_out(vty, "\n");
else
vty_out(vty, "%u", params->v_wait);
- if (params != IF_DEF_PARAMS(ifp))
+ if (params != IF_DEF_PARAMS(ifp) && rn)
vty_out(vty, " %s",
inet_ntoa(rn->p.u.prefix4));
vty_out(vty, "\n");
!= OSPF_ROUTER_PRIORITY_DEFAULT) {
vty_out(vty, " ip ospf priority %u",
params->priority);
- if (params != IF_DEF_PARAMS(ifp))
+ if (params != IF_DEF_PARAMS(ifp) && rn)
vty_out(vty, " %s",
inet_ntoa(rn->p.u.prefix4));
vty_out(vty, "\n");
!= OSPF_RETRANSMIT_INTERVAL_DEFAULT) {
vty_out(vty, " ip ospf retransmit-interval %u",
params->retransmit_interval);
- if (params != IF_DEF_PARAMS(ifp))
+ if (params != IF_DEF_PARAMS(ifp) && rn)
vty_out(vty, " %s",
inet_ntoa(rn->p.u.prefix4));
vty_out(vty, "\n");
!= OSPF_TRANSMIT_DELAY_DEFAULT) {
vty_out(vty, " ip ospf transmit-delay %u",
params->transmit_delay);
- if (params != IF_DEF_PARAMS(ifp))
+ if (params != IF_DEF_PARAMS(ifp) && rn)
vty_out(vty, " %s",
inet_ntoa(rn->p.u.prefix4));
vty_out(vty, "\n");
area_id2str(buf, sizeof(buf), ¶ms->if_area,
params->if_area_id_fmt);
vty_out(vty, " area %s", buf);
- if (params != IF_DEF_PARAMS(ifp))
+ if (params != IF_DEF_PARAMS(ifp) && rn)
vty_out(vty, " %s",
inet_ntoa(rn->p.u.prefix4));
vty_out(vty, "\n");
vty_out(vty, " no ip ospf mtu-ignore");
else
vty_out(vty, " ip ospf mtu-ignore");
- if (params != IF_DEF_PARAMS(ifp))
+ if (params != IF_DEF_PARAMS(ifp) && rn)
vty_out(vty, " %s",
inet_ntoa(rn->p.u.prefix4));
vty_out(vty, "\n");