decnet: Convert to use flowidn where applicable.

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller
2011-03-12 17:17:10 -05:00
parent 1958b856c1
commit bef55aebd5
10 changed files with 196 additions and 185 deletions

View File

@ -49,14 +49,15 @@ struct dn_fib_rule
};
int dn_fib_lookup(struct flowi *flp, struct dn_fib_res *res)
int dn_fib_lookup(struct flowidn *flp, struct dn_fib_res *res)
{
struct fib_lookup_arg arg = {
.result = res,
};
int err;
err = fib_rules_lookup(dn_fib_rules_ops, flp, 0, &arg);
err = fib_rules_lookup(dn_fib_rules_ops,
flowidn_to_flowi(flp), 0, &arg);
res->r = arg.rule;
return err;
@ -65,6 +66,7 @@ int dn_fib_lookup(struct flowi *flp, struct dn_fib_res *res)
static int dn_fib_rule_action(struct fib_rule *rule, struct flowi *flp,
int flags, struct fib_lookup_arg *arg)
{
struct flowidn *fld = &flp->u.dn;
int err = -EAGAIN;
struct dn_fib_table *tbl;
@ -90,7 +92,7 @@ static int dn_fib_rule_action(struct fib_rule *rule, struct flowi *flp,
if (tbl == NULL)
goto errout;
err = tbl->lookup(tbl, flp, (struct dn_fib_res *)arg->result);
err = tbl->lookup(tbl, fld, (struct dn_fib_res *)arg->result);
if (err > 0)
err = -EAGAIN;
errout:
@ -104,8 +106,9 @@ static const struct nla_policy dn_fib_rule_policy[FRA_MAX+1] = {
static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
{
struct dn_fib_rule *r = (struct dn_fib_rule *)rule;
__le16 daddr = fl->fld_dst;
__le16 saddr = fl->fld_src;
struct flowidn *fld = &fl->u.dn;
__le16 daddr = fld->daddr;
__le16 saddr = fld->saddr;
if (((saddr ^ r->src) & r->srcmask) ||
((daddr ^ r->dst) & r->dstmask))
@ -175,7 +178,7 @@ static int dn_fib_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
unsigned dnet_addr_type(__le16 addr)
{
struct flowi fl = { .fld_dst = addr };
struct flowidn fld = { .daddr = addr };
struct dn_fib_res res;
unsigned ret = RTN_UNICAST;
struct dn_fib_table *tb = dn_fib_get_table(RT_TABLE_LOCAL, 0);
@ -183,7 +186,7 @@ unsigned dnet_addr_type(__le16 addr)
res.r = NULL;
if (tb) {
if (!tb->lookup(tb, &fl, &res)) {
if (!tb->lookup(tb, &fld, &res)) {
ret = res.type;
dn_fib_res_put(&res);
}