X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=net%2Fipv4%2Ffib_rules.c;h=1fb56876be54ab77f035abbd0afd51618edb2da8;hb=9a13150109fb418c50fa400c012f90d0ce6f67c3;hp=8d0ebe7f360d5513aa8f39baeba6d904744632db;hpb=035923833369e4da5d3c4ad0700bc7c367a0fa37;p=linux-2.6 diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index 8d0ebe7f36..1fb56876be 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c @@ -54,14 +54,14 @@ u32 fib_rules_tclass(struct fib_result *res) } #endif -int fib_lookup(struct flowi *flp, struct fib_result *res) +int fib_lookup(struct net *net, struct flowi *flp, struct fib_result *res) { struct fib_lookup_arg arg = { .result = res, }; int err; - err = fib_rules_lookup(init_net.ipv4.rules_ops, flp, 0, &arg); + err = fib_rules_lookup(net->ipv4.rules_ops, flp, 0, &arg); res->r = arg.rule; return err; @@ -91,7 +91,7 @@ static int fib4_rule_action(struct fib_rule *rule, struct flowi *flp, goto errout; } - if ((tbl = fib_get_table(&init_net, rule->table)) == NULL) + if ((tbl = fib_get_table(rule->fr_net, rule->table)) == NULL) goto errout; err = tbl->tb_lookup(tbl, flp, (struct fib_result *) arg->result); @@ -102,16 +102,6 @@ errout: } -void fib_select_default(const struct flowi *flp, struct fib_result *res) -{ - if (res->r && res->r->action == FR_ACT_TO_TBL && - FIB_RES_GW(*res) && FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) { - struct fib_table *tb; - if ((tb = fib_get_table(&init_net, res->r->table)) != NULL) - tb->tb_select_default(tb, flp, res); - } -} - static int fib4_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) { struct fib4_rule *r = (struct fib4_rule *) rule; @@ -147,7 +137,7 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb, struct nlmsghdr *nlh, struct fib_rule_hdr *frh, struct nlattr **tb) { - struct net *net = skb->sk->sk_net; + struct net *net = sock_net(skb->sk); int err = -EINVAL; struct fib4_rule *rule4 = (struct fib4_rule *) rule; @@ -317,7 +307,7 @@ int __net_init fib4_rules_init(struct net *net) INIT_LIST_HEAD(&ops->rules_list); ops->fro_net = net; - fib_rules_register(net, ops); + fib_rules_register(ops); err = fib_default_rules_init(ops); if (err < 0) @@ -327,13 +317,13 @@ int __net_init fib4_rules_init(struct net *net) fail: /* also cleans all rules already added */ - fib_rules_unregister(net, ops); + fib_rules_unregister(ops); kfree(ops); return err; } void __net_exit fib4_rules_exit(struct net *net) { - fib_rules_unregister(net, net->ipv4.rules_ops); + fib_rules_unregister(net->ipv4.rules_ops); kfree(net->ipv4.rules_ops); }