Skip to content

Commit

Permalink
Merge pull request #9173 from FRRouting/mergify/bp/stable/8.0/pr-8824
Browse files Browse the repository at this point in the history
isisd, ospfd: update interface_link_params callback to check for change (backport #8824)
  • Loading branch information
mwinter-osr authored Jul 24, 2021
2 parents a6128c9 + fd843fc commit bd08ea9
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
5 changes: 3 additions & 2 deletions isisd/isis_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
16 changes: 15 additions & 1 deletion lib/zclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -2126,10 +2126,13 @@ static int link_params_set_value(struct stream *s, struct if_link_params *iflp)
}

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);

Expand All @@ -2142,12 +2145,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:
Expand Down
3 changes: 2 additions & 1 deletion lib/zclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,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
Expand Down
7 changes: 7 additions & 0 deletions ospfd/ospf_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
5 changes: 3 additions & 2 deletions ospfd/ospf_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit bd08ea9

Please sign in to comment.