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
This commit is contained in:
parent
376a0e29c7
commit
97d2460fab
1 changed files with 3 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue