summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_route.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2014-06-29 12:52:52 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2014-06-29 12:52:52 +0200
commit052573ee2319b21657a79e1b76a5c801701fa38c (patch)
tree32a731414c3b0a70516461befd9c22baf77b0587 /bgpd/bgp_route.c
parent0ff692ed59696c534e6bfd0f9d6e83706fbbec4a (diff)
parentf57000c0dbdd0e30e71b6651022392f284201e19 (diff)
downloadquagga-052573ee2319b21657a79e1b76a5c801701fa38c.tar.bz2
quagga-052573ee2319b21657a79e1b76a5c801701fa38c.tar.xz
*: merge branch stable/0.99.23
bgp extcommunity fixes from stable branch Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_route.c')
-rw-r--r--bgpd/bgp_route.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 232a6a1c..04cbb8ab 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -713,11 +713,8 @@ bgp_input_modifier (struct peer *peer, struct prefix *p, struct attr *attr,
peer->rmap_type = 0;
if (ret == RMAP_DENYMATCH)
- {
- /* Free newly generated AS path and community by route-map. */
- bgp_attr_flush (attr);
- return RMAP_DENY;
- }
+ /* caller has multiple error paths with bgp_attr_flush() */
+ return RMAP_DENY;
}
return RMAP_PERMIT;
}
@@ -2144,10 +2141,14 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr,
new_attr.extra = &new_extra;
bgp_attr_dup (&new_attr, attr);
- /* Apply incoming route-map. */
+ /* Apply incoming route-map.
+ * NB: new_attr may now contain newly allocated values from route-map "set"
+ * commands, so we need bgp_attr_flush in the error paths, until we intern
+ * the attr (which takes over the memory references) */
if (bgp_input_modifier (peer, p, &new_attr, afi, safi) == RMAP_DENY)
{
reason = "route-map;";
+ bgp_attr_flush (&new_attr);
goto filtered;
}
@@ -2161,6 +2162,7 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr,
&& ! CHECK_FLAG (peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK))
{
reason = "non-connected next-hop;";
+ bgp_attr_flush (&new_attr);
goto filtered;
}
@@ -2171,6 +2173,7 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr,
|| bgp_nexthop_self (&new_attr))
{
reason = "martian next-hop;";
+ bgp_attr_flush (&new_attr);
goto filtered;
}
}