ipv6: Convert to use flowi6 where applicable.
[firefly-linux-kernel-4.4.55.git] / net / ipv6 / fib6_rules.c
index d829874d8946e75e6735fd8df4c0ad6facf58bc0..34d244df907d00eb0f67a09f71a292cb30f1f2bd 100644 (file)
@@ -29,7 +29,7 @@ struct fib6_rule
        u8                      tclass;
 };
 
-struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi *fl,
+struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
                                   int flags, pol_lookup_t lookup)
 {
        struct fib_lookup_arg arg = {
@@ -37,7 +37,8 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi *fl,
                .flags = FIB_LOOKUP_NOREF,
        };
 
-       fib_rules_lookup(net->ipv6.fib6_rules_ops, fl, flags, &arg);
+       fib_rules_lookup(net->ipv6.fib6_rules_ops,
+                        flowi6_to_flowi(fl6), flags, &arg);
 
        if (arg.result)
                return arg.result;
@@ -49,6 +50,7 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi *fl,
 static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp,
                            int flags, struct fib_lookup_arg *arg)
 {
+       struct flowi6 *flp6 = &flp->u.ip6;
        struct rt6_info *rt = NULL;
        struct fib6_table *table;
        struct net *net = rule->fr_net;
@@ -71,7 +73,7 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp,
 
        table = fib6_get_table(net, rule->table);
        if (table)
-               rt = lookup(net, table, flp, flags);
+               rt = lookup(net, table, flp6, flags);
 
        if (rt != net->ipv6.ip6_null_entry) {
                struct fib6_rule *r = (struct fib6_rule *)rule;
@@ -86,14 +88,14 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp,
 
                        if (ipv6_dev_get_saddr(net,
                                               ip6_dst_idev(&rt->dst)->dev,
-                                              &flp->fl6_dst,
+                                              &flp6->daddr,
                                               rt6_flags2srcprefs(flags),
                                               &saddr))
                                goto again;
                        if (!ipv6_prefix_equal(&saddr, &r->src.addr,
                                               r->src.plen))
                                goto again;
-                       ipv6_addr_copy(&flp->fl6_src, &saddr);
+                       ipv6_addr_copy(&flp6->saddr, &saddr);
                }
                goto out;
        }
@@ -113,9 +115,10 @@ out:
 static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
 {
        struct fib6_rule *r = (struct fib6_rule *) rule;
+       struct flowi6 *fl6 = &fl->u.ip6;
 
        if (r->dst.plen &&
-           !ipv6_prefix_equal(&fl->fl6_dst, &r->dst.addr, r->dst.plen))
+           !ipv6_prefix_equal(&fl6->daddr, &r->dst.addr, r->dst.plen))
                return 0;
 
        /*
@@ -125,14 +128,14 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
         */
        if (r->src.plen) {
                if (flags & RT6_LOOKUP_F_HAS_SADDR) {
-                       if (!ipv6_prefix_equal(&fl->fl6_src, &r->src.addr,
+                       if (!ipv6_prefix_equal(&fl6->saddr, &r->src.addr,
                                               r->src.plen))
                                return 0;
                } else if (!(r->common.flags & FIB_RULE_FIND_SADDR))
                        return 0;
        }
 
-       if (r->tclass && r->tclass != ((ntohl(fl->fl6_flowlabel) >> 20) & 0xff))
+       if (r->tclass && r->tclass != ((ntohl(fl6->flowlabel) >> 20) & 0xff))
                return 0;
 
        return 1;