aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2005-01-09 21:56:09 -0800
committerDavid S. Miller <davem@nuts.davemloft.net>2005-01-09 21:56:09 -0800
commitb9058337034ede2ea08a9d202cc7179a3bd7af20 (patch)
treefa511af3f5a3fa7b8b1cc79aa44c9666bee61b1e /net
parent4ea777e49d36991c7fd586c28804c7700b93639d (diff)
downloadhistory-b9058337034ede2ea08a9d202cc7179a3bd7af20.tar.gz
[PKT_SCHED]: act_api.c: remove module loading from get/delete operations
If get/delete can't find the action we can assume there is nothing to get/delete. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/sched/act_api.c94
1 files changed, 15 insertions, 79 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 5cf2421f512684..a1d7e65ed10eb2 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -380,10 +380,6 @@ int tcf_action_copy_stats(struct sk_buff *skb, struct tc_action *a)
struct gnet_dump d;
struct tcf_act_hdr *h = a->priv;
-#ifdef CONFIG_KMOD
- /* place holder */
-#endif
-
if (h == NULL)
goto errout;
@@ -470,58 +466,27 @@ act_get_notify(u32 pid, struct nlmsghdr *n, struct tc_action *a, int event)
static int tcf_action_get_1(struct rtattr *rta, struct tc_action *a,
struct nlmsghdr *n, u32 pid)
{
- struct tc_action_ops *a_o;
- char act_name[IFNAMSIZ];
struct rtattr *tb[TCA_ACT_MAX+1];
- struct rtattr *kind;
int index;
- int err = -EINVAL;
+ int err = 0;
if (rtattr_parse(tb, TCA_ACT_MAX, RTA_DATA(rta), RTA_PAYLOAD(rta)) < 0)
- goto err_out;
- kind = tb[TCA_ACT_KIND-1];
- if (kind != NULL) {
- if (rtattr_strlcpy(act_name, kind, IFNAMSIZ) >= IFNAMSIZ)
- goto err_out;
- } else {
- printk("tcf_action_get_1: action bad kind\n");
- goto err_out;
- }
-
- if (tb[TCA_ACT_INDEX - 1])
- index = *(int *)RTA_DATA(tb[TCA_ACT_INDEX - 1]);
- else {
- printk("tcf_action_get_1: index not received\n");
- goto err_out;
- }
-
- a_o = tc_lookup_action(kind);
-#ifdef CONFIG_KMOD
- if (a_o == NULL) {
- request_module (act_name);
- a_o = tc_lookup_action_n(act_name);
- }
-#endif
- if (a_o == NULL) {
- printk("failed to find %s\n", act_name);
- goto err_out;
- }
- if (a == NULL)
- goto err_mod;
+ return -EINVAL;
- a->ops = a_o;
+ if (tb[TCA_ACT_INDEX - 1] == NULL ||
+ RTA_PAYLOAD(tb[TCA_ACT_INDEX - 1]) < sizeof(index))
+ return -EINVAL;
+ index = *(int *)RTA_DATA(tb[TCA_ACT_INDEX - 1]);
- if (a_o->lookup == NULL || a_o->lookup(a, index) == 0) {
- a->ops = NULL;
+ a->ops = tc_lookup_action(tb[TCA_ACT_KIND - 1]);
+ if (a->ops == NULL)
+ return -EINVAL;
+ if (a->ops->lookup == NULL)
err = -EINVAL;
- goto err_mod;
- }
+ else if (a->ops->lookup(a, index) == 0)
+ err = -ENOENT;
- module_put(a_o->owner);
- return 0;
-err_mod:
- module_put(a_o->owner);
-err_out:
+ module_put(a->ops->owner);
return err;
}
@@ -535,36 +500,6 @@ static void cleanup_a(struct tc_action *act)
}
}
-static struct tc_action_ops *get_ao(struct rtattr *kind, struct tc_action *a)
-{
- char act_name[IFNAMSIZ];
- struct tc_action_ops *a_o;
-
- if (kind != NULL) {
- if (rtattr_strlcpy(act_name, kind, IFNAMSIZ) >= IFNAMSIZ)
- return NULL;
- } else {
- printk("get_ao: action bad kind\n");
- return NULL;
- }
-
- a_o = tc_lookup_action(kind);
-#ifdef CONFIG_KMOD
- if (a_o == NULL) {
- DPRINTK("get_ao: trying to load module %s\n", act_name);
- request_module(act_name);
- a_o = tc_lookup_action_n(act_name);
- }
-#endif
- if (a_o == NULL) {
- printk("get_ao: failed to find %s\n", act_name);
- return NULL;
- }
-
- a->ops = a_o;
- return a_o;
-}
-
static struct tc_action *create_a(int i)
{
struct tc_action *act;
@@ -610,7 +545,8 @@ static int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid)
goto err_out;
kind = tb[TCA_ACT_KIND-1];
- if (get_ao(kind, a) == NULL)
+ a->ops = tc_lookup_action(kind);
+ if (a->ops == NULL)
goto err_out;
nlh = NLMSG_PUT(skb, pid, n->nlmsg_seq, RTM_DELACTION, sizeof(*t));