mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 10:04:18 +00:00
Merge pull request #1250 from chiragshah6/ospf_vrf_dev
ospfd: fix virtual-link config command
This commit is contained in:
commit
00d89a0e57
198
ospfd/ospf_vty.c
198
ospfd/ospf_vty.c
@ -963,26 +963,23 @@ static int ospf_vl_set(struct ospf *ospf, struct ospf_vl_config_data *vl_config)
|
|||||||
|
|
||||||
#define VLINK_HELPSTR_AUTH_SIMPLE \
|
#define VLINK_HELPSTR_AUTH_SIMPLE \
|
||||||
"Authentication password (key)\n" \
|
"Authentication password (key)\n" \
|
||||||
"The OSPF password (key)"
|
"The OSPF password (key)\n"
|
||||||
|
|
||||||
#define VLINK_HELPSTR_AUTH_MD5 \
|
#define VLINK_HELPSTR_AUTH_MD5 \
|
||||||
"Message digest authentication password (key)\n" \
|
"Message digest authentication password (key)\n" \
|
||||||
"dummy string \n" \
|
|
||||||
"Key ID\n" \
|
"Key ID\n" \
|
||||||
"Use MD5 algorithm\n" \
|
"Use MD5 algorithm\n" \
|
||||||
"The OSPF password (key)"
|
"The OSPF password (key)\n"
|
||||||
|
|
||||||
DEFUN (ospf_area_vlink,
|
DEFUN (ospf_area_vlink,
|
||||||
ospf_area_vlink_cmd,
|
ospf_area_vlink_cmd,
|
||||||
"area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D [authentication] [<message-digest|null>] [<message-digest-key (1-255) md5 KEY|authentication-key AUTH_KEY>]",
|
"area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D [authentication [<message-digest|null>]] [<message-digest-key (1-255) md5 KEY|authentication-key AUTH_KEY>]",
|
||||||
VLINK_HELPSTR_IPADDR
|
VLINK_HELPSTR_IPADDR
|
||||||
"Enable authentication on this virtual link\n" \
|
"Enable authentication on this virtual link\n"
|
||||||
"Use null authentication\n" \
|
|
||||||
"Use message-digest authentication\n"
|
"Use message-digest authentication\n"
|
||||||
"Message digest authentication password (key)\n" \
|
"Use null authentication\n"
|
||||||
"Key ID\n" \
|
VLINK_HELPSTR_AUTH_MD5
|
||||||
"Use MD5 algorithm\n" \
|
VLINK_HELPSTR_AUTH_SIMPLE)
|
||||||
"The OSPF password (key)")
|
|
||||||
{
|
{
|
||||||
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
|
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
|
||||||
int idx_ipv4_number = 1;
|
int idx_ipv4_number = 1;
|
||||||
@ -990,8 +987,8 @@ DEFUN (ospf_area_vlink,
|
|||||||
struct ospf_vl_config_data vl_config;
|
struct ospf_vl_config_data vl_config;
|
||||||
char auth_key[OSPF_AUTH_SIMPLE_SIZE + 1];
|
char auth_key[OSPF_AUTH_SIMPLE_SIZE + 1];
|
||||||
char md5_key[OSPF_AUTH_MD5_SIZE + 1];
|
char md5_key[OSPF_AUTH_MD5_SIZE + 1];
|
||||||
int i;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
ospf_vl_config_data_init(&vl_config, vty);
|
ospf_vl_config_data_init(&vl_config, vty);
|
||||||
|
|
||||||
@ -1015,80 +1012,36 @@ DEFUN (ospf_area_vlink,
|
|||||||
return ospf_vl_set(ospf, &vl_config);
|
return ospf_vl_set(ospf, &vl_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Deal with other parameters */
|
if (argv_find(argv, argc, "authentication", &idx)) {
|
||||||
for (i = 5; i < argc; i++) {
|
/* authentication - this option can only occur
|
||||||
|
at start of command line */
|
||||||
/* vty_out (vty, "argv[%d]->arg - %s\n", i, argv[i]->text); */
|
vl_config.auth_type = OSPF_AUTH_SIMPLE;
|
||||||
|
|
||||||
switch (argv[i]->arg[0]) {
|
|
||||||
|
|
||||||
case 'a':
|
|
||||||
if (i > 5
|
|
||||||
|| strncmp(argv[i]->arg, "authentication-", 15)
|
|
||||||
== 0) {
|
|
||||||
/* authentication-key - this option can occur
|
|
||||||
anywhere on
|
|
||||||
command line. At start
|
|
||||||
of command line
|
|
||||||
must check for
|
|
||||||
authentication option. */
|
|
||||||
memset(auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
|
|
||||||
strncpy(auth_key, argv[i + 1]->text,
|
|
||||||
OSPF_AUTH_SIMPLE_SIZE);
|
|
||||||
vl_config.auth_key = auth_key;
|
|
||||||
i++;
|
|
||||||
} else if (strncmp(argv[i]->arg, "authentication", 14)
|
|
||||||
== 0) {
|
|
||||||
/* authentication - this option can only occur
|
|
||||||
at start
|
|
||||||
of command line */
|
|
||||||
vl_config.auth_type = OSPF_AUTH_SIMPLE;
|
|
||||||
if ((i + 1) < argc) {
|
|
||||||
if (strncmp(argv[i + 1]->arg, "n", 1)
|
|
||||||
== 0) {
|
|
||||||
/* "authentication null" */
|
|
||||||
vl_config.auth_type =
|
|
||||||
OSPF_AUTH_NULL;
|
|
||||||
i++;
|
|
||||||
} else if (
|
|
||||||
strncmp(argv[i + 1]->arg, "m",
|
|
||||||
1)
|
|
||||||
== 0
|
|
||||||
&& !strmatch(
|
|
||||||
argv[i + 1]->text,
|
|
||||||
"message-digest-")) {
|
|
||||||
/* "authentication
|
|
||||||
* message-digest" */
|
|
||||||
vl_config.auth_type =
|
|
||||||
OSPF_AUTH_CRYPTOGRAPHIC;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'm':
|
|
||||||
/* message-digest-key */
|
|
||||||
i++;
|
|
||||||
if (i < argc) {
|
|
||||||
vl_config.crypto_key_id =
|
|
||||||
strtol(argv[i]->arg, NULL, 10);
|
|
||||||
if (vl_config.crypto_key_id < 0)
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
i++;
|
|
||||||
if (i < argc) {
|
|
||||||
memset(md5_key, 0,
|
|
||||||
OSPF_AUTH_MD5_SIZE + 1);
|
|
||||||
strncpy(md5_key, argv[i]->arg,
|
|
||||||
OSPF_AUTH_MD5_SIZE);
|
|
||||||
vl_config.md5_key = md5_key;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
vl_config.md5_key = NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argv_find(argv, argc, "message-digest", &idx)) {
|
||||||
|
/* authentication message-digest */
|
||||||
|
vl_config.auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
|
||||||
|
} else if (argv_find(argv, argc, "null", &idx)) {
|
||||||
|
/* "authentication null" */
|
||||||
|
vl_config.auth_type = OSPF_AUTH_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argv_find(argv, argc, "message-digest-key", &idx)) {
|
||||||
|
vl_config.md5_key = NULL;
|
||||||
|
vl_config.crypto_key_id = strtol(argv[idx + 1]->arg, NULL, 10);
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
vl_config.auth_key = auth_key;
|
||||||
|
}
|
||||||
|
|
||||||
/* Action configuration */
|
/* Action configuration */
|
||||||
|
|
||||||
@ -1097,16 +1050,14 @@ DEFUN (ospf_area_vlink,
|
|||||||
|
|
||||||
DEFUN (no_ospf_area_vlink,
|
DEFUN (no_ospf_area_vlink,
|
||||||
no_ospf_area_vlink_cmd,
|
no_ospf_area_vlink_cmd,
|
||||||
"no area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D [authentication] [<message-digest|null>] [<message-digest-key (1-255) md5 KEY|authentication-key AUTH_KEY>]",
|
"no area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D [authentication [<message-digest|null>]] [<message-digest-key (1-255) md5 KEY|authentication-key AUTH_KEY>]",
|
||||||
NO_STR
|
NO_STR
|
||||||
VLINK_HELPSTR_IPADDR
|
VLINK_HELPSTR_IPADDR
|
||||||
"Enable authentication on this virtual link\n" \
|
"Enable authentication on this virtual link\n" \
|
||||||
|
"Use message-digest authentication\n" \
|
||||||
"Use null authentication\n" \
|
"Use null authentication\n" \
|
||||||
"Use message-digest authentication\n"
|
VLINK_HELPSTR_AUTH_MD5
|
||||||
"Message digest authentication password (key)\n" \
|
VLINK_HELPSTR_AUTH_SIMPLE)
|
||||||
"Key ID\n" \
|
|
||||||
"Use MD5 algorithm\n" \
|
|
||||||
"The OSPF password (key)")
|
|
||||||
{
|
{
|
||||||
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
|
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
|
||||||
int idx_ipv4_number = 2;
|
int idx_ipv4_number = 2;
|
||||||
@ -1115,7 +1066,7 @@ DEFUN (no_ospf_area_vlink,
|
|||||||
struct ospf_vl_config_data vl_config;
|
struct ospf_vl_config_data vl_config;
|
||||||
struct ospf_vl_data *vl_data = NULL;
|
struct ospf_vl_data *vl_data = NULL;
|
||||||
char auth_key[OSPF_AUTH_SIMPLE_SIZE + 1];
|
char auth_key[OSPF_AUTH_SIMPLE_SIZE + 1];
|
||||||
int i;
|
int idx = 0;
|
||||||
int ret, format;
|
int ret, format;
|
||||||
|
|
||||||
ospf_vl_config_data_init(&vl_config, vty);
|
ospf_vl_config_data_init(&vl_config, vty);
|
||||||
@ -1151,50 +1102,26 @@ 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++) {
|
|
||||||
/* vty_out (vty, "argv[%d] - %s\n", i, argv[i]); */
|
|
||||||
|
|
||||||
switch (argv[i]->arg[0]) {
|
if (argv_find(argv, argc, "authentication", &idx)) {
|
||||||
|
/* authentication - this option can only occur
|
||||||
case 'a':
|
at start of command line */
|
||||||
if (i > 2
|
vl_config.auth_type = OSPF_AUTH_NOTSET;
|
||||||
|| strncmp(argv[i]->text, "authentication-", 15)
|
|
||||||
== 0) {
|
|
||||||
/* authentication-key - this option can occur
|
|
||||||
anywhere on
|
|
||||||
command line. At start
|
|
||||||
of command line
|
|
||||||
must check for
|
|
||||||
authentication option. */
|
|
||||||
memset(auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
|
|
||||||
vl_config.auth_key = auth_key;
|
|
||||||
} else if (strncmp(argv[i]->text, "authentication", 14)
|
|
||||||
== 0) {
|
|
||||||
/* authentication - this option can only occur
|
|
||||||
at start
|
|
||||||
of command line */
|
|
||||||
vl_config.auth_type = OSPF_AUTH_NOTSET;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'm':
|
|
||||||
/* message-digest-key */
|
|
||||||
/* Delete one key */
|
|
||||||
i++;
|
|
||||||
if (i < argc) {
|
|
||||||
vl_config.crypto_key_id =
|
|
||||||
strtol(argv[i]->arg, NULL, 10);
|
|
||||||
if (vl_config.crypto_key_id < 0)
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
vl_config.md5_key = NULL;
|
|
||||||
} else
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argv_find(argv, argc, "message-digest-key", &idx)) {
|
||||||
|
vl_config.md5_key = NULL;
|
||||||
|
vl_config.crypto_key_id = strtol(argv[idx + 1]->arg, NULL, 10);
|
||||||
|
if (vl_config.crypto_key_id < 0)
|
||||||
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argv_find(argv, argc, "authentication-key", &idx)) {
|
||||||
|
/* Reset authentication-key to 0 */
|
||||||
|
memset(auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
|
||||||
|
vl_config.auth_key = auth_key;
|
||||||
|
}
|
||||||
|
|
||||||
/* Action configuration */
|
/* Action configuration */
|
||||||
|
|
||||||
@ -5871,8 +5798,7 @@ DEFUN_HIDDEN (ospf_authentication_key,
|
|||||||
ospf_authentication_key_cmd,
|
ospf_authentication_key_cmd,
|
||||||
"ospf authentication-key AUTH_KEY [A.B.C.D]",
|
"ospf authentication-key AUTH_KEY [A.B.C.D]",
|
||||||
"OSPF interface commands\n"
|
"OSPF interface commands\n"
|
||||||
"Authentication password (key)\n"
|
VLINK_HELPSTR_AUTH_SIMPLE
|
||||||
"The OSPF password (key)\n"
|
|
||||||
"Address of interface\n")
|
"Address of interface\n")
|
||||||
{
|
{
|
||||||
return ip_ospf_authentication_key(self, vty, argc, argv);
|
return ip_ospf_authentication_key(self, vty, argc, argv);
|
||||||
@ -5884,8 +5810,8 @@ DEFUN (no_ip_ospf_authentication_key,
|
|||||||
NO_STR
|
NO_STR
|
||||||
"IP Information\n"
|
"IP Information\n"
|
||||||
"OSPF interface commands\n"
|
"OSPF interface commands\n"
|
||||||
"Authentication password (key)\n"
|
VLINK_HELPSTR_AUTH_SIMPLE
|
||||||
"The OSPF password (key)")
|
"Address of interface\n")
|
||||||
{
|
{
|
||||||
VTY_DECLVAR_CONTEXT(interface, ifp);
|
VTY_DECLVAR_CONTEXT(interface, ifp);
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
@ -5921,8 +5847,8 @@ DEFUN_HIDDEN (no_ospf_authentication_key,
|
|||||||
"no ospf authentication-key [AUTH_KEY [A.B.C.D]]",
|
"no ospf authentication-key [AUTH_KEY [A.B.C.D]]",
|
||||||
NO_STR
|
NO_STR
|
||||||
"OSPF interface commands\n"
|
"OSPF interface commands\n"
|
||||||
"Authentication password (key)\n"
|
VLINK_HELPSTR_AUTH_SIMPLE
|
||||||
"The OSPF password (key)")
|
"Address of interface\n")
|
||||||
{
|
{
|
||||||
return no_ip_ospf_authentication_key(self, vty, argc, argv);
|
return no_ip_ospf_authentication_key(self, vty, argc, argv);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user