diff options
Diffstat (limited to 'net/ipv6/fib6_rules.c')
-rw-r--r-- | net/ipv6/fib6_rules.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index 1896ecb52899..89bea64eee1c 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c | |||
@@ -25,10 +25,8 @@ struct fib6_rule | |||
25 | struct fib_rule common; | 25 | struct fib_rule common; |
26 | struct rt6key src; | 26 | struct rt6key src; |
27 | struct rt6key dst; | 27 | struct rt6key dst; |
28 | #ifdef CONFIG_IPV6_ROUTE_FWMARK | ||
29 | u32 fwmark; | 28 | u32 fwmark; |
30 | u32 fwmask; | 29 | u32 fwmask; |
31 | #endif | ||
32 | u8 tclass; | 30 | u8 tclass; |
33 | }; | 31 | }; |
34 | 32 | ||
@@ -130,10 +128,8 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) | |||
130 | if (r->tclass && r->tclass != ((ntohl(fl->fl6_flowlabel) >> 20) & 0xff)) | 128 | if (r->tclass && r->tclass != ((ntohl(fl->fl6_flowlabel) >> 20) & 0xff)) |
131 | return 0; | 129 | return 0; |
132 | 130 | ||
133 | #ifdef CONFIG_IPV6_ROUTE_FWMARK | 131 | if ((r->fwmark ^ fl->mark) & r->fwmask) |
134 | if ((r->fwmark ^ fl->fl6_fwmark) & r->fwmask) | ||
135 | return 0; | 132 | return 0; |
136 | #endif | ||
137 | 133 | ||
138 | return 1; | 134 | return 1; |
139 | } | 135 | } |
@@ -177,7 +173,6 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb, | |||
177 | nla_memcpy(&rule6->dst.addr, tb[FRA_DST], | 173 | nla_memcpy(&rule6->dst.addr, tb[FRA_DST], |
178 | sizeof(struct in6_addr)); | 174 | sizeof(struct in6_addr)); |
179 | 175 | ||
180 | #ifdef CONFIG_IPV6_ROUTE_FWMARK | ||
181 | if (tb[FRA_FWMARK]) { | 176 | if (tb[FRA_FWMARK]) { |
182 | rule6->fwmark = nla_get_u32(tb[FRA_FWMARK]); | 177 | rule6->fwmark = nla_get_u32(tb[FRA_FWMARK]); |
183 | if (rule6->fwmark) { | 178 | if (rule6->fwmark) { |
@@ -192,7 +187,6 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb, | |||
192 | 187 | ||
193 | if (tb[FRA_FWMASK]) | 188 | if (tb[FRA_FWMASK]) |
194 | rule6->fwmask = nla_get_u32(tb[FRA_FWMASK]); | 189 | rule6->fwmask = nla_get_u32(tb[FRA_FWMASK]); |
195 | #endif | ||
196 | 190 | ||
197 | rule6->src.plen = frh->src_len; | 191 | rule6->src.plen = frh->src_len; |
198 | rule6->dst.plen = frh->dst_len; | 192 | rule6->dst.plen = frh->dst_len; |
@@ -225,13 +219,11 @@ static int fib6_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh, | |||
225 | nla_memcmp(tb[FRA_DST], &rule6->dst.addr, sizeof(struct in6_addr))) | 219 | nla_memcmp(tb[FRA_DST], &rule6->dst.addr, sizeof(struct in6_addr))) |
226 | return 0; | 220 | return 0; |
227 | 221 | ||
228 | #ifdef CONFIG_IPV6_ROUTE_FWMARK | ||
229 | if (tb[FRA_FWMARK] && (rule6->fwmark != nla_get_u32(tb[FRA_FWMARK]))) | 222 | if (tb[FRA_FWMARK] && (rule6->fwmark != nla_get_u32(tb[FRA_FWMARK]))) |
230 | return 0; | 223 | return 0; |
231 | 224 | ||
232 | if (tb[FRA_FWMASK] && (rule6->fwmask != nla_get_u32(tb[FRA_FWMASK]))) | 225 | if (tb[FRA_FWMASK] && (rule6->fwmask != nla_get_u32(tb[FRA_FWMASK]))) |
233 | return 0; | 226 | return 0; |
234 | #endif | ||
235 | 227 | ||
236 | return 1; | 228 | return 1; |
237 | } | 229 | } |
@@ -254,13 +246,11 @@ static int fib6_rule_fill(struct fib_rule *rule, struct sk_buff *skb, | |||
254 | NLA_PUT(skb, FRA_SRC, sizeof(struct in6_addr), | 246 | NLA_PUT(skb, FRA_SRC, sizeof(struct in6_addr), |
255 | &rule6->src.addr); | 247 | &rule6->src.addr); |
256 | 248 | ||
257 | #ifdef CONFIG_IPV6_ROUTE_FWMARK | ||
258 | if (rule6->fwmark) | 249 | if (rule6->fwmark) |
259 | NLA_PUT_U32(skb, FRA_FWMARK, rule6->fwmark); | 250 | NLA_PUT_U32(skb, FRA_FWMARK, rule6->fwmark); |
260 | 251 | ||
261 | if (rule6->fwmask || rule6->fwmark) | 252 | if (rule6->fwmask || rule6->fwmark) |
262 | NLA_PUT_U32(skb, FRA_FWMASK, rule6->fwmask); | 253 | NLA_PUT_U32(skb, FRA_FWMASK, rule6->fwmask); |
263 | #endif | ||
264 | 254 | ||
265 | return 0; | 255 | return 0; |
266 | 256 | ||