aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet/dn_rules.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-03-12 17:17:10 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-12 18:08:55 -0500
commitbef55aebd560c5a6f8883c421abccee39978c58c (patch)
treeb1adbe59af8817ee6ef3009fe8c296d3c87fc067 /net/decnet/dn_rules.c
parent1958b856c1a59c0f1e892b92debb8c9fe4f364dc (diff)
decnet: Convert to use flowidn where applicable.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/decnet/dn_rules.c')
-rw-r--r--net/decnet/dn_rules.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index 6eb91df3c550..f0efb0ccfeca 100644
--- a/net/decnet/dn_rules.c
+++ b/net/decnet/dn_rules.c
@@ -49,14 +49,15 @@ struct dn_fib_rule
49}; 49};
50 50
51 51
52int dn_fib_lookup(struct flowi *flp, struct dn_fib_res *res) 52int dn_fib_lookup(struct flowidn *flp, struct dn_fib_res *res)
53{ 53{
54 struct fib_lookup_arg arg = { 54 struct fib_lookup_arg arg = {
55 .result = res, 55 .result = res,
56 }; 56 };
57 int err; 57 int err;
58 58
59 err = fib_rules_lookup(dn_fib_rules_ops, flp, 0, &arg); 59 err = fib_rules_lookup(dn_fib_rules_ops,
60 flowidn_to_flowi(flp), 0, &arg);
60 res->r = arg.rule; 61 res->r = arg.rule;
61 62
62 return err; 63 return err;
@@ -65,6 +66,7 @@ int dn_fib_lookup(struct flowi *flp, struct dn_fib_res *res)
65static int dn_fib_rule_action(struct fib_rule *rule, struct flowi *flp, 66static int dn_fib_rule_action(struct fib_rule *rule, struct flowi *flp,
66 int flags, struct fib_lookup_arg *arg) 67 int flags, struct fib_lookup_arg *arg)
67{ 68{
69 struct flowidn *fld = &flp->u.dn;
68 int err = -EAGAIN; 70 int err = -EAGAIN;
69 struct dn_fib_table *tbl; 71 struct dn_fib_table *tbl;
70 72
@@ -90,7 +92,7 @@ static int dn_fib_rule_action(struct fib_rule *rule, struct flowi *flp,
90 if (tbl == NULL) 92 if (tbl == NULL)
91 goto errout; 93 goto errout;
92 94
93 err = tbl->lookup(tbl, flp, (struct dn_fib_res *)arg->result); 95 err = tbl->lookup(tbl, fld, (struct dn_fib_res *)arg->result);
94 if (err > 0) 96 if (err > 0)
95 err = -EAGAIN; 97 err = -EAGAIN;
96errout: 98errout:
@@ -104,8 +106,9 @@ static const struct nla_policy dn_fib_rule_policy[FRA_MAX+1] = {
104static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) 106static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
105{ 107{
106 struct dn_fib_rule *r = (struct dn_fib_rule *)rule; 108 struct dn_fib_rule *r = (struct dn_fib_rule *)rule;
107 __le16 daddr = fl->fld_dst; 109 struct flowidn *fld = &fl->u.dn;
108 __le16 saddr = fl->fld_src; 110 __le16 daddr = fld->daddr;
111 __le16 saddr = fld->saddr;
109 112
110 if (((saddr ^ r->src) & r->srcmask) || 113 if (((saddr ^ r->src) & r->srcmask) ||
111 ((daddr ^ r->dst) & r->dstmask)) 114 ((daddr ^ r->dst) & r->dstmask))
@@ -175,7 +178,7 @@ static int dn_fib_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
175 178
176unsigned dnet_addr_type(__le16 addr) 179unsigned dnet_addr_type(__le16 addr)
177{ 180{
178 struct flowi fl = { .fld_dst = addr }; 181 struct flowidn fld = { .daddr = addr };
179 struct dn_fib_res res; 182 struct dn_fib_res res;
180 unsigned ret = RTN_UNICAST; 183 unsigned ret = RTN_UNICAST;
181 struct dn_fib_table *tb = dn_fib_get_table(RT_TABLE_LOCAL, 0); 184 struct dn_fib_table *tb = dn_fib_get_table(RT_TABLE_LOCAL, 0);
@@ -183,7 +186,7 @@ unsigned dnet_addr_type(__le16 addr)
183 res.r = NULL; 186 res.r = NULL;
184 187
185 if (tb) { 188 if (tb) {
186 if (!tb->lookup(tb, &fl, &res)) { 189 if (!tb->lookup(tb, &fld, &res)) {
187 ret = res.type; 190 ret = res.type;
188 dn_fib_res_put(&res); 191 dn_fib_res_put(&res);
189 } 192 }