summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_pbr.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2019-02-08 14:48:28 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2019-03-28 16:57:59 +0100
commit3e3708cbd38a8e25c2cf8bede4ea1c86a0911dac (patch)
tree6188f8c986c62719fe858ee6dfa26122293663fa /bgpd/bgp_pbr.c
parentMerge pull request #4002 from qlyoung/doc-update-build-docs-fedora (diff)
downloadfrr-3e3708cbd38a8e25c2cf8bede4ea1c86a0911dac.tar.xz
frr-3e3708cbd38a8e25c2cf8bede4ea1c86a0911dac.zip
bgpd: do not allocate lists on fs entries of bgp entries.
bgp entries in bgp_extra_path structure will be allocated as lists, only when needed, that is to say when bgp fs entries will be received and installed on the underlying system. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_pbr.c')
-rw-r--r--bgpd/bgp_pbr.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/bgpd/bgp_pbr.c b/bgpd/bgp_pbr.c
index c0be36ed3..27208ec99 100644
--- a/bgpd/bgp_pbr.c
+++ b/bgpd/bgp_pbr.c
@@ -1421,7 +1421,8 @@ static void bgp_pbr_flush_iprule(struct bgp *bgp, struct bgp_pbr_action *bpa,
/* unlink path to bpme */
path = (struct bgp_path_info *)bpr->path;
extra = bgp_path_info_extra_get(path);
- listnode_delete(extra->bgp_fs_iprule, bpr);
+ if (extra->bgp_fs_iprule)
+ listnode_delete(extra->bgp_fs_iprule, bpr);
bpr->path = NULL;
}
}
@@ -1458,7 +1459,8 @@ static void bgp_pbr_flush_entry(struct bgp *bgp, struct bgp_pbr_action *bpa,
/* unlink path to bpme */
path = (struct bgp_path_info *)bpme->path;
extra = bgp_path_info_extra_get(path);
- listnode_delete(extra->bgp_fs_pbr, bpme);
+ if (extra->bgp_fs_pbr)
+ listnode_delete(extra->bgp_fs_pbr, bpme);
bpme->path = NULL;
}
}
@@ -2065,7 +2067,8 @@ static void bgp_pbr_policyroute_add_to_zebra_unit(struct bgp *bgp,
struct bgp_path_info_extra *extra =
bgp_path_info_extra_get(path);
- if (extra && listnode_lookup(extra->bgp_fs_iprule,
+ if (extra && extra->bgp_fs_iprule &&
+ listnode_lookup(extra->bgp_fs_iprule,
bpr)) {
if (BGP_DEBUG(pbr, PBR_ERROR))
zlog_err("%s: entry %p/%p already "
@@ -2213,7 +2216,8 @@ static void bgp_pbr_policyroute_add_to_zebra_unit(struct bgp *bgp,
struct bgp_path_info_extra *extra =
bgp_path_info_extra_get(path);
- if (extra && listnode_lookup(extra->bgp_fs_pbr, bpme)) {
+ if (extra && extra->bgp_fs_pbr &&
+ listnode_lookup(extra->bgp_fs_pbr, bpme)) {
if (BGP_DEBUG(pbr, PBR_ERROR))
zlog_err(
"%s: entry %p/%p already installed in bgp pbr",