Commit 69ead7af authored by David S. Miller's avatar David S. Miller

ipv6: Normalize arguments to ip6_dst_blackhole().

Return a dst pointer which is potentitally error encoded.

Don't pass original dst pointer by reference, pass a struct net
instead of a socket, and elide the flow argument since it is
unnecessary.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 80c0bc9e
...@@ -520,9 +520,8 @@ extern struct dst_entry * ip6_sk_dst_lookup_flow(struct sock *sk, ...@@ -520,9 +520,8 @@ extern struct dst_entry * ip6_sk_dst_lookup_flow(struct sock *sk,
struct flowi *fl, struct flowi *fl,
const struct in6_addr *final_dst, const struct in6_addr *final_dst,
bool can_sleep); bool can_sleep);
extern int ip6_dst_blackhole(struct sock *sk, extern struct dst_entry * ip6_dst_blackhole(struct net *net,
struct dst_entry **dst, struct dst_entry *orig_dst);
struct flowi *fl);
/* /*
* skb processing functions * skb processing functions
......
...@@ -1029,7 +1029,7 @@ struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi *fl, ...@@ -1029,7 +1029,7 @@ struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi *fl,
fl->flags |= FLOWI_FLAG_CAN_SLEEP; fl->flags |= FLOWI_FLAG_CAN_SLEEP;
err = __xfrm_lookup(sock_net(sk), &dst, fl, sk, 0); err = __xfrm_lookup(sock_net(sk), &dst, fl, sk, 0);
if (err == -EREMOTE) if (err == -EREMOTE)
err = ip6_dst_blackhole(sk, &dst, fl); return ip6_dst_blackhole(sock_net(sk), dst);
if (err) if (err)
return ERR_PTR(err); return ERR_PTR(err);
} else { } else {
...@@ -1074,7 +1074,7 @@ struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi *fl, ...@@ -1074,7 +1074,7 @@ struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi *fl,
fl->flags |= FLOWI_FLAG_CAN_SLEEP; fl->flags |= FLOWI_FLAG_CAN_SLEEP;
err = __xfrm_lookup(sock_net(sk), &dst, fl, sk, 0); err = __xfrm_lookup(sock_net(sk), &dst, fl, sk, 0);
if (err == -EREMOTE) if (err == -EREMOTE)
err = ip6_dst_blackhole(sk, &dst, fl); return ip6_dst_blackhole(sock_net(sk), dst);
if (err) if (err)
return ERR_PTR(err); return ERR_PTR(err);
} else { } else {
......
...@@ -870,11 +870,10 @@ struct dst_entry * ip6_route_output(struct net *net, struct sock *sk, ...@@ -870,11 +870,10 @@ struct dst_entry * ip6_route_output(struct net *net, struct sock *sk,
EXPORT_SYMBOL(ip6_route_output); EXPORT_SYMBOL(ip6_route_output);
int ip6_dst_blackhole(struct sock *sk, struct dst_entry **dstp, struct flowi *fl) struct dst_entry *ip6_dst_blackhole(struct net *net, struct dst_entry *dst_orig)
{ {
struct rt6_info *ort = (struct rt6_info *) *dstp; struct rt6_info *rt = dst_alloc(&ip6_dst_blackhole_ops, 1);
struct rt6_info *rt = (struct rt6_info *) struct rt6_info *ort = (struct rt6_info *) dst_orig;
dst_alloc(&ip6_dst_blackhole_ops, 1);
struct dst_entry *new = NULL; struct dst_entry *new = NULL;
if (rt) { if (rt) {
...@@ -905,9 +904,8 @@ int ip6_dst_blackhole(struct sock *sk, struct dst_entry **dstp, struct flowi *fl ...@@ -905,9 +904,8 @@ int ip6_dst_blackhole(struct sock *sk, struct dst_entry **dstp, struct flowi *fl
dst_free(new); dst_free(new);
} }
dst_release(*dstp); dst_release(dst_orig);
*dstp = new; return new ? new : ERR_PTR(-ENOMEM);
return new ? 0 : -ENOMEM;
} }
EXPORT_SYMBOL_GPL(ip6_dst_blackhole); EXPORT_SYMBOL_GPL(ip6_dst_blackhole);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment