vtysh: Show ip ospf network ... even if it's not the same as the interface type

ospfv3 shows this unconditionally, and ospfv2 does not show `ip ospf network ...` if the type of the interface matches the specified network.

Fixes: https://github.com/FRRouting/frr/issues/15817

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
Donatas Abraitis 2024-04-23 17:13:46 +03:00
parent fe88c8425f
commit 200eb7e92d
3 changed files with 21 additions and 20 deletions

View File

@ -1391,6 +1391,7 @@ 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 (!IF_DEF_PARAMS(ifp)->type_cfg)
IF_DEF_PARAMS(ifp)->type = ospf_default_iftype(ifp); IF_DEF_PARAMS(ifp)->type = ospf_default_iftype(ifp);
} }

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

@ -8590,6 +8590,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)
@ -8653,6 +8655,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;
@ -12210,26 +12213,22 @@ 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
&& params->ptp_dmvpn)
vty_out(vty, " dmvpn"); vty_out(vty, " dmvpn");
if (params->type == if (params->type ==
OSPF_IFTYPE_POINTOMULTIPOINT && OSPF_IFTYPE_POINTOMULTIPOINT &&
params->p2mp_delay_reflood) params->p2mp_delay_reflood)
vty_out(vty, " delay-reflood"); vty_out(vty, " delay-reflood");
if (params != IF_DEF_PARAMS(ifp) && rn) if (params != IF_DEF_PARAMS(ifp) && rn)
vty_out(vty, " %pI4", vty_out(vty, " %pI4", &rn->p.u.prefix4);
&rn->p.u.prefix4);
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
}
/* OSPF interface authentication print */ /* OSPF interface authentication print */
ret = interface_config_auth_str(params, buf); ret = interface_config_auth_str(params, buf);