diff options
Diffstat (limited to 'net/ipv6/fib6_rules.c')
-rw-r--r-- | net/ipv6/fib6_rules.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index d829874d8946..34d244df907d 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c | |||
@@ -29,7 +29,7 @@ struct fib6_rule | |||
29 | u8 tclass; | 29 | u8 tclass; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi *fl, | 32 | struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, |
33 | int flags, pol_lookup_t lookup) | 33 | int flags, pol_lookup_t lookup) |
34 | { | 34 | { |
35 | struct fib_lookup_arg arg = { | 35 | struct fib_lookup_arg arg = { |
@@ -37,7 +37,8 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi *fl, | |||
37 | .flags = FIB_LOOKUP_NOREF, | 37 | .flags = FIB_LOOKUP_NOREF, |
38 | }; | 38 | }; |
39 | 39 | ||
40 | fib_rules_lookup(net->ipv6.fib6_rules_ops, fl, flags, &arg); | 40 | fib_rules_lookup(net->ipv6.fib6_rules_ops, |
41 | flowi6_to_flowi(fl6), flags, &arg); | ||
41 | 42 | ||
42 | if (arg.result) | 43 | if (arg.result) |
43 | return arg.result; | 44 | return arg.result; |
@@ -49,6 +50,7 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi *fl, | |||
49 | static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp, | 50 | static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp, |
50 | int flags, struct fib_lookup_arg *arg) | 51 | int flags, struct fib_lookup_arg *arg) |
51 | { | 52 | { |
53 | struct flowi6 *flp6 = &flp->u.ip6; | ||
52 | struct rt6_info *rt = NULL; | 54 | struct rt6_info *rt = NULL; |
53 | struct fib6_table *table; | 55 | struct fib6_table *table; |
54 | struct net *net = rule->fr_net; | 56 | struct net *net = rule->fr_net; |
@@ -71,7 +73,7 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp, | |||
71 | 73 | ||
72 | table = fib6_get_table(net, rule->table); | 74 | table = fib6_get_table(net, rule->table); |
73 | if (table) | 75 | if (table) |
74 | rt = lookup(net, table, flp, flags); | 76 | rt = lookup(net, table, flp6, flags); |
75 | 77 | ||
76 | if (rt != net->ipv6.ip6_null_entry) { | 78 | if (rt != net->ipv6.ip6_null_entry) { |
77 | struct fib6_rule *r = (struct fib6_rule *)rule; | 79 | struct fib6_rule *r = (struct fib6_rule *)rule; |
@@ -86,14 +88,14 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp, | |||
86 | 88 | ||
87 | if (ipv6_dev_get_saddr(net, | 89 | if (ipv6_dev_get_saddr(net, |
88 | ip6_dst_idev(&rt->dst)->dev, | 90 | ip6_dst_idev(&rt->dst)->dev, |
89 | &flp->fl6_dst, | 91 | &flp6->daddr, |
90 | rt6_flags2srcprefs(flags), | 92 | rt6_flags2srcprefs(flags), |
91 | &saddr)) | 93 | &saddr)) |
92 | goto again; | 94 | goto again; |
93 | if (!ipv6_prefix_equal(&saddr, &r->src.addr, | 95 | if (!ipv6_prefix_equal(&saddr, &r->src.addr, |
94 | r->src.plen)) | 96 | r->src.plen)) |
95 | goto again; | 97 | goto again; |
96 | ipv6_addr_copy(&flp->fl6_src, &saddr); | 98 | ipv6_addr_copy(&flp6->saddr, &saddr); |
97 | } | 99 | } |
98 | goto out; | 100 | goto out; |
99 | } | 101 | } |
@@ -113,9 +115,10 @@ out: | |||
113 | static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) | 115 | static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) |
114 | { | 116 | { |
115 | struct fib6_rule *r = (struct fib6_rule *) rule; | 117 | struct fib6_rule *r = (struct fib6_rule *) rule; |
118 | struct flowi6 *fl6 = &fl->u.ip6; | ||
116 | 119 | ||
117 | if (r->dst.plen && | 120 | if (r->dst.plen && |
118 | !ipv6_prefix_equal(&fl->fl6_dst, &r->dst.addr, r->dst.plen)) | 121 | !ipv6_prefix_equal(&fl6->daddr, &r->dst.addr, r->dst.plen)) |
119 | return 0; | 122 | return 0; |
120 | 123 | ||
121 | /* | 124 | /* |
@@ -125,14 +128,14 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) | |||
125 | */ | 128 | */ |
126 | if (r->src.plen) { | 129 | if (r->src.plen) { |
127 | if (flags & RT6_LOOKUP_F_HAS_SADDR) { | 130 | if (flags & RT6_LOOKUP_F_HAS_SADDR) { |
128 | if (!ipv6_prefix_equal(&fl->fl6_src, &r->src.addr, | 131 | if (!ipv6_prefix_equal(&fl6->saddr, &r->src.addr, |
129 | r->src.plen)) | 132 | r->src.plen)) |
130 | return 0; | 133 | return 0; |
131 | } else if (!(r->common.flags & FIB_RULE_FIND_SADDR)) | 134 | } else if (!(r->common.flags & FIB_RULE_FIND_SADDR)) |
132 | return 0; | 135 | return 0; |
133 | } | 136 | } |
134 | 137 | ||
135 | if (r->tclass && r->tclass != ((ntohl(fl->fl6_flowlabel) >> 20) & 0xff)) | 138 | if (r->tclass && r->tclass != ((ntohl(fl6->flowlabel) >> 20) & 0xff)) |
136 | return 0; | 139 | return 0; |
137 | 140 | ||
138 | return 1; | 141 | return 1; |