mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 20:32:18 +00:00
Merge pull request #1502 from chiragshah6/ospf_vrf_dev
ospfd: Display all vrf aware ospf interface config
This commit is contained in:
commit
17473b9a45
@ -9635,30 +9635,27 @@ const char *ospf_int_type_str[] = {"unknown", /* should never be used. */
|
|||||||
"virtual-link", /* should never be used. */
|
"virtual-link", /* should never be used. */
|
||||||
"loopback"};
|
"loopback"};
|
||||||
|
|
||||||
static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
|
static int config_write_interface_one(struct vty *vty, struct vrf *vrf)
|
||||||
{
|
{
|
||||||
struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id);
|
|
||||||
struct listnode *node;
|
struct listnode *node;
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
struct crypt_key *ck;
|
struct crypt_key *ck;
|
||||||
struct route_node *rn = NULL;
|
struct route_node *rn = NULL;
|
||||||
struct ospf_if_params *params;
|
struct ospf_if_params *params;
|
||||||
int write = 0;
|
int write = 0;
|
||||||
|
struct ospf *ospf = vrf->info;
|
||||||
|
|
||||||
FOR_ALL_INTERFACES (vrf, ifp) {
|
FOR_ALL_INTERFACES (vrf, ifp) {
|
||||||
struct vrf *vrf = NULL;
|
|
||||||
|
|
||||||
if (memcmp(ifp->name, "VLINK", 5) == 0)
|
if (memcmp(ifp->name, "VLINK", 5) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
vrf = vrf_lookup_by_id(ifp->vrf_id);
|
|
||||||
|
|
||||||
vty_frame(vty, "!\n");
|
vty_frame(vty, "!\n");
|
||||||
if (ifp->vrf_id == VRF_DEFAULT || vrf == NULL)
|
if (ifp->vrf_id == VRF_DEFAULT)
|
||||||
vty_frame(vty, "interface %s\n", ifp->name);
|
vty_frame(vty, "interface %s\n", ifp->name);
|
||||||
else
|
else
|
||||||
vty_frame(vty, "interface %s vrf %s\n",
|
vty_frame(vty, "interface %s vrf %s\n",
|
||||||
ifp->name, vrf->name);
|
ifp->name, vrf->name);
|
||||||
if (ifp->desc)
|
if (ifp->desc)
|
||||||
vty_out(vty, " description %s\n", ifp->desc);
|
vty_out(vty, " description %s\n", ifp->desc);
|
||||||
|
|
||||||
@ -9670,26 +9667,27 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
|
|||||||
/* Interface Network print. */
|
/* Interface Network print. */
|
||||||
if (OSPF_IF_PARAM_CONFIGURED(params, type)
|
if (OSPF_IF_PARAM_CONFIGURED(params, type)
|
||||||
&& params->type != OSPF_IFTYPE_LOOPBACK) {
|
&& params->type != OSPF_IFTYPE_LOOPBACK) {
|
||||||
if (params->type != ospf_default_iftype(ifp)) {
|
if (params->type !=
|
||||||
|
ospf_default_iftype(ifp)) {
|
||||||
vty_out(vty, " ip ospf network %s",
|
vty_out(vty, " ip ospf network %s",
|
||||||
ospf_int_type_str
|
ospf_int_type_str
|
||||||
[params->type]);
|
[params->type]);
|
||||||
if (params != IF_DEF_PARAMS(ifp))
|
if (params != IF_DEF_PARAMS(ifp))
|
||||||
vty_out(vty, " %s",
|
vty_out(vty, " %s",
|
||||||
inet_ntoa(
|
inet_ntoa(
|
||||||
rn->p.u.prefix4));
|
rn->p.u.prefix4));
|
||||||
vty_out(vty, "\n");
|
vty_out(vty, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OSPF interface authentication print */
|
/* OSPF interface authentication print */
|
||||||
if (OSPF_IF_PARAM_CONFIGURED(params, auth_type)
|
if (OSPF_IF_PARAM_CONFIGURED(params, auth_type)
|
||||||
&& params->auth_type != OSPF_AUTH_NOTSET) {
|
&& params->auth_type != OSPF_AUTH_NOTSET) {
|
||||||
const char *auth_str;
|
const char *auth_str;
|
||||||
|
|
||||||
/* Translation tables are not that much help
|
/* Translation tables are not that much help
|
||||||
* here due to syntax
|
* here due to syntax
|
||||||
* of the simple option */
|
* of the simple option */
|
||||||
switch (params->auth_type) {
|
switch (params->auth_type) {
|
||||||
|
|
||||||
case OSPF_AUTH_NULL:
|
case OSPF_AUTH_NULL:
|
||||||
@ -9719,7 +9717,7 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
|
|||||||
|
|
||||||
/* Simple Authentication Password print. */
|
/* Simple Authentication Password print. */
|
||||||
if (OSPF_IF_PARAM_CONFIGURED(params, auth_simple)
|
if (OSPF_IF_PARAM_CONFIGURED(params, auth_simple)
|
||||||
&& params->auth_simple[0] != '\0') {
|
&& params->auth_simple[0] != '\0') {
|
||||||
vty_out(vty, " ip ospf authentication-key %s",
|
vty_out(vty, " ip ospf authentication-key %s",
|
||||||
params->auth_simple);
|
params->auth_simple);
|
||||||
if (params != IF_DEF_PARAMS(ifp))
|
if (params != IF_DEF_PARAMS(ifp))
|
||||||
@ -9730,21 +9728,23 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
|
|||||||
|
|
||||||
/* Cryptographic Authentication Key print. */
|
/* Cryptographic Authentication Key print. */
|
||||||
if (params && params->auth_crypt) {
|
if (params && params->auth_crypt) {
|
||||||
for (ALL_LIST_ELEMENTS_RO(params->auth_crypt,
|
for (ALL_LIST_ELEMENTS_RO(
|
||||||
node, ck)) {
|
params->auth_crypt,
|
||||||
|
node, ck)) {
|
||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
" ip ospf message-digest-key %d md5 %s",
|
" ip ospf message-digest-key %d md5 %s",
|
||||||
ck->key_id, ck->auth_key);
|
ck->key_id,
|
||||||
|
ck->auth_key);
|
||||||
if (params != IF_DEF_PARAMS(ifp))
|
if (params != IF_DEF_PARAMS(ifp))
|
||||||
vty_out(vty, " %s",
|
vty_out(vty, " %s",
|
||||||
inet_ntoa(rn->p.u.prefix4));
|
inet_ntoa(rn->p.u.prefix4));
|
||||||
vty_out(vty, "\n");
|
vty_out(vty, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Interface Output Cost print. */
|
/* Interface Output Cost print. */
|
||||||
if (OSPF_IF_PARAM_CONFIGURED(params,
|
if (OSPF_IF_PARAM_CONFIGURED(params,
|
||||||
output_cost_cmd)) {
|
output_cost_cmd)) {
|
||||||
vty_out(vty, " ip ospf cost %u",
|
vty_out(vty, " ip ospf cost %u",
|
||||||
params->output_cost_cmd);
|
params->output_cost_cmd);
|
||||||
if (params != IF_DEF_PARAMS(ifp))
|
if (params != IF_DEF_PARAMS(ifp))
|
||||||
@ -9755,7 +9755,8 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
|
|||||||
|
|
||||||
/* Hello Interval print. */
|
/* Hello Interval print. */
|
||||||
if (OSPF_IF_PARAM_CONFIGURED(params, v_hello)
|
if (OSPF_IF_PARAM_CONFIGURED(params, v_hello)
|
||||||
&& params->v_hello != OSPF_HELLO_INTERVAL_DEFAULT) {
|
&& params->v_hello !=
|
||||||
|
OSPF_HELLO_INTERVAL_DEFAULT) {
|
||||||
vty_out(vty, " ip ospf hello-interval %u",
|
vty_out(vty, " ip ospf hello-interval %u",
|
||||||
params->v_hello);
|
params->v_hello);
|
||||||
if (params != IF_DEF_PARAMS(ifp))
|
if (params != IF_DEF_PARAMS(ifp))
|
||||||
@ -9767,18 +9768,19 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
|
|||||||
|
|
||||||
/* Router Dead Interval print. */
|
/* Router Dead Interval print. */
|
||||||
if (OSPF_IF_PARAM_CONFIGURED(params, v_wait)
|
if (OSPF_IF_PARAM_CONFIGURED(params, v_wait)
|
||||||
&& params->v_wait
|
&& params->v_wait
|
||||||
!= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT) {
|
!= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT) {
|
||||||
vty_out(vty, " ip ospf dead-interval ");
|
vty_out(vty, " ip ospf dead-interval ");
|
||||||
|
|
||||||
/* fast hello ? */
|
/* fast hello ? */
|
||||||
if (OSPF_IF_PARAM_CONFIGURED(params,
|
if (OSPF_IF_PARAM_CONFIGURED(params,
|
||||||
fast_hello))
|
fast_hello))
|
||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
"minimal hello-multiplier %d",
|
"minimal hello-multiplier %d",
|
||||||
params->fast_hello);
|
params->fast_hello);
|
||||||
else
|
else
|
||||||
vty_out(vty, "%u", params->v_wait);
|
vty_out(vty, "%u",
|
||||||
|
params->v_wait);
|
||||||
|
|
||||||
if (params != IF_DEF_PARAMS(ifp))
|
if (params != IF_DEF_PARAMS(ifp))
|
||||||
vty_out(vty, " %s",
|
vty_out(vty, " %s",
|
||||||
@ -9788,8 +9790,8 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
|
|||||||
|
|
||||||
/* Router Priority print. */
|
/* Router Priority print. */
|
||||||
if (OSPF_IF_PARAM_CONFIGURED(params, priority)
|
if (OSPF_IF_PARAM_CONFIGURED(params, priority)
|
||||||
&& params->priority
|
&& params->priority
|
||||||
!= OSPF_ROUTER_PRIORITY_DEFAULT) {
|
!= OSPF_ROUTER_PRIORITY_DEFAULT) {
|
||||||
vty_out(vty, " ip ospf priority %u",
|
vty_out(vty, " ip ospf priority %u",
|
||||||
params->priority);
|
params->priority);
|
||||||
if (params != IF_DEF_PARAMS(ifp))
|
if (params != IF_DEF_PARAMS(ifp))
|
||||||
@ -9800,9 +9802,9 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
|
|||||||
|
|
||||||
/* Retransmit Interval print. */
|
/* Retransmit Interval print. */
|
||||||
if (OSPF_IF_PARAM_CONFIGURED(params,
|
if (OSPF_IF_PARAM_CONFIGURED(params,
|
||||||
retransmit_interval)
|
retransmit_interval)
|
||||||
&& params->retransmit_interval
|
&& params->retransmit_interval
|
||||||
!= OSPF_RETRANSMIT_INTERVAL_DEFAULT) {
|
!= OSPF_RETRANSMIT_INTERVAL_DEFAULT) {
|
||||||
vty_out(vty, " ip ospf retransmit-interval %u",
|
vty_out(vty, " ip ospf retransmit-interval %u",
|
||||||
params->retransmit_interval);
|
params->retransmit_interval);
|
||||||
if (params != IF_DEF_PARAMS(ifp))
|
if (params != IF_DEF_PARAMS(ifp))
|
||||||
@ -9812,20 +9814,21 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Transmit Delay print. */
|
/* Transmit Delay print. */
|
||||||
if (OSPF_IF_PARAM_CONFIGURED(params, transmit_delay)
|
if (OSPF_IF_PARAM_CONFIGURED(params,
|
||||||
&& params->transmit_delay
|
transmit_delay)
|
||||||
!= OSPF_TRANSMIT_DELAY_DEFAULT) {
|
&& params->transmit_delay
|
||||||
|
!= OSPF_TRANSMIT_DELAY_DEFAULT) {
|
||||||
vty_out(vty, " ip ospf transmit-delay %u",
|
vty_out(vty, " ip ospf transmit-delay %u",
|
||||||
params->transmit_delay);
|
params->transmit_delay);
|
||||||
if (params != IF_DEF_PARAMS(ifp))
|
if (params != IF_DEF_PARAMS(ifp))
|
||||||
vty_out(vty, " %s",
|
vty_out(vty, " %s",
|
||||||
inet_ntoa(rn->p.u.prefix4));
|
inet_ntoa(rn->p.u.prefix4));
|
||||||
vty_out(vty, "\n");
|
vty_out(vty, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Area print. */
|
/* Area print. */
|
||||||
if (OSPF_IF_PARAM_CONFIGURED(params, if_area)) {
|
if (OSPF_IF_PARAM_CONFIGURED(params, if_area)) {
|
||||||
if (ospf->instance)
|
if (ospf && ospf->instance)
|
||||||
vty_out(vty, " ip ospf %d",
|
vty_out(vty, " ip ospf %d",
|
||||||
ospf->instance);
|
ospf->instance);
|
||||||
else
|
else
|
||||||
@ -9833,39 +9836,42 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
|
|||||||
|
|
||||||
|
|
||||||
size_t buflen = MAX(strlen("4294967295"),
|
size_t buflen = MAX(strlen("4294967295"),
|
||||||
strlen("255.255.255.255"));
|
strlen("255.255.255.255"));
|
||||||
char buf[buflen];
|
char buf[buflen];
|
||||||
|
|
||||||
area_id2str(buf, sizeof(buf),
|
area_id2str(buf, sizeof(buf),
|
||||||
¶ms->if_area,
|
¶ms->if_area,
|
||||||
params->if_area_id_fmt);
|
params->if_area_id_fmt);
|
||||||
vty_out(vty, " area %s", buf);
|
vty_out(vty, " area %s", buf);
|
||||||
if (params != IF_DEF_PARAMS(ifp))
|
if (params != IF_DEF_PARAMS(ifp))
|
||||||
vty_out(vty, " %s",
|
vty_out(vty, " %s",
|
||||||
inet_ntoa(rn->p.u.prefix4));
|
inet_ntoa(rn->p.u.prefix4));
|
||||||
vty_out(vty, "\n");
|
vty_out(vty, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bfd print. */
|
/* bfd print. */
|
||||||
ospf_bfd_write_config(vty, params);
|
if (params->bfd_info)
|
||||||
|
ospf_bfd_write_config(vty, params);
|
||||||
|
|
||||||
/* MTU ignore print. */
|
/* MTU ignore print. */
|
||||||
if (OSPF_IF_PARAM_CONFIGURED(params, mtu_ignore)
|
if (OSPF_IF_PARAM_CONFIGURED(params, mtu_ignore)
|
||||||
&& params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) {
|
&& params->mtu_ignore !=
|
||||||
|
OSPF_MTU_IGNORE_DEFAULT) {
|
||||||
if (params->mtu_ignore == 0)
|
if (params->mtu_ignore == 0)
|
||||||
vty_out(vty, " no ip ospf mtu-ignore");
|
vty_out(vty, " no ip ospf mtu-ignore");
|
||||||
else
|
else
|
||||||
vty_out(vty, " ip ospf mtu-ignore");
|
vty_out(vty, " ip ospf mtu-ignore");
|
||||||
if (params != IF_DEF_PARAMS(ifp))
|
if (params != IF_DEF_PARAMS(ifp))
|
||||||
vty_out(vty, " %s",
|
vty_out(vty, " %s",
|
||||||
inet_ntoa(rn->p.u.prefix4));
|
inet_ntoa(rn->p.u.prefix4));
|
||||||
vty_out(vty, "\n");
|
vty_out(vty, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (rn == NULL)
|
if (rn == NULL)
|
||||||
rn = route_top(IF_OIFS_PARAMS(ifp));
|
rn = route_top(
|
||||||
|
IF_OIFS_PARAMS(ifp));
|
||||||
else
|
else
|
||||||
rn = route_next(rn);
|
rn = route_next(rn);
|
||||||
|
|
||||||
@ -9881,6 +9887,7 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
|
|||||||
|
|
||||||
vty_endframe(vty, NULL);
|
vty_endframe(vty, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return write;
|
return write;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9888,12 +9895,12 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
|
|||||||
static int config_write_interface(struct vty *vty)
|
static int config_write_interface(struct vty *vty)
|
||||||
{
|
{
|
||||||
int write = 0;
|
int write = 0;
|
||||||
struct ospf *ospf = NULL;
|
struct vrf *vrf = NULL;
|
||||||
struct listnode *node = NULL;
|
|
||||||
|
|
||||||
/* Traverse all ospf [vrf] instances */
|
/* Display all VRF aware OSPF interface configuration */
|
||||||
for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf))
|
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
||||||
write += config_write_interface_one(vty, ospf);
|
write += config_write_interface_one(vty, vrf);
|
||||||
|
}
|
||||||
|
|
||||||
return write;
|
return write;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user