diff options
-rw-r--r-- | include/net/ip6_route.h | 2 | ||||
-rw-r--r-- | net/ipv6/route.c | 27 |
2 files changed, 29 insertions, 0 deletions
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 5cedbd7688c6..693940565d8a 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
@@ -139,6 +139,8 @@ extern void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, | |||
139 | int oif, u32 mark); | 139 | int oif, u32 mark); |
140 | extern void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, | 140 | extern void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, |
141 | __be32 mtu); | 141 | __be32 mtu); |
142 | extern void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark); | ||
143 | extern void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk); | ||
142 | 144 | ||
143 | struct netlink_callback; | 145 | struct netlink_callback; |
144 | 146 | ||
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 545b1526c143..f52cf83bb1e0 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1114,6 +1114,33 @@ void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, __be32 mtu) | |||
1114 | } | 1114 | } |
1115 | EXPORT_SYMBOL_GPL(ip6_sk_update_pmtu); | 1115 | EXPORT_SYMBOL_GPL(ip6_sk_update_pmtu); |
1116 | 1116 | ||
1117 | void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark) | ||
1118 | { | ||
1119 | const struct ipv6hdr *iph = (struct ipv6hdr *) skb->data; | ||
1120 | struct dst_entry *dst; | ||
1121 | struct flowi6 fl6; | ||
1122 | |||
1123 | memset(&fl6, 0, sizeof(fl6)); | ||
1124 | fl6.flowi6_oif = oif; | ||
1125 | fl6.flowi6_mark = mark; | ||
1126 | fl6.flowi6_flags = 0; | ||
1127 | fl6.daddr = iph->daddr; | ||
1128 | fl6.saddr = iph->saddr; | ||
1129 | fl6.flowlabel = (*(__be32 *) iph) & IPV6_FLOWINFO_MASK; | ||
1130 | |||
1131 | dst = ip6_route_output(net, NULL, &fl6); | ||
1132 | if (!dst->error) | ||
1133 | rt6_do_redirect(dst, skb); | ||
1134 | dst_release(dst); | ||
1135 | } | ||
1136 | EXPORT_SYMBOL_GPL(ip6_redirect); | ||
1137 | |||
1138 | void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk) | ||
1139 | { | ||
1140 | ip6_redirect(skb, sock_net(sk), sk->sk_bound_dev_if, sk->sk_mark); | ||
1141 | } | ||
1142 | EXPORT_SYMBOL_GPL(ip6_sk_redirect); | ||
1143 | |||
1117 | static unsigned int ip6_default_advmss(const struct dst_entry *dst) | 1144 | static unsigned int ip6_default_advmss(const struct dst_entry *dst) |
1118 | { | 1145 | { |
1119 | struct net_device *dev = dst->dev; | 1146 | struct net_device *dev = dst->dev; |