add missing checks for ROUTE_ATTR_MULTIPATH
attached patch adds missing checks for ROUTE_ATTR_MULTIPATH when dealing with multipath routing. Affected functions rtnl_route_remove_nexthop rtnl_route_get_nexthops rtnl_route_get_nnexthops
This commit is contained in:
parent
c1073d6172
commit
f0603a467b
1 changed files with 12 additions and 4 deletions
|
@ -687,18 +687,26 @@ void rtnl_route_add_nexthop(struct rtnl_route *route, struct rtnl_nexthop *nh)
|
|||
|
||||
void rtnl_route_remove_nexthop(struct rtnl_route *route, struct rtnl_nexthop *nh)
|
||||
{
|
||||
route->rt_nr_nh--;
|
||||
nl_list_del(&nh->rtnh_list);
|
||||
if (route->ce_mask & ROUTE_ATTR_MULTIPATH) {
|
||||
route->rt_nr_nh--;
|
||||
nl_list_del(&nh->rtnh_list);
|
||||
}
|
||||
}
|
||||
|
||||
struct nl_list_head *rtnl_route_get_nexthops(struct rtnl_route *route)
|
||||
{
|
||||
return &route->rt_nexthops;
|
||||
if (route->ce_mask & ROUTE_ATTR_MULTIPATH)
|
||||
return &route->rt_nexthops;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int rtnl_route_get_nnexthops(struct rtnl_route *route)
|
||||
{
|
||||
return route->rt_nr_nh;
|
||||
if (route->ce_mask & ROUTE_ATTR_MULTIPATH)
|
||||
return route->rt_nr_nh;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void rtnl_route_foreach_nexthop(struct rtnl_route *r,
|
||||
|
|
Loading…
Add table
Reference in a new issue