Merge pull request #15870 from opensourcerouting/fix/1ce626aea6f1f274da92478a8e487c229b08f9ce_10.0

vtysh: Show `ip ospf network ...` even if it's not the same as the interface type
This commit is contained in:
Russ White 2024-05-07 10:42:11 -04:00 committed by GitHub
commit 0b27a7d2fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 20 deletions

View File

@ -1373,7 +1373,8 @@ static int ospf_ifp_create(struct interface *ifp)
(!OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp), type) || (!OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp), type) ||
if_is_loopback(ifp))) { if_is_loopback(ifp))) {
SET_IF_PARAM(IF_DEF_PARAMS(ifp), type); SET_IF_PARAM(IF_DEF_PARAMS(ifp), type);
IF_DEF_PARAMS(ifp)->type = ospf_default_iftype(ifp); if (!IF_DEF_PARAMS(ifp)->type_cfg)
IF_DEF_PARAMS(ifp)->type = ospf_default_iftype(ifp);
} }
ospf = ifp->vrf->info; ospf = ifp->vrf->info;

View File

@ -57,6 +57,7 @@ struct ospf_if_params {
DECLARE_IF_PARAM(struct in_addr, if_area); DECLARE_IF_PARAM(struct in_addr, if_area);
uint32_t if_area_id_fmt; uint32_t if_area_id_fmt;
bool type_cfg;
DECLARE_IF_PARAM(uint8_t, type); /* type of interface */ DECLARE_IF_PARAM(uint8_t, type); /* type of interface */
#define OSPF_IF_ACTIVE 0 #define OSPF_IF_ACTIVE 0
#define OSPF_IF_PASSIVE 1 #define OSPF_IF_PASSIVE 1

View File

@ -8591,6 +8591,8 @@ DEFUN(ip_ospf_network, ip_ospf_network_cmd,
IF_DEF_PARAMS(ifp)->ptp_dmvpn = 1; IF_DEF_PARAMS(ifp)->ptp_dmvpn = 1;
} }
IF_DEF_PARAMS(ifp)->type_cfg = true;
if (IF_DEF_PARAMS(ifp)->type == old_type && if (IF_DEF_PARAMS(ifp)->type == old_type &&
IF_DEF_PARAMS(ifp)->ptp_dmvpn == old_ptp_dmvpn && IF_DEF_PARAMS(ifp)->ptp_dmvpn == old_ptp_dmvpn &&
IF_DEF_PARAMS(ifp)->p2mp_delay_reflood == old_p2mp_delay_reflood) IF_DEF_PARAMS(ifp)->p2mp_delay_reflood == old_p2mp_delay_reflood)
@ -8654,6 +8656,7 @@ DEFUN (no_ip_ospf_network,
struct route_node *rn; struct route_node *rn;
IF_DEF_PARAMS(ifp)->type = ospf_default_iftype(ifp); IF_DEF_PARAMS(ifp)->type = ospf_default_iftype(ifp);
IF_DEF_PARAMS(ifp)->type_cfg = false;
IF_DEF_PARAMS(ifp)->ptp_dmvpn = 0; IF_DEF_PARAMS(ifp)->ptp_dmvpn = 0;
IF_DEF_PARAMS(ifp)->p2mp_delay_reflood = IF_DEF_PARAMS(ifp)->p2mp_delay_reflood =
OSPF_P2MP_DELAY_REFLOOD_DEFAULT; OSPF_P2MP_DELAY_REFLOOD_DEFAULT;
@ -12211,25 +12214,21 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf)
do { do {
/* 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)) { params->type_cfg) {
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->type == OSPF_IFTYPE_POINTOPOINT &&
if (params->type params->ptp_dmvpn)
== OSPF_IFTYPE_POINTOPOINT vty_out(vty, " dmvpn");
&& params->ptp_dmvpn) if (params->type ==
vty_out(vty, " dmvpn"); OSPF_IFTYPE_POINTOMULTIPOINT &&
if (params->type == params->p2mp_delay_reflood)
OSPF_IFTYPE_POINTOMULTIPOINT && vty_out(vty, " delay-reflood");
params->p2mp_delay_reflood) if (params != IF_DEF_PARAMS(ifp) && rn)
vty_out(vty, " delay-reflood"); vty_out(vty, " %pI4", &rn->p.u.prefix4);
if (params != IF_DEF_PARAMS(ifp) && rn) vty_out(vty, "\n");
vty_out(vty, " %pI4",
&rn->p.u.prefix4);
vty_out(vty, "\n");
}
} }
/* OSPF interface authentication print */ /* OSPF interface authentication print */