aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet/dn_rules.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2006-11-09 18:20:38 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:21:39 -0500
commit47dcf0cb1005e86d0eea780f2984b2e7490f63cd (patch)
tree1a56767a77e219fab54ab1daf34342745f6d62a8 /net/decnet/dn_rules.c
parent82e91ffef60e6eba9848fe149ce1eecd2b5aef12 (diff)
[NET]: Rethink mark field in struct flowi
Now that all protocols have been made aware of the mark field it can be moved out of the union thus simplyfing its usage. The config options in the IPv4/IPv6/DECnet subsystems to enable respectively disable mark based routing only obfuscate the code with ifdefs, the cost for the additional comparison in the flow key is insignificant, and most distributions have all these options enabled by default anyway. Therefore it makes sense to remove the config options and enable mark based routing by default. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/decnet/dn_rules.c')
-rw-r--r--net/decnet/dn_rules.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index 590e0a72495c..a09c09f5572d 100644
--- a/net/decnet/dn_rules.c
+++ b/net/decnet/dn_rules.c
@@ -45,10 +45,8 @@ struct dn_fib_rule
45 __le16 dstmask; 45 __le16 dstmask;
46 __le16 srcmap; 46 __le16 srcmap;
47 u8 flags; 47 u8 flags;
48#ifdef CONFIG_DECNET_ROUTE_FWMARK
49 u32 fwmark; 48 u32 fwmark;
50 u32 fwmask; 49 u32 fwmask;
51#endif
52}; 50};
53 51
54static struct dn_fib_rule default_rule = { 52static struct dn_fib_rule default_rule = {
@@ -131,10 +129,8 @@ static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
131 ((daddr ^ r->dst) & r->dstmask)) 129 ((daddr ^ r->dst) & r->dstmask))
132 return 0; 130 return 0;
133 131
134#ifdef CONFIG_DECNET_ROUTE_FWMARK 132 if ((r->fwmark ^ fl->mark) & r->fwmask)
135 if ((r->fwmark ^ fl->fld_fwmark) & r->fwmask)
136 return 0; 133 return 0;
137#endif
138 134
139 return 1; 135 return 1;
140} 136}
@@ -169,7 +165,6 @@ static int dn_fib_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
169 if (tb[FRA_DST]) 165 if (tb[FRA_DST])
170 r->dst = nla_get_u16(tb[FRA_DST]); 166 r->dst = nla_get_u16(tb[FRA_DST]);
171 167
172#ifdef CONFIG_DECNET_ROUTE_FWMARK
173 if (tb[FRA_FWMARK]) { 168 if (tb[FRA_FWMARK]) {
174 r->fwmark = nla_get_u32(tb[FRA_FWMARK]); 169 r->fwmark = nla_get_u32(tb[FRA_FWMARK]);
175 if (r->fwmark) 170 if (r->fwmark)
@@ -181,7 +176,6 @@ static int dn_fib_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
181 176
182 if (tb[FRA_FWMASK]) 177 if (tb[FRA_FWMASK])
183 r->fwmask = nla_get_u32(tb[FRA_FWMASK]); 178 r->fwmask = nla_get_u32(tb[FRA_FWMASK]);
184#endif
185 179
186 r->src_len = frh->src_len; 180 r->src_len = frh->src_len;
187 r->srcmask = dnet_make_mask(r->src_len); 181 r->srcmask = dnet_make_mask(r->src_len);
@@ -203,13 +197,11 @@ static int dn_fib_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
203 if (frh->dst_len && (r->dst_len != frh->dst_len)) 197 if (frh->dst_len && (r->dst_len != frh->dst_len))
204 return 0; 198 return 0;
205 199
206#ifdef CONFIG_DECNET_ROUTE_FWMARK
207 if (tb[FRA_FWMARK] && (r->fwmark != nla_get_u32(tb[FRA_FWMARK]))) 200 if (tb[FRA_FWMARK] && (r->fwmark != nla_get_u32(tb[FRA_FWMARK])))
208 return 0; 201 return 0;
209 202
210 if (tb[FRA_FWMASK] && (r->fwmask != nla_get_u32(tb[FRA_FWMASK]))) 203 if (tb[FRA_FWMASK] && (r->fwmask != nla_get_u32(tb[FRA_FWMASK])))
211 return 0; 204 return 0;
212#endif
213 205
214 if (tb[FRA_SRC] && (r->src != nla_get_u16(tb[FRA_SRC]))) 206 if (tb[FRA_SRC] && (r->src != nla_get_u16(tb[FRA_SRC])))
215 return 0; 207 return 0;
@@ -248,12 +240,10 @@ static int dn_fib_rule_fill(struct fib_rule *rule, struct sk_buff *skb,
248 frh->src_len = r->src_len; 240 frh->src_len = r->src_len;
249 frh->tos = 0; 241 frh->tos = 0;
250 242
251#ifdef CONFIG_DECNET_ROUTE_FWMARK
252 if (r->fwmark) 243 if (r->fwmark)
253 NLA_PUT_U32(skb, FRA_FWMARK, r->fwmark); 244 NLA_PUT_U32(skb, FRA_FWMARK, r->fwmark);
254 if (r->fwmask || r->fwmark) 245 if (r->fwmask || r->fwmark)
255 NLA_PUT_U32(skb, FRA_FWMASK, r->fwmask); 246 NLA_PUT_U32(skb, FRA_FWMASK, r->fwmask);
256#endif
257 if (r->dst_len) 247 if (r->dst_len)
258 NLA_PUT_U16(skb, FRA_DST, r->dst); 248 NLA_PUT_U16(skb, FRA_DST, r->dst);
259 if (r->src_len) 249 if (r->src_len)