diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-01 17:59:04 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-01 17:59:04 -0500 |
commit | 2774c131b1d19920b4587db1cfbd6f0750ad1f15 (patch) | |
tree | 3a0482c727cf4dcc046a211214f12459dcba8271 /net/ipv6/ip6_output.c | |
parent | 69ead7afdf6028184f713a77376ee26f8aaafdcd (diff) |
xfrm: Handle blackhole route creation via afinfo.
That way we don't have to potentially do this in every xfrm_lookup()
caller.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_output.c')
-rw-r--r-- | net/ipv6/ip6_output.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index ac16f3b2a029..35a4ad90a0f5 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -1025,18 +1025,12 @@ struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi *fl, | |||
1025 | return ERR_PTR(err); | 1025 | return ERR_PTR(err); |
1026 | if (final_dst) | 1026 | if (final_dst) |
1027 | ipv6_addr_copy(&fl->fl6_dst, final_dst); | 1027 | ipv6_addr_copy(&fl->fl6_dst, final_dst); |
1028 | if (can_sleep) { | 1028 | if (can_sleep) |
1029 | fl->flags |= FLOWI_FLAG_CAN_SLEEP; | 1029 | fl->flags |= FLOWI_FLAG_CAN_SLEEP; |
1030 | err = __xfrm_lookup(sock_net(sk), &dst, fl, sk, 0); | 1030 | |
1031 | if (err == -EREMOTE) | 1031 | err = xfrm_lookup(sock_net(sk), &dst, fl, sk, 0); |
1032 | return ip6_dst_blackhole(sock_net(sk), dst); | 1032 | if (err) |
1033 | if (err) | 1033 | return ERR_PTR(err); |
1034 | return ERR_PTR(err); | ||
1035 | } else { | ||
1036 | err = xfrm_lookup(sock_net(sk), &dst, fl, sk, 0); | ||
1037 | if (err) | ||
1038 | return ERR_PTR(err); | ||
1039 | } | ||
1040 | return dst; | 1034 | return dst; |
1041 | } | 1035 | } |
1042 | EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow); | 1036 | EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow); |
@@ -1070,18 +1064,12 @@ struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi *fl, | |||
1070 | return ERR_PTR(err); | 1064 | return ERR_PTR(err); |
1071 | if (final_dst) | 1065 | if (final_dst) |
1072 | ipv6_addr_copy(&fl->fl6_dst, final_dst); | 1066 | ipv6_addr_copy(&fl->fl6_dst, final_dst); |
1073 | if (can_sleep) { | 1067 | if (can_sleep) |
1074 | fl->flags |= FLOWI_FLAG_CAN_SLEEP; | 1068 | fl->flags |= FLOWI_FLAG_CAN_SLEEP; |
1075 | err = __xfrm_lookup(sock_net(sk), &dst, fl, sk, 0); | 1069 | |
1076 | if (err == -EREMOTE) | 1070 | err = xfrm_lookup(sock_net(sk), &dst, fl, sk, 0); |
1077 | return ip6_dst_blackhole(sock_net(sk), dst); | 1071 | if (err) |
1078 | if (err) | 1072 | return ERR_PTR(err); |
1079 | return ERR_PTR(err); | ||
1080 | } else { | ||
1081 | err = xfrm_lookup(sock_net(sk), &dst, fl, sk, 0); | ||
1082 | if (err) | ||
1083 | return ERR_PTR(err); | ||
1084 | } | ||
1085 | return dst; | 1073 | return dst; |
1086 | } | 1074 | } |
1087 | EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup_flow); | 1075 | EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup_flow); |