summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
authorJorge Boncompte [DTI2] <jorge@dti2.net>2012-04-10 16:57:22 +0200
committerDavid Lamparter <equinox@diac24.net>2012-05-02 17:03:27 +0200
commit0c5ed3ed00f630ae95dc2dfd4b5a938683e2a99e (patch)
tree9e478062fed566ce245113a166a6c8d1eec9fbe2 /bgpd
parent4fe080d7ee4c924a962d14423d94b4b8d8aba110 (diff)
bgpd: Fix memory leak with 'set ip next-hop peer-address'
A route-map with the mentioned statement causes a memory leak for every prefix that matches. Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_routemap.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index f95cab13..fa645ac4 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -878,7 +878,6 @@ route_set_ip_nexthop (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
struct rmap_ip_nexthop_set *rins = rule;
- struct in_addr peer_address;
struct bgp_info *bgp_info;
struct peer *peer;
@@ -894,16 +893,14 @@ route_set_ip_nexthop (void *rule, struct prefix *prefix,
&& peer->su_remote
&& sockunion_family (peer->su_remote) == AF_INET)
{
- inet_aton (sockunion_su2str (peer->su_remote), &peer_address);
- bgp_info->attr->nexthop = peer_address;
+ bgp_info->attr->nexthop.s_addr = sockunion2ip (peer->su_remote);
bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP);
}
else if (CHECK_FLAG (peer->rmap_type, PEER_RMAP_TYPE_OUT)
&& peer->su_local
&& sockunion_family (peer->su_local) == AF_INET)
{
- inet_aton (sockunion_su2str (peer->su_local), &peer_address);
- bgp_info->attr->nexthop = peer_address;
+ bgp_info->attr->nexthop.s_addr = sockunion2ip (peer->su_local);
bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP);
}
}