aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_rules.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2006-11-09 18:22:18 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:21:41 -0500
commitb8964ed9fa727109c9084abc807652ebfb681c18 (patch)
tree03d0c7ffb21fcba9a538c445e0fb563e392491a2 /net/ipv4/fib_rules.c
parent5f300893fdd3b6e30a226c9a848eaa39b99a6431 (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/ipv4/fib_rules.c')
-rw-r--r--net/ipv4/fib_rules.c29
1 files changed, 0 insertions, 29 deletions
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index de8d5dd7099b..d2a190a35d65 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -44,8 +44,6 @@ struct fib4_rule
44 __be32 srcmask; 44 __be32 srcmask;
45 __be32 dst; 45 __be32 dst;
46 __be32 dstmask; 46 __be32 dstmask;
47 u32 fwmark;
48 u32 fwmask;
49#ifdef CONFIG_NET_CLS_ROUTE 47#ifdef CONFIG_NET_CLS_ROUTE
50 u32 tclassid; 48 u32 tclassid;
51#endif 49#endif
@@ -158,9 +156,6 @@ static int fib4_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
158 if (r->tos && (r->tos != fl->fl4_tos)) 156 if (r->tos && (r->tos != fl->fl4_tos))
159 return 0; 157 return 0;
160 158
161 if ((r->fwmark ^ fl->mark) & r->fwmask)
162 return 0;
163
164 return 1; 159 return 1;
165} 160}
166 161
@@ -216,18 +211,6 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
216 if (tb[FRA_DST]) 211 if (tb[FRA_DST])
217 rule4->dst = nla_get_be32(tb[FRA_DST]); 212 rule4->dst = nla_get_be32(tb[FRA_DST]);
218 213
219 if (tb[FRA_FWMARK]) {
220 rule4->fwmark = nla_get_u32(tb[FRA_FWMARK]);
221 if (rule4->fwmark)
222 /* compatibility: if the mark value is non-zero all bits
223 * are compared unless a mask is explicitly specified.
224 */
225 rule4->fwmask = 0xFFFFFFFF;
226 }
227
228 if (tb[FRA_FWMASK])
229 rule4->fwmask = nla_get_u32(tb[FRA_FWMASK]);
230
231#ifdef CONFIG_NET_CLS_ROUTE 214#ifdef CONFIG_NET_CLS_ROUTE
232 if (tb[FRA_FLOW]) 215 if (tb[FRA_FLOW])
233 rule4->tclassid = nla_get_u32(tb[FRA_FLOW]); 216 rule4->tclassid = nla_get_u32(tb[FRA_FLOW]);
@@ -258,12 +241,6 @@ static int fib4_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
258 if (frh->tos && (rule4->tos != frh->tos)) 241 if (frh->tos && (rule4->tos != frh->tos))
259 return 0; 242 return 0;
260 243
261 if (tb[FRA_FWMARK] && (rule4->fwmark != nla_get_u32(tb[FRA_FWMARK])))
262 return 0;
263
264 if (tb[FRA_FWMASK] && (rule4->fwmask != nla_get_u32(tb[FRA_FWMASK])))
265 return 0;
266
267#ifdef CONFIG_NET_CLS_ROUTE 244#ifdef CONFIG_NET_CLS_ROUTE
268 if (tb[FRA_FLOW] && (rule4->tclassid != nla_get_u32(tb[FRA_FLOW]))) 245 if (tb[FRA_FLOW] && (rule4->tclassid != nla_get_u32(tb[FRA_FLOW])))
269 return 0; 246 return 0;
@@ -288,12 +265,6 @@ static int fib4_rule_fill(struct fib_rule *rule, struct sk_buff *skb,
288 frh->src_len = rule4->src_len; 265 frh->src_len = rule4->src_len;
289 frh->tos = rule4->tos; 266 frh->tos = rule4->tos;
290 267
291 if (rule4->fwmark)
292 NLA_PUT_U32(skb, FRA_FWMARK, rule4->fwmark);
293
294 if (rule4->fwmask || rule4->fwmark)
295 NLA_PUT_U32(skb, FRA_FWMASK, rule4->fwmask);
296
297 if (rule4->dst_len) 268 if (rule4->dst_len)
298 NLA_PUT_BE32(skb, FRA_DST, rule4->dst); 269 NLA_PUT_BE32(skb, FRA_DST, rule4->dst);
299 270