diff options
author | Thomas Graf <tgraf@suug.ch> | 2006-11-09 18:22:18 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:21:41 -0500 |
commit | b8964ed9fa727109c9084abc807652ebfb681c18 (patch) | |
tree | 03d0c7ffb21fcba9a538c445e0fb563e392491a2 /net/ipv6/fib6_rules.c | |
parent | 5f300893fdd3b6e30a226c9a848eaa39b99a6431 (diff) |
[NET] rules: Protocol independant mark selector
Move mark selector currently implemented per protocol into
the protocol independant part.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/fib6_rules.c')
-rw-r--r-- | net/ipv6/fib6_rules.c | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index 89bea64eee1c..26374cbe2bc2 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c | |||
@@ -25,8 +25,6 @@ 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 | u32 fwmark; | ||
29 | u32 fwmask; | ||
30 | u8 tclass; | 28 | u8 tclass; |
31 | }; | 29 | }; |
32 | 30 | ||
@@ -128,9 +126,6 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) | |||
128 | if (r->tclass && r->tclass != ((ntohl(fl->fl6_flowlabel) >> 20) & 0xff)) | 126 | if (r->tclass && r->tclass != ((ntohl(fl->fl6_flowlabel) >> 20) & 0xff)) |
129 | return 0; | 127 | return 0; |
130 | 128 | ||
131 | if ((r->fwmark ^ fl->mark) & r->fwmask) | ||
132 | return 0; | ||
133 | |||
134 | return 1; | 129 | return 1; |
135 | } | 130 | } |
136 | 131 | ||
@@ -173,21 +168,6 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb, | |||
173 | nla_memcpy(&rule6->dst.addr, tb[FRA_DST], | 168 | nla_memcpy(&rule6->dst.addr, tb[FRA_DST], |
174 | sizeof(struct in6_addr)); | 169 | sizeof(struct in6_addr)); |
175 | 170 | ||
176 | if (tb[FRA_FWMARK]) { | ||
177 | rule6->fwmark = nla_get_u32(tb[FRA_FWMARK]); | ||
178 | if (rule6->fwmark) { | ||
179 | /* | ||
180 | * if the mark value is non-zero, | ||
181 | * all bits are compared by default | ||
182 | * unless a mask is explicitly specified. | ||
183 | */ | ||
184 | rule6->fwmask = 0xFFFFFFFF; | ||
185 | } | ||
186 | } | ||
187 | |||
188 | if (tb[FRA_FWMASK]) | ||
189 | rule6->fwmask = nla_get_u32(tb[FRA_FWMASK]); | ||
190 | |||
191 | rule6->src.plen = frh->src_len; | 171 | rule6->src.plen = frh->src_len; |
192 | rule6->dst.plen = frh->dst_len; | 172 | rule6->dst.plen = frh->dst_len; |
193 | rule6->tclass = frh->tos; | 173 | rule6->tclass = frh->tos; |
@@ -219,12 +199,6 @@ static int fib6_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh, | |||
219 | nla_memcmp(tb[FRA_DST], &rule6->dst.addr, sizeof(struct in6_addr))) | 199 | nla_memcmp(tb[FRA_DST], &rule6->dst.addr, sizeof(struct in6_addr))) |
220 | return 0; | 200 | return 0; |
221 | 201 | ||
222 | if (tb[FRA_FWMARK] && (rule6->fwmark != nla_get_u32(tb[FRA_FWMARK]))) | ||
223 | return 0; | ||
224 | |||
225 | if (tb[FRA_FWMASK] && (rule6->fwmask != nla_get_u32(tb[FRA_FWMASK]))) | ||
226 | return 0; | ||
227 | |||
228 | return 1; | 202 | return 1; |
229 | } | 203 | } |
230 | 204 | ||
@@ -246,12 +220,6 @@ static int fib6_rule_fill(struct fib_rule *rule, struct sk_buff *skb, | |||
246 | NLA_PUT(skb, FRA_SRC, sizeof(struct in6_addr), | 220 | NLA_PUT(skb, FRA_SRC, sizeof(struct in6_addr), |
247 | &rule6->src.addr); | 221 | &rule6->src.addr); |
248 | 222 | ||
249 | if (rule6->fwmark) | ||
250 | NLA_PUT_U32(skb, FRA_FWMARK, rule6->fwmark); | ||
251 | |||
252 | if (rule6->fwmask || rule6->fwmark) | ||
253 | NLA_PUT_U32(skb, FRA_FWMASK, rule6->fwmask); | ||
254 | |||
255 | return 0; | 223 | return 0; |
256 | 224 | ||
257 | nla_put_failure: | 225 | nla_put_failure: |