summaryrefslogtreecommitdiff
path: root/ospfd/ospf_ext.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd/ospf_ext.c')
-rw-r--r--ospfd/ospf_ext.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/ospfd/ospf_ext.c b/ospfd/ospf_ext.c
index 90dc108c0e..4fa61221a6 100644
--- a/ospfd/ospf_ext.c
+++ b/ospfd/ospf_ext.c
@@ -462,6 +462,10 @@ static void set_rmt_itf_addr(struct ext_itf *exti, struct in_addr rmtif)
static void ospf_extended_lsa_delete(struct ext_itf *exti)
{
+ /* Avoid deleting LSA if Extended is not enable */
+ if (!OspfEXT.enabled)
+ return;
+
/* Process only Active Extended Prefix/Link LSA */
if (!CHECK_FLAG(exti->flags, EXT_LPFLG_LSA_ACTIVE))
return;
@@ -755,16 +759,16 @@ static void ospf_ext_ism_change(struct ospf_interface *oi, int old_status)
if (oi->type == OSPF_IFTYPE_LOOPBACK) {
exti->stype = PREF_SID;
exti->type = OPAQUE_TYPE_EXTENDED_PREFIX_LSA;
- exti->flags = EXT_LPFLG_LSA_ACTIVE;
exti->instance = get_ext_pref_instance_value();
exti->area = oi->area;
- osr_debug("EXT (%s): Set Prefix SID to interface %s ",
- __func__, oi->ifp->name);
-
/* Complete SRDB if the interface belongs to a Prefix */
- if (OspfEXT.enabled)
+ if (OspfEXT.enabled) {
+ osr_debug("EXT (%s): Set Prefix SID to interface %s ",
+ __func__, oi->ifp->name);
+ exti->flags = EXT_LPFLG_LSA_ACTIVE;
ospf_sr_update_local_prefix(oi->ifp, oi->address);
+ }
} else {
/* Determine if interface is related to Adj. or LAN Adj. SID */
if (oi->state == ISM_DR)
@@ -780,9 +784,11 @@ static void ospf_ext_ism_change(struct ospf_interface *oi, int old_status)
* Note: Adjacency SID information are completed when ospf
* adjacency become up see ospf_ext_link_nsm_change()
*/
- osr_debug("EXT (%s): Set %sAdjacency SID for interface %s ",
- __func__, exti->stype == ADJ_SID ? "" : "LAN-",
- oi->ifp->name);
+ if (OspfEXT.enabled)
+ osr_debug(
+ "EXT (%s): Set %sAdjacency SID for interface %s ",
+ __func__, exti->stype == ADJ_SID ? "" : "LAN-",
+ oi->ifp->name);
}
}
@@ -817,7 +823,8 @@ static void ospf_ext_link_nsm_change(struct ospf_neighbor *nbr, int old_status)
}
/* Remove Extended Link if Neighbor State goes Down or Deleted */
- if (nbr->state == NSM_Down || nbr->state == NSM_Deleted) {
+ if (OspfEXT.enabled
+ && (nbr->state == NSM_Down || nbr->state == NSM_Deleted)) {
ospf_ext_link_delete_adj_sid(exti);
if (CHECK_FLAG(exti->flags, EXT_LPFLG_LSA_ENGAGED))
ospf_ext_link_lsa_schedule(exti, FLUSH_THIS_LSA);
@@ -1716,8 +1723,8 @@ static uint16_t show_vty_ext_link_rmt_itf_addr(struct vty *vty,
top = (struct ext_subtlv_rmt_itf_addr *)tlvh;
vty_out(vty,
- " Remote Interface Address Sub-TLV: Length %u\n Address: %s\n",
- ntohs(top->header.length), inet_ntoa(top->value));
+ " Remote Interface Address Sub-TLV: Length %u\n Address: %pI4\n",
+ ntohs(top->header.length), &top->value);
return TLV_SIZE(tlvh);
}
@@ -1748,9 +1755,9 @@ static uint16_t show_vty_ext_link_lan_adj_sid(struct vty *vty,
(struct ext_subtlv_lan_adj_sid *)tlvh;
vty_out(vty,
- " LAN-Adj-SID Sub-TLV: Length %u\n\tFlags: 0x%x\n\tMT-ID:0x%x\n\tWeight: 0x%x\n\tNeighbor ID: %s\n\t%s: %u\n",
+ " LAN-Adj-SID Sub-TLV: Length %u\n\tFlags: 0x%x\n\tMT-ID:0x%x\n\tWeight: 0x%x\n\tNeighbor ID: %pI4\n\t%s: %u\n",
ntohs(top->header.length), top->flags, top->mtid, top->weight,
- inet_ntoa(top->neighbor_id),
+ &top->neighbor_id,
CHECK_FLAG(top->flags, EXT_SUBTLV_LINK_ADJ_SID_VFLG) ? "Label"
: "Index",
CHECK_FLAG(top->flags, EXT_SUBTLV_LINK_ADJ_SID_VFLG)
@@ -1778,10 +1785,10 @@ static uint16_t show_vty_link_info(struct vty *vty, struct tlv_header *ext)
vty_out(vty,
" Extended Link TLV: Length %u\n Link Type: 0x%x\n"
- " Link ID: %s\n",
+ " Link ID: %pI4\n",
ntohs(top->header.length), top->link_type,
- inet_ntoa(top->link_id));
- vty_out(vty, " Link data: %s\n", inet_ntoa(top->link_data));
+ &top->link_id);
+ vty_out(vty, " Link data: %pI4\n", &top->link_data);
tlvh = (struct tlv_header *)((char *)(ext) + TLV_HDR_SIZE
+ EXT_TLV_LINK_SIZE);
@@ -1858,9 +1865,9 @@ static uint16_t show_vty_pref_info(struct vty *vty, struct tlv_header *ext)
vty_out(vty,
" Extended Prefix TLV: Length %u\n\tRoute Type: %u\n"
- "\tAddress Family: 0x%x\n\tFlags: 0x%x\n\tAddress: %s/%u\n",
+ "\tAddress Family: 0x%x\n\tFlags: 0x%x\n\tAddress: %pI4/%u\n",
ntohs(top->header.length), top->route_type, top->af, top->flags,
- inet_ntoa(top->address), top->pref_length);
+ &top->address, top->pref_length);
tlvh = (struct tlv_header *)((char *)(ext) + TLV_HDR_SIZE
+ EXT_TLV_PREFIX_SIZE);