summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLoïc Touraine <ltouraine@envivio.com>2012-08-29 12:14:01 +0200
committerThomas Graf <tgraf@redhat.com>2012-08-29 12:14:59 +0200
commit97d2460fabaabffce0d224bdd24c0bdfee57dbf1 (patch)
treeb440a3fb33a6a9d8fc8d38613cebd0e935d3137e /lib
parent376a0e29c720add10064b9caa51d8b854b936c48 (diff)
downloadlibnl-97d2460fabaabffce0d224bdd24c0bdfee57dbf1.tar.gz
route_clone : fix segmentation fault using nl_cache_subset to filter routes
reset the nb nhops to 0 (dst->rt_nr_nh = 0) before setting the dst->nhops from the src->nhops
Diffstat (limited to 'lib')
-rw-r--r--lib/route/route_obj.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/route/route_obj.c b/lib/route/route_obj.c
index 40a157e..62669a9 100644
--- a/lib/route/route_obj.c
+++ b/lib/route/route_obj.c
@@ -110,6 +110,9 @@ static int route_clone(struct nl_object *_dst, struct nl_object *_src)
if (!(dst->rt_pref_src = nl_addr_clone(src->rt_pref_src)))
return -NLE_NOMEM;
+ /* Will be inc'ed again while adding the nexthops of the source */
+ dst->rt_nr_nh = 0;
+
nl_init_list_head(&dst->rt_nexthops);
nl_list_for_each_entry(nh, &src->rt_nexthops, rtnh_list) {
new = rtnl_route_nh_clone(nh);