]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - net/ipv6/route.c
ipv6: move ip6_dst_hoplimit() into core kernel
[karo-tx-linux.git] / net / ipv6 / route.c
index e22c4db8d07aded12104ed64bafd52e95be2b963..b770085ae36d167af19dffcafe8e504c13031659 100644 (file)
@@ -1177,6 +1177,27 @@ void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark)
 }
 EXPORT_SYMBOL_GPL(ip6_redirect);
 
+void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif,
+                           u32 mark)
+{
+       const struct ipv6hdr *iph = ipv6_hdr(skb);
+       const struct rd_msg *msg = (struct rd_msg *)icmp6_hdr(skb);
+       struct dst_entry *dst;
+       struct flowi6 fl6;
+
+       memset(&fl6, 0, sizeof(fl6));
+       fl6.flowi6_oif = oif;
+       fl6.flowi6_mark = mark;
+       fl6.flowi6_flags = 0;
+       fl6.daddr = msg->dest;
+       fl6.saddr = iph->daddr;
+
+       dst = ip6_route_output(net, NULL, &fl6);
+       if (!dst->error)
+               rt6_do_redirect(dst, NULL, skb);
+       dst_release(dst);
+}
+
 void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk)
 {
        ip6_redirect(skb, sock_net(sk), sk->sk_bound_dev_if, sk->sk_mark);
@@ -1333,25 +1354,6 @@ out:
        return entries > rt_max_size;
 }
 
-int ip6_dst_hoplimit(struct dst_entry *dst)
-{
-       int hoplimit = dst_metric_raw(dst, RTAX_HOPLIMIT);
-       if (hoplimit == 0) {
-               struct net_device *dev = dst->dev;
-               struct inet6_dev *idev;
-
-               rcu_read_lock();
-               idev = __in6_dev_get(dev);
-               if (idev)
-                       hoplimit = idev->cnf.hop_limit;
-               else
-                       hoplimit = dev_net(dev)->ipv6.devconf_all->hop_limit;
-               rcu_read_unlock();
-       }
-       return hoplimit;
-}
-EXPORT_SYMBOL(ip6_dst_hoplimit);
-
 /*
  *
  */