ospfd: fix virtual-link config command

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
This commit is contained in:
Chirag Shah 2017-09-26 11:29:33 -07:00
parent 8a38c34b5a
commit 65536c82c3

View File

@ -1016,7 +1016,7 @@ DEFUN (ospf_area_vlink,
} }
/* Deal with other parameters */ /* Deal with other parameters */
for (i = 5; i < argc; i++) { for (i = 4; i < argc; i++) {
/* vty_out (vty, "argv[%d]->arg - %s\n", i, argv[i]->text); */ /* vty_out (vty, "argv[%d]->arg - %s\n", i, argv[i]->text); */
@ -1027,10 +1027,8 @@ DEFUN (ospf_area_vlink,
|| strncmp(argv[i]->arg, "authentication-", 15) || strncmp(argv[i]->arg, "authentication-", 15)
== 0) { == 0) {
/* authentication-key - this option can occur /* authentication-key - this option can occur
anywhere on anywhere on command line. At start
command line. At start of command line must check for
of command line
must check for
authentication option. */ authentication option. */
memset(auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1); memset(auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
strncpy(auth_key, argv[i + 1]->text, strncpy(auth_key, argv[i + 1]->text,
@ -1040,8 +1038,7 @@ DEFUN (ospf_area_vlink,
} else if (strncmp(argv[i]->arg, "authentication", 14) } else if (strncmp(argv[i]->arg, "authentication", 14)
== 0) { == 0) {
/* authentication - this option can only occur /* authentication - this option can only occur
at start at start of command line */
of command line */
vl_config.auth_type = OSPF_AUTH_SIMPLE; vl_config.auth_type = OSPF_AUTH_SIMPLE;
if ((i + 1) < argc) { if ((i + 1) < argc) {
if (strncmp(argv[i + 1]->arg, "n", 1) if (strncmp(argv[i + 1]->arg, "n", 1)
@ -1054,9 +1051,9 @@ DEFUN (ospf_area_vlink,
strncmp(argv[i + 1]->arg, "m", strncmp(argv[i + 1]->arg, "m",
1) 1)
== 0 == 0
&& !strmatch( && strmatch(
argv[i + 1]->text, argv[i + 1]->text,
"message-digest-")) { "message-digest")) {
/* "authentication /* "authentication
* message-digest" */ * message-digest" */
vl_config.auth_type = vl_config.auth_type =
@ -1153,29 +1150,28 @@ DEFUN (no_ospf_area_vlink,
/* If we are down here, we are reseting parameters */ /* If we are down here, we are reseting parameters */
/* Deal with other parameters */ /* Deal with other parameters */
for (i = 6; i < argc; i++) { for (i = 5; i < argc; i++) {
/* vty_out (vty, "argv[%d] - %s\n", i, argv[i]); */ /* vty_out (vty, "argv[%d] - %s\n", i, argv[i]); */
switch (argv[i]->arg[0]) { switch (argv[i]->arg[0]) {
case 'a': case 'a':
if (i > 2 if (i > 6
|| strncmp(argv[i]->text, "authentication-", 15) || strncmp(argv[i]->text, "authentication-", 15)
== 0) { == 0) {
/* authentication-key - this option can occur /* authentication-key - this option can occur
anywhere on anywhere on command line. At start
command line. At start of command line must check for
of command line
must check for
authentication option. */ authentication option. */
memset(auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1); memset(auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
vl_config.auth_key = auth_key; vl_config.auth_key = auth_key;
} else if (strncmp(argv[i]->text, "authentication", 14) } else if (strncmp(argv[i]->text, "authentication", 14)
== 0) { == 0) {
/* authentication - this option can only occur /* authentication - this option can only occur
at start at start of command line */
of command line */
vl_config.auth_type = OSPF_AUTH_NOTSET; vl_config.auth_type = OSPF_AUTH_NOTSET;
if ((i + 1) < argc)
i++;
} }
break; break;
@ -1186,6 +1182,7 @@ DEFUN (no_ospf_area_vlink,
if (i < argc) { if (i < argc) {
vl_config.crypto_key_id = vl_config.crypto_key_id =
strtol(argv[i]->arg, NULL, 10); strtol(argv[i]->arg, NULL, 10);
i++; /* skip md5_key arg for delete */
if (vl_config.crypto_key_id < 0) if (vl_config.crypto_key_id < 0)
return CMD_WARNING_CONFIG_FAILED; return CMD_WARNING_CONFIG_FAILED;
vl_config.md5_key = NULL; vl_config.md5_key = NULL;