aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/route.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r--net/ipv4/route.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 23d205043d92..e24e4cf2a112 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2675,12 +2675,10 @@ static struct dst_ops ipv4_dst_blackhole_ops = {
2675 .update_pmtu = ipv4_rt_blackhole_update_pmtu, 2675 .update_pmtu = ipv4_rt_blackhole_update_pmtu,
2676}; 2676};
2677 2677
2678 2678struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig)
2679static int ipv4_dst_blackhole(struct net *net, struct rtable **rp, struct flowi *flp)
2680{ 2679{
2681 struct rtable *ort = *rp; 2680 struct rtable *rt = dst_alloc(&ipv4_dst_blackhole_ops, 1);
2682 struct rtable *rt = (struct rtable *) 2681 struct rtable *ort = (struct rtable *) dst_orig;
2683 dst_alloc(&ipv4_dst_blackhole_ops, 1);
2684 2682
2685 if (rt) { 2683 if (rt) {
2686 struct dst_entry *new = &rt->dst; 2684 struct dst_entry *new = &rt->dst;
@@ -2714,9 +2712,9 @@ static int ipv4_dst_blackhole(struct net *net, struct rtable **rp, struct flowi
2714 dst_free(new); 2712 dst_free(new);
2715 } 2713 }
2716 2714
2717 dst_release(&(*rp)->dst); 2715 dst_release(dst_orig);
2718 *rp = rt; 2716
2719 return rt ? 0 : -ENOMEM; 2717 return rt ? &rt->dst : ERR_PTR(-ENOMEM);
2720} 2718}
2721 2719
2722int ip_route_output_flow(struct net *net, struct rtable **rp, struct flowi *flp, 2720int ip_route_output_flow(struct net *net, struct rtable **rp, struct flowi *flp,
@@ -2732,11 +2730,7 @@ int ip_route_output_flow(struct net *net, struct rtable **rp, struct flowi *flp,
2732 flp->fl4_src = (*rp)->rt_src; 2730 flp->fl4_src = (*rp)->rt_src;
2733 if (!flp->fl4_dst) 2731 if (!flp->fl4_dst)
2734 flp->fl4_dst = (*rp)->rt_dst; 2732 flp->fl4_dst = (*rp)->rt_dst;
2735 err = __xfrm_lookup(net, (struct dst_entry **)rp, flp, sk, 0); 2733 return xfrm_lookup(net, (struct dst_entry **)rp, flp, sk, 0);
2736 if (err == -EREMOTE)
2737 err = ipv4_dst_blackhole(net, rp, flp);
2738
2739 return err;
2740 } 2734 }
2741 2735
2742 return 0; 2736 return 0;