summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_zebra.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2019-03-28 18:07:34 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2019-03-29 15:04:51 +0100
commitf5925234601488bae7e7376be8dc9e6e2dd95a6a (patch)
tree334c47a2517d64f16b992cd91dbde93df422f47d /bgpd/bgp_zebra.c
parentlib: add listnode_add_force utility routine (diff)
downloadfrr-f5925234601488bae7e7376be8dc9e6e2dd95a6a.tar.xz
frr-f5925234601488bae7e7376be8dc9e6e2dd95a6a.zip
bgpd: use listnode_add_force to force allocation of entries if needed
force allocation of entries in order to save memory and then save memory for people that do not use flowspec. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_zebra.c')
-rw-r--r--bgpd/bgp_zebra.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 5c32d3134..3d857f287 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -2156,9 +2156,8 @@ static int rule_notify_owner(int command, struct zclient *zclient,
/* link bgp_info to bgp_pbr */
path = (struct bgp_path_info *)bgp_pbr->path;
extra = bgp_path_info_extra_get(path);
- if (!extra->bgp_fs_iprule)
- extra->bgp_fs_iprule = list_new();
- listnode_add(extra->bgp_fs_iprule, bgp_pbr);
+ listnode_add_force(&extra->bgp_fs_iprule,
+ bgp_pbr);
}
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Received RULE_INSTALLED",
@@ -2266,9 +2265,7 @@ static int ipset_entry_notify_owner(int command, struct zclient *zclient,
/* link bgp_path_info to bpme */
path = (struct bgp_path_info *)bgp_pbime->path;
extra = bgp_path_info_extra_get(path);
- if (!extra->bgp_fs_pbr)
- extra->bgp_fs_pbr = list_new();
- listnode_add(extra->bgp_fs_pbr, bgp_pbime);
+ listnode_add_force(&extra->bgp_fs_pbr, bgp_pbime);
}
break;
case ZAPI_IPSET_ENTRY_FAIL_REMOVE: