ipv6: Use icmpv6_notify() to propagate redirect, instead of rt6_redirect().
authorDavid S. Miller <davem@davemloft.net>
Thu, 12 Jul 2012 07:33:37 +0000 (00:33 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 12 Jul 2012 07:33:37 +0000 (00:33 -0700)
And delete rt6_redirect(), since it is no longer used.

Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ip6_route.h
include/net/ipv6.h
net/ipv6/icmp.c
net/ipv6/ndisc.c
net/ipv6/route.c

index 693940565d8ab7166b8f70101bfa569328ee068c..b6b6f7d6f3c06cd67920027ee9d4477081f6a111 100644 (file)
@@ -133,8 +133,6 @@ extern int                  rt6_route_rcv(struct net_device *dev,
                                              u8 *opt, int len,
                                              const struct in6_addr *gwaddr);
 
-extern void                    rt6_redirect(struct sk_buff *skb);
-
 extern void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu,
                            int oif, u32 mark);
 extern void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk,
index d4261d4d6c47ae091328b9dfb5cad8aa61f1090f..f695f39e8926eb2e81cfad75263c683f11f690f5 100644 (file)
@@ -251,6 +251,8 @@ static inline void fl6_sock_release(struct ip6_flowlabel *fl)
                atomic_dec(&fl->users);
 }
 
+extern void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info);
+
 extern int                     ip6_ra_control(struct sock *sk, int sel);
 
 extern int                     ipv6_parse_hopopts(struct sk_buff *skb);
index a113f7d7e938ba1fe795d53c198068e8602416c6..24d69dbca4d68e2f1d1444796cb3d5c33b0a1fe2 100644 (file)
@@ -598,7 +598,7 @@ out:
        icmpv6_xmit_unlock(sk);
 }
 
-static void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info)
+void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info)
 {
        const struct inet6_protocol *ipprot;
        int inner_offset;
index b8d53e186a78e76f5d2bf5e2648430a2f5fc8c1a..ff36194a71aa7dd0fe0f707cff80afd83e40102e 100644 (file)
@@ -1350,7 +1350,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
                return;
        }
 
-       rt6_redirect(skb);
+       icmpv6_notify(skb, NDISC_REDIRECT, 0, 0);
 }
 
 void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
index f52cf83bb1e01d3554a73a2480dd278401be3cc3..7296af144d6cd961e383b9116dd29699e8b28e3b 100644 (file)
@@ -1633,92 +1633,6 @@ static int ip6_route_del(struct fib6_config *cfg)
        return err;
 }
 
-/*
- *     Handle redirects
- */
-struct ip6rd_flowi {
-       struct flowi6 fl6;
-       struct in6_addr gateway;
-};
-
-static struct rt6_info *__ip6_route_redirect(struct net *net,
-                                            struct fib6_table *table,
-                                            struct flowi6 *fl6,
-                                            int flags)
-{
-       struct ip6rd_flowi *rdfl = (struct ip6rd_flowi *)fl6;
-       struct rt6_info *rt;
-       struct fib6_node *fn;
-
-       /*
-        * Get the "current" route for this destination and
-        * check if the redirect has come from approriate router.
-        *
-        * RFC 2461 specifies that redirects should only be
-        * accepted if they come from the nexthop to the target.
-        * Due to the way the routes are chosen, this notion
-        * is a bit fuzzy and one might need to check all possible
-        * routes.
-        */
-
-       read_lock_bh(&table->tb6_lock);
-       fn = fib6_lookup(&table->tb6_root, &fl6->daddr, &fl6->saddr);
-restart:
-       for (rt = fn->leaf; rt; rt = rt->dst.rt6_next) {
-               /*
-                * Current route is on-link; redirect is always invalid.
-                *
-                * Seems, previous statement is not true. It could
-                * be node, which looks for us as on-link (f.e. proxy ndisc)
-                * But then router serving it might decide, that we should
-                * know truth 8)8) --ANK (980726).
-                */
-               if (rt6_check_expired(rt))
-                       continue;
-               if (!(rt->rt6i_flags & RTF_GATEWAY))
-                       continue;
-               if (fl6->flowi6_oif != rt->dst.dev->ifindex)
-                       continue;
-               if (!ipv6_addr_equal(&rdfl->gateway, &rt->rt6i_gateway))
-                       continue;
-               break;
-       }
-
-       if (!rt)
-               rt = net->ipv6.ip6_null_entry;
-       BACKTRACK(net, &fl6->saddr);
-out:
-       dst_hold(&rt->dst);
-
-       read_unlock_bh(&table->tb6_lock);
-
-       return rt;
-};
-
-static struct rt6_info *ip6_route_redirect(const struct in6_addr *dest,
-                                          const struct in6_addr *src,
-                                          const struct in6_addr *gateway,
-                                          struct net_device *dev)
-{
-       int flags = RT6_LOOKUP_F_HAS_SADDR;
-       struct net *net = dev_net(dev);
-       struct ip6rd_flowi rdfl = {
-               .fl6 = {
-                       .flowi6_oif = dev->ifindex,
-                       .daddr = *dest,
-                       .saddr = *src,
-               },
-       };
-
-       rdfl.gateway = *gateway;
-
-       if (rt6_need_strict(dest))
-               flags |= RT6_LOOKUP_F_IFACE;
-
-       return (struct rt6_info *)fib6_rule_lookup(net, &rdfl.fl6,
-                                                  flags, __ip6_route_redirect);
-}
-
 static void rt6_do_redirect(struct dst_entry *dst, struct sk_buff *skb)
 {
        struct net *net = dev_net(skb->dev);
@@ -1848,27 +1762,6 @@ out:
        neigh_release(neigh);
 }
 
-void rt6_redirect(struct sk_buff *skb)
-{
-       const struct in6_addr *target;
-       const struct in6_addr *dest;
-       const struct in6_addr *src;
-       const struct in6_addr *saddr;
-       struct icmp6hdr *icmph;
-       struct rt6_info *rt;
-
-       icmph = icmp6_hdr(skb);
-       target = (const struct in6_addr *) (icmph + 1);
-       dest = target + 1;
-
-       src = &ipv6_hdr(skb)->daddr;
-       saddr = &ipv6_hdr(skb)->saddr;
-
-       rt = ip6_route_redirect(dest, src, saddr, skb->dev);
-       rt6_do_redirect(&rt->dst, skb);
-       dst_release(&rt->dst);
-}
-
 /*
  *     Misc support functions
  */