aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c96
1 files changed, 48 insertions, 48 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index c3b20d63921f..6814c8722fa7 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -599,17 +599,17 @@ do { \
599 599
600static struct rt6_info *ip6_pol_route_lookup(struct net *net, 600static struct rt6_info *ip6_pol_route_lookup(struct net *net,
601 struct fib6_table *table, 601 struct fib6_table *table,
602 struct flowi *fl, int flags) 602 struct flowi6 *fl6, int flags)
603{ 603{
604 struct fib6_node *fn; 604 struct fib6_node *fn;
605 struct rt6_info *rt; 605 struct rt6_info *rt;
606 606
607 read_lock_bh(&table->tb6_lock); 607 read_lock_bh(&table->tb6_lock);
608 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src); 608 fn = fib6_lookup(&table->tb6_root, &fl6->daddr, &fl6->saddr);
609restart: 609restart:
610 rt = fn->leaf; 610 rt = fn->leaf;
611 rt = rt6_device_match(net, rt, &fl->fl6_src, fl->flowi_oif, flags); 611 rt = rt6_device_match(net, rt, &fl6->saddr, fl6->flowi6_oif, flags);
612 BACKTRACK(net, &fl->fl6_src); 612 BACKTRACK(net, &fl6->saddr);
613out: 613out:
614 dst_use(&rt->dst, jiffies); 614 dst_use(&rt->dst, jiffies);
615 read_unlock_bh(&table->tb6_lock); 615 read_unlock_bh(&table->tb6_lock);
@@ -620,19 +620,19 @@ out:
620struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr, 620struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr,
621 const struct in6_addr *saddr, int oif, int strict) 621 const struct in6_addr *saddr, int oif, int strict)
622{ 622{
623 struct flowi fl = { 623 struct flowi6 fl6 = {
624 .flowi_oif = oif, 624 .flowi6_oif = oif,
625 .fl6_dst = *daddr, 625 .daddr = *daddr,
626 }; 626 };
627 struct dst_entry *dst; 627 struct dst_entry *dst;
628 int flags = strict ? RT6_LOOKUP_F_IFACE : 0; 628 int flags = strict ? RT6_LOOKUP_F_IFACE : 0;
629 629
630 if (saddr) { 630 if (saddr) {
631 memcpy(&fl.fl6_src, saddr, sizeof(*saddr)); 631 memcpy(&fl6.saddr, saddr, sizeof(*saddr));
632 flags |= RT6_LOOKUP_F_HAS_SADDR; 632 flags |= RT6_LOOKUP_F_HAS_SADDR;
633 } 633 }
634 634
635 dst = fib6_rule_lookup(net, &fl, flags, ip6_pol_route_lookup); 635 dst = fib6_rule_lookup(net, &fl6, flags, ip6_pol_route_lookup);
636 if (dst->error == 0) 636 if (dst->error == 0)
637 return (struct rt6_info *) dst; 637 return (struct rt6_info *) dst;
638 638
@@ -753,7 +753,7 @@ static struct rt6_info *rt6_alloc_clone(struct rt6_info *ort, struct in6_addr *d
753} 753}
754 754
755static struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, int oif, 755static struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, int oif,
756 struct flowi *fl, int flags) 756 struct flowi6 *fl6, int flags)
757{ 757{
758 struct fib6_node *fn; 758 struct fib6_node *fn;
759 struct rt6_info *rt, *nrt; 759 struct rt6_info *rt, *nrt;
@@ -768,12 +768,12 @@ relookup:
768 read_lock_bh(&table->tb6_lock); 768 read_lock_bh(&table->tb6_lock);
769 769
770restart_2: 770restart_2:
771 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src); 771 fn = fib6_lookup(&table->tb6_root, &fl6->daddr, &fl6->saddr);
772 772
773restart: 773restart:
774 rt = rt6_select(fn, oif, strict | reachable); 774 rt = rt6_select(fn, oif, strict | reachable);
775 775
776 BACKTRACK(net, &fl->fl6_src); 776 BACKTRACK(net, &fl6->saddr);
777 if (rt == net->ipv6.ip6_null_entry || 777 if (rt == net->ipv6.ip6_null_entry ||
778 rt->rt6i_flags & RTF_CACHE) 778 rt->rt6i_flags & RTF_CACHE)
779 goto out; 779 goto out;
@@ -782,9 +782,9 @@ restart:
782 read_unlock_bh(&table->tb6_lock); 782 read_unlock_bh(&table->tb6_lock);
783 783
784 if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP)) 784 if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP))
785 nrt = rt6_alloc_cow(rt, &fl->fl6_dst, &fl->fl6_src); 785 nrt = rt6_alloc_cow(rt, &fl6->daddr, &fl6->saddr);
786 else if (!(rt->dst.flags & DST_HOST)) 786 else if (!(rt->dst.flags & DST_HOST))
787 nrt = rt6_alloc_clone(rt, &fl->fl6_dst); 787 nrt = rt6_alloc_clone(rt, &fl6->daddr);
788 else 788 else
789 goto out2; 789 goto out2;
790 790
@@ -823,9 +823,9 @@ out2:
823} 823}
824 824
825static struct rt6_info *ip6_pol_route_input(struct net *net, struct fib6_table *table, 825static struct rt6_info *ip6_pol_route_input(struct net *net, struct fib6_table *table,
826 struct flowi *fl, int flags) 826 struct flowi6 *fl6, int flags)
827{ 827{
828 return ip6_pol_route(net, table, fl->flowi_iif, fl, flags); 828 return ip6_pol_route(net, table, fl6->flowi6_iif, fl6, flags);
829} 829}
830 830
831void ip6_route_input(struct sk_buff *skb) 831void ip6_route_input(struct sk_buff *skb)
@@ -833,41 +833,41 @@ void ip6_route_input(struct sk_buff *skb)
833 struct ipv6hdr *iph = ipv6_hdr(skb); 833 struct ipv6hdr *iph = ipv6_hdr(skb);
834 struct net *net = dev_net(skb->dev); 834 struct net *net = dev_net(skb->dev);
835 int flags = RT6_LOOKUP_F_HAS_SADDR; 835 int flags = RT6_LOOKUP_F_HAS_SADDR;
836 struct flowi fl = { 836 struct flowi6 fl6 = {
837 .flowi_iif = skb->dev->ifindex, 837 .flowi6_iif = skb->dev->ifindex,
838 .fl6_dst = iph->daddr, 838 .daddr = iph->daddr,
839 .fl6_src = iph->saddr, 839 .saddr = iph->saddr,
840 .fl6_flowlabel = (* (__be32 *) iph)&IPV6_FLOWINFO_MASK, 840 .flowlabel = (* (__be32 *) iph)&IPV6_FLOWINFO_MASK,
841 .flowi_mark = skb->mark, 841 .flowi6_mark = skb->mark,
842 .flowi_proto = iph->nexthdr, 842 .flowi6_proto = iph->nexthdr,
843 }; 843 };
844 844
845 if (rt6_need_strict(&iph->daddr) && skb->dev->type != ARPHRD_PIMREG) 845 if (rt6_need_strict(&iph->daddr) && skb->dev->type != ARPHRD_PIMREG)
846 flags |= RT6_LOOKUP_F_IFACE; 846 flags |= RT6_LOOKUP_F_IFACE;
847 847
848 skb_dst_set(skb, fib6_rule_lookup(net, &fl, flags, ip6_pol_route_input)); 848 skb_dst_set(skb, fib6_rule_lookup(net, &fl6, flags, ip6_pol_route_input));
849} 849}
850 850
851static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table, 851static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table,
852 struct flowi *fl, int flags) 852 struct flowi6 *fl6, int flags)
853{ 853{
854 return ip6_pol_route(net, table, fl->flowi_oif, fl, flags); 854 return ip6_pol_route(net, table, fl6->flowi6_oif, fl6, flags);
855} 855}
856 856
857struct dst_entry * ip6_route_output(struct net *net, struct sock *sk, 857struct dst_entry * ip6_route_output(struct net *net, struct sock *sk,
858 struct flowi *fl) 858 struct flowi6 *fl6)
859{ 859{
860 int flags = 0; 860 int flags = 0;
861 861
862 if ((sk && sk->sk_bound_dev_if) || rt6_need_strict(&fl->fl6_dst)) 862 if ((sk && sk->sk_bound_dev_if) || rt6_need_strict(&fl6->daddr))
863 flags |= RT6_LOOKUP_F_IFACE; 863 flags |= RT6_LOOKUP_F_IFACE;
864 864
865 if (!ipv6_addr_any(&fl->fl6_src)) 865 if (!ipv6_addr_any(&fl6->saddr))
866 flags |= RT6_LOOKUP_F_HAS_SADDR; 866 flags |= RT6_LOOKUP_F_HAS_SADDR;
867 else if (sk) 867 else if (sk)
868 flags |= rt6_srcprefs2flags(inet6_sk(sk)->srcprefs); 868 flags |= rt6_srcprefs2flags(inet6_sk(sk)->srcprefs);
869 869
870 return fib6_rule_lookup(net, fl, flags, ip6_pol_route_output); 870 return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_output);
871} 871}
872 872
873EXPORT_SYMBOL(ip6_route_output); 873EXPORT_SYMBOL(ip6_route_output);
@@ -1444,16 +1444,16 @@ static int ip6_route_del(struct fib6_config *cfg)
1444 * Handle redirects 1444 * Handle redirects
1445 */ 1445 */
1446struct ip6rd_flowi { 1446struct ip6rd_flowi {
1447 struct flowi fl; 1447 struct flowi6 fl6;
1448 struct in6_addr gateway; 1448 struct in6_addr gateway;
1449}; 1449};
1450 1450
1451static struct rt6_info *__ip6_route_redirect(struct net *net, 1451static struct rt6_info *__ip6_route_redirect(struct net *net,
1452 struct fib6_table *table, 1452 struct fib6_table *table,
1453 struct flowi *fl, 1453 struct flowi6 *fl6,
1454 int flags) 1454 int flags)
1455{ 1455{
1456 struct ip6rd_flowi *rdfl = (struct ip6rd_flowi *)fl; 1456 struct ip6rd_flowi *rdfl = (struct ip6rd_flowi *)fl6;
1457 struct rt6_info *rt; 1457 struct rt6_info *rt;
1458 struct fib6_node *fn; 1458 struct fib6_node *fn;
1459 1459
@@ -1469,7 +1469,7 @@ static struct rt6_info *__ip6_route_redirect(struct net *net,
1469 */ 1469 */
1470 1470
1471 read_lock_bh(&table->tb6_lock); 1471 read_lock_bh(&table->tb6_lock);
1472 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src); 1472 fn = fib6_lookup(&table->tb6_root, &fl6->daddr, &fl6->saddr);
1473restart: 1473restart:
1474 for (rt = fn->leaf; rt; rt = rt->dst.rt6_next) { 1474 for (rt = fn->leaf; rt; rt = rt->dst.rt6_next) {
1475 /* 1475 /*
@@ -1484,7 +1484,7 @@ restart:
1484 continue; 1484 continue;
1485 if (!(rt->rt6i_flags & RTF_GATEWAY)) 1485 if (!(rt->rt6i_flags & RTF_GATEWAY))
1486 continue; 1486 continue;
1487 if (fl->flowi_oif != rt->rt6i_dev->ifindex) 1487 if (fl6->flowi6_oif != rt->rt6i_dev->ifindex)
1488 continue; 1488 continue;
1489 if (!ipv6_addr_equal(&rdfl->gateway, &rt->rt6i_gateway)) 1489 if (!ipv6_addr_equal(&rdfl->gateway, &rt->rt6i_gateway))
1490 continue; 1490 continue;
@@ -1493,7 +1493,7 @@ restart:
1493 1493
1494 if (!rt) 1494 if (!rt)
1495 rt = net->ipv6.ip6_null_entry; 1495 rt = net->ipv6.ip6_null_entry;
1496 BACKTRACK(net, &fl->fl6_src); 1496 BACKTRACK(net, &fl6->saddr);
1497out: 1497out:
1498 dst_hold(&rt->dst); 1498 dst_hold(&rt->dst);
1499 1499
@@ -1510,10 +1510,10 @@ static struct rt6_info *ip6_route_redirect(struct in6_addr *dest,
1510 int flags = RT6_LOOKUP_F_HAS_SADDR; 1510 int flags = RT6_LOOKUP_F_HAS_SADDR;
1511 struct net *net = dev_net(dev); 1511 struct net *net = dev_net(dev);
1512 struct ip6rd_flowi rdfl = { 1512 struct ip6rd_flowi rdfl = {
1513 .fl = { 1513 .fl6 = {
1514 .flowi_oif = dev->ifindex, 1514 .flowi6_oif = dev->ifindex,
1515 .fl6_dst = *dest, 1515 .daddr = *dest,
1516 .fl6_src = *src, 1516 .saddr = *src,
1517 }, 1517 },
1518 }; 1518 };
1519 1519
@@ -1522,7 +1522,7 @@ static struct rt6_info *ip6_route_redirect(struct in6_addr *dest,
1522 if (rt6_need_strict(dest)) 1522 if (rt6_need_strict(dest))
1523 flags |= RT6_LOOKUP_F_IFACE; 1523 flags |= RT6_LOOKUP_F_IFACE;
1524 1524
1525 return (struct rt6_info *)fib6_rule_lookup(net, (struct flowi *)&rdfl, 1525 return (struct rt6_info *)fib6_rule_lookup(net, &rdfl.fl6,
1526 flags, __ip6_route_redirect); 1526 flags, __ip6_route_redirect);
1527} 1527}
1528 1528
@@ -2385,7 +2385,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2385 struct rt6_info *rt; 2385 struct rt6_info *rt;
2386 struct sk_buff *skb; 2386 struct sk_buff *skb;
2387 struct rtmsg *rtm; 2387 struct rtmsg *rtm;
2388 struct flowi fl; 2388 struct flowi6 fl6;
2389 int err, iif = 0; 2389 int err, iif = 0;
2390 2390
2391 err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy); 2391 err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy);
@@ -2393,27 +2393,27 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2393 goto errout; 2393 goto errout;
2394 2394
2395 err = -EINVAL; 2395 err = -EINVAL;
2396 memset(&fl, 0, sizeof(fl)); 2396 memset(&fl6, 0, sizeof(fl6));
2397 2397
2398 if (tb[RTA_SRC]) { 2398 if (tb[RTA_SRC]) {
2399 if (nla_len(tb[RTA_SRC]) < sizeof(struct in6_addr)) 2399 if (nla_len(tb[RTA_SRC]) < sizeof(struct in6_addr))
2400 goto errout; 2400 goto errout;
2401 2401
2402 ipv6_addr_copy(&fl.fl6_src, nla_data(tb[RTA_SRC])); 2402 ipv6_addr_copy(&fl6.saddr, nla_data(tb[RTA_SRC]));
2403 } 2403 }
2404 2404
2405 if (tb[RTA_DST]) { 2405 if (tb[RTA_DST]) {
2406 if (nla_len(tb[RTA_DST]) < sizeof(struct in6_addr)) 2406 if (nla_len(tb[RTA_DST]) < sizeof(struct in6_addr))
2407 goto errout; 2407 goto errout;
2408 2408
2409 ipv6_addr_copy(&fl.fl6_dst, nla_data(tb[RTA_DST])); 2409 ipv6_addr_copy(&fl6.daddr, nla_data(tb[RTA_DST]));
2410 } 2410 }
2411 2411
2412 if (tb[RTA_IIF]) 2412 if (tb[RTA_IIF])
2413 iif = nla_get_u32(tb[RTA_IIF]); 2413 iif = nla_get_u32(tb[RTA_IIF]);
2414 2414
2415 if (tb[RTA_OIF]) 2415 if (tb[RTA_OIF])
2416 fl.flowi_oif = nla_get_u32(tb[RTA_OIF]); 2416 fl6.flowi6_oif = nla_get_u32(tb[RTA_OIF]);
2417 2417
2418 if (iif) { 2418 if (iif) {
2419 struct net_device *dev; 2419 struct net_device *dev;
@@ -2436,10 +2436,10 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2436 skb_reset_mac_header(skb); 2436 skb_reset_mac_header(skb);
2437 skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr)); 2437 skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr));
2438 2438
2439 rt = (struct rt6_info*) ip6_route_output(net, NULL, &fl); 2439 rt = (struct rt6_info*) ip6_route_output(net, NULL, &fl6);
2440 skb_dst_set(skb, &rt->dst); 2440 skb_dst_set(skb, &rt->dst);
2441 2441
2442 err = rt6_fill_node(net, skb, rt, &fl.fl6_dst, &fl.fl6_src, iif, 2442 err = rt6_fill_node(net, skb, rt, &fl6.daddr, &fl6.saddr, iif,
2443 RTM_NEWROUTE, NETLINK_CB(in_skb).pid, 2443 RTM_NEWROUTE, NETLINK_CB(in_skb).pid,
2444 nlh->nlmsg_seq, 0, 0, 0); 2444 nlh->nlmsg_seq, 0, 0, 0);
2445 if (err < 0) { 2445 if (err < 0) {