Message ID | 20180712214823.6917-1-dsahern@kernel.org |
---|---|
State | Superseded, archived |
Delegated to: | David Miller |
Headers | show |
Series | [net] net/ipv6: Do not allow device only routes via the multipath API | expand |
On Thu, 12 Jul 2018 14:48:23 -0700 dsahern@kernel.org wrote: > @@ -4388,6 +4388,13 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, > rt = NULL; > goto cleanup; > } > + if (!rt6_qualify_for_ecmp(rt)) { > + err = EINVAL; Shouldn't this be -EINVAL, just for consistency? E.g. we might return a -ENOMEM from ip6_route_info_append(), etc.
On 7/13/18 7:28 AM, Stefano Brivio wrote: > On Thu, 12 Jul 2018 14:48:23 -0700 > dsahern@kernel.org wrote: > >> @@ -4388,6 +4388,13 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, >> rt = NULL; >> goto cleanup; >> } >> + if (!rt6_qualify_for_ecmp(rt)) { >> + err = EINVAL; > > Shouldn't this be -EINVAL, just for consistency? E.g. we might return a > -ENOMEM from ip6_route_info_append(), etc. > oops, yes, missing the '-'. thanks for catching that.
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 63f99411f0de..1f1f0f318d74 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -4388,6 +4388,13 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, rt = NULL; goto cleanup; } + if (!rt6_qualify_for_ecmp(rt)) { + err = EINVAL; + NL_SET_ERR_MSG(extack, + "Device only routes can not be added for IPv6 using the multipath API."); + fib6_info_release(rt); + goto cleanup; + } rt->fib6_nh.nh_weight = rtnh->rtnh_hops + 1;