cfg80211: wext: don't display BSSID unless associated
[safe/jmp/linux-2.6] / net / ipv4 / fib_rules.c
index 8d0ebe7..92d9d97 100644 (file)
@@ -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;
@@ -144,10 +134,10 @@ static const struct nla_policy fib4_rule_policy[FRA_MAX+1] = {
 };
 
 static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
-                              struct nlmsghdr *nlh, struct fib_rule_hdr *frh,
+                              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;
 
@@ -219,7 +209,7 @@ static int fib4_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
 }
 
 static int fib4_rule_fill(struct fib_rule *rule, struct sk_buff *skb,
-                         struct nlmsghdr *nlh, struct fib_rule_hdr *frh)
+                         struct fib_rule_hdr *frh)
 {
        struct fib4_rule *rule4 = (struct fib4_rule *) rule;
 
@@ -268,9 +258,9 @@ static size_t fib4_rule_nlmsg_payload(struct fib_rule *rule)
               + nla_total_size(4); /* flow */
 }
 
-static void fib4_rule_flush_cache(void)
+static void fib4_rule_flush_cache(struct fib_rules_ops *ops)
 {
-       rt_cache_flush(-1);
+       rt_cache_flush(ops->fro_net, -1);
 }
 
 static struct fib_rules_ops fib4_rules_ops_template = {
@@ -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);
 }