summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaren Schoener <karen@voltanet.io>2021-06-17 15:26:36 +0200
committerKaren Schoener <karen@voltanet.io>2021-06-28 16:32:52 +0200
commit0b4124c18cb826849f18af58dbc712db7d14b993 (patch)
tree28ff0015d6f7f93ebc5585ca867686a4513a20c9
parentMerge pull request #8932 from anlancs/fix-some-doc-warnings (diff)
downloadfrr-0b4124c18cb826849f18af58dbc712db7d14b993.tar.xz
frr-0b4124c18cb826849f18af58dbc712db7d14b993.zip
isisd, ospfd: update interface_link_params callback to check for change
Adding defensive code to the interface_link_params zebra callback to check if the link params changed before taking action. Signed-off-by: Karen Schoener <karen@voltanet.io>
-rw-r--r--isisd/isis_zebra.c5
-rw-r--r--lib/zclient.c16
-rw-r--r--lib/zclient.h3
-rw-r--r--ospfd/ospf_interface.c7
-rw-r--r--ospfd/ospf_zebra.c5
5 files changed, 30 insertions, 6 deletions
diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c
index 0142e30b2..2c05cb827 100644
--- a/isisd/isis_zebra.c
+++ b/isisd/isis_zebra.c
@@ -145,10 +145,11 @@ static int isis_zebra_if_address_del(ZAPI_CALLBACK_ARGS)
static int isis_zebra_link_params(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
+ bool changed = false;
- ifp = zebra_interface_link_params_read(zclient->ibuf, vrf_id);
+ ifp = zebra_interface_link_params_read(zclient->ibuf, vrf_id, &changed);
- if (ifp == NULL)
+ if (ifp == NULL || !changed)
return 0;
/* Update TE TLV */
diff --git a/lib/zclient.c b/lib/zclient.c
index 4a70881b5..ffae1332a 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -2269,10 +2269,13 @@ stream_failure:
}
struct interface *zebra_interface_link_params_read(struct stream *s,
- vrf_id_t vrf_id)
+ vrf_id_t vrf_id,
+ bool *changed)
{
struct if_link_params *iflp;
+ struct if_link_params iflp_copy;
ifindex_t ifindex;
+ bool params_changed = false;
STREAM_GETL(s, ifindex);
@@ -2285,12 +2288,23 @@ struct interface *zebra_interface_link_params_read(struct stream *s,
return NULL;
}
+ if (ifp->link_params == NULL)
+ params_changed = true;
+
if ((iflp = if_link_params_get(ifp)) == NULL)
return NULL;
+ memcpy(&iflp_copy, iflp, sizeof(iflp_copy));
+
if (link_params_set_value(s, iflp) != 0)
goto stream_failure;
+ if (memcmp(&iflp_copy, iflp, sizeof(iflp_copy)))
+ params_changed = true;
+
+ if (changed)
+ *changed = params_changed;
+
return ifp;
stream_failure:
diff --git a/lib/zclient.h b/lib/zclient.h
index 48de3425b..a25c5800b 100644
--- a/lib/zclient.h
+++ b/lib/zclient.h
@@ -1043,7 +1043,8 @@ extern struct interface *zebra_interface_vrf_update_read(struct stream *s,
extern int zebra_router_id_update_read(struct stream *s, struct prefix *rid);
extern struct interface *zebra_interface_link_params_read(struct stream *s,
- vrf_id_t vrf_id);
+ vrf_id_t vrf_id,
+ bool *changed);
extern size_t zebra_interface_link_params_write(struct stream *,
struct interface *);
extern enum zclient_send_status
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index b4e318d1d..b3aba247d 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -50,6 +50,7 @@
#include "ospfd/ospf_dump.h"
#include "ospfd/ospf_ldp_sync.h"
#include "ospfd/ospf_route.h"
+#include "ospfd/ospf_te.h"
DEFINE_QOBJ_TYPE(ospf_interface);
DEFINE_HOOK(ospf_vl_add, (struct ospf_vl_data * vd), (vd));
@@ -1354,6 +1355,9 @@ static int ospf_ifp_create(struct interface *ifp)
ospf_if_update(ospf, ifp);
+ if (HAS_LINK_PARAMS(ifp))
+ ospf_mpls_te_update_if(ifp);
+
hook_call(ospf_if_update, ifp);
return 0;
@@ -1392,6 +1396,9 @@ static int ospf_ifp_up(struct interface *ifp)
ospf_if_up(oi);
}
+ if (HAS_LINK_PARAMS(ifp))
+ ospf_mpls_te_update_if(ifp);
+
return 0;
}
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 5853b506f..df112edc6 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -163,10 +163,11 @@ static int ospf_interface_address_delete(ZAPI_CALLBACK_ARGS)
static int ospf_interface_link_params(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
+ bool changed = false;
- ifp = zebra_interface_link_params_read(zclient->ibuf, vrf_id);
+ ifp = zebra_interface_link_params_read(zclient->ibuf, vrf_id, &changed);
- if (ifp == NULL)
+ if (ifp == NULL || !changed)
return 0;
/* Update TE TLV */