[PATCH] add missing checks for ROUTE_ATTR_MULTIPATH
Daniel Walter
sahne at 0x90.at
Tue Mar 22 05:45:41 EDT 2011
Hi,
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
regards,
daniel
diff --git a/lib/route/route_obj.c b/lib/route/route_obj.c
index 2cbe2ae..1ad58c9 100644
--- a/lib/route/route_obj.c
+++ b/lib/route/route_obj.c
@@ -687,18 +687,24 @@ 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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20110322/cab5214a/attachment.sig>
More information about the libnl
mailing list