aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet/dn_rules.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/decnet/dn_rules.c')
-rw-r--r--net/decnet/dn_rules.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index b6c98ac93dc8..17a1932216d6 100644
--- a/net/decnet/dn_rules.c
+++ b/net/decnet/dn_rules.c
@@ -31,6 +31,7 @@
31#include <net/dn_fib.h> 31#include <net/dn_fib.h>
32#include <net/dn_neigh.h> 32#include <net/dn_neigh.h>
33#include <net/dn_dev.h> 33#include <net/dn_dev.h>
34#include <net/dn_route.h>
34 35
35static struct fib_rules_ops dn_fib_rules_ops; 36static struct fib_rules_ops dn_fib_rules_ops;
36 37
@@ -109,8 +110,6 @@ errout:
109 110
110static struct nla_policy dn_fib_rule_policy[FRA_MAX+1] __read_mostly = { 111static struct nla_policy dn_fib_rule_policy[FRA_MAX+1] __read_mostly = {
111 FRA_GENERIC_POLICY, 112 FRA_GENERIC_POLICY,
112 [FRA_SRC] = { .type = NLA_U16 },
113 [FRA_DST] = { .type = NLA_U16 },
114}; 113};
115 114
116static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) 115static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
@@ -133,7 +132,7 @@ static int dn_fib_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
133 int err = -EINVAL; 132 int err = -EINVAL;
134 struct dn_fib_rule *r = (struct dn_fib_rule *)rule; 133 struct dn_fib_rule *r = (struct dn_fib_rule *)rule;
135 134
136 if (frh->src_len > 16 || frh->dst_len > 16 || frh->tos) 135 if (frh->tos)
137 goto errout; 136 goto errout;
138 137
139 if (rule->table == RT_TABLE_UNSPEC) { 138 if (rule->table == RT_TABLE_UNSPEC) {
@@ -150,10 +149,10 @@ static int dn_fib_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
150 } 149 }
151 } 150 }
152 151
153 if (tb[FRA_SRC]) 152 if (frh->src_len)
154 r->src = nla_get_le16(tb[FRA_SRC]); 153 r->src = nla_get_le16(tb[FRA_SRC]);
155 154
156 if (tb[FRA_DST]) 155 if (frh->dst_len)
157 r->dst = nla_get_le16(tb[FRA_DST]); 156 r->dst = nla_get_le16(tb[FRA_DST]);
158 157
159 r->src_len = frh->src_len; 158 r->src_len = frh->src_len;
@@ -176,10 +175,10 @@ static int dn_fib_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
176 if (frh->dst_len && (r->dst_len != frh->dst_len)) 175 if (frh->dst_len && (r->dst_len != frh->dst_len))
177 return 0; 176 return 0;
178 177
179 if (tb[FRA_SRC] && (r->src != nla_get_le16(tb[FRA_SRC]))) 178 if (frh->src_len && (r->src != nla_get_le16(tb[FRA_SRC])))
180 return 0; 179 return 0;
181 180
182 if (tb[FRA_DST] && (r->dst != nla_get_le16(tb[FRA_DST]))) 181 if (frh->dst_len && (r->dst != nla_get_le16(tb[FRA_DST])))
183 return 0; 182 return 0;
184 183
185 return 1; 184 return 1;
@@ -241,20 +240,22 @@ static u32 dn_fib_rule_default_pref(void)
241 return 0; 240 return 0;
242} 241}
243 242
244int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb) 243static void dn_fib_rule_flush_cache(void)
245{ 244{
246 return fib_rules_dump(skb, cb, AF_DECnet); 245 dn_rt_cache_flush(-1);
247} 246}
248 247
249static struct fib_rules_ops dn_fib_rules_ops = { 248static struct fib_rules_ops dn_fib_rules_ops = {
250 .family = AF_DECnet, 249 .family = AF_DECnet,
251 .rule_size = sizeof(struct dn_fib_rule), 250 .rule_size = sizeof(struct dn_fib_rule),
251 .addr_size = sizeof(u16),
252 .action = dn_fib_rule_action, 252 .action = dn_fib_rule_action,
253 .match = dn_fib_rule_match, 253 .match = dn_fib_rule_match,
254 .configure = dn_fib_rule_configure, 254 .configure = dn_fib_rule_configure,
255 .compare = dn_fib_rule_compare, 255 .compare = dn_fib_rule_compare,
256 .fill = dn_fib_rule_fill, 256 .fill = dn_fib_rule_fill,
257 .default_pref = dn_fib_rule_default_pref, 257 .default_pref = dn_fib_rule_default_pref,
258 .flush_cache = dn_fib_rule_flush_cache,
258 .nlgroup = RTNLGRP_DECnet_RULE, 259 .nlgroup = RTNLGRP_DECnet_RULE,
259 .policy = dn_fib_rule_policy, 260 .policy = dn_fib_rule_policy,
260 .rules_list = &dn_fib_rules, 261 .rules_list = &dn_fib_rules,