aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_gact.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-01-23 01:11:50 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:11:11 -0500
commit7ba699c604ab811972eee2e041fd6b07659a2e6e (patch)
tree4f76f69a25ce27ee0dd0c417df75acf00b1a36a0 /net/sched/act_gact.c
parentadd93b610a4e66d36d0cf0b2596c3d3bcfdaee39 (diff)
[NET_SCHED]: Convert actions from rtnetlink to new netlink API
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_gact.c')
-rw-r--r--net/sched/act_gact.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index a9631e426d91..5402cf885f95 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -53,26 +53,26 @@ typedef int (*g_rand)(struct tcf_gact *gact);
53static g_rand gact_rand[MAX_RAND]= { NULL, gact_net_rand, gact_determ }; 53static g_rand gact_rand[MAX_RAND]= { NULL, gact_net_rand, gact_determ };
54#endif /* CONFIG_GACT_PROB */ 54#endif /* CONFIG_GACT_PROB */
55 55
56static int tcf_gact_init(struct rtattr *rta, struct rtattr *est, 56static int tcf_gact_init(struct nlattr *nla, struct nlattr *est,
57 struct tc_action *a, int ovr, int bind) 57 struct tc_action *a, int ovr, int bind)
58{ 58{
59 struct rtattr *tb[TCA_GACT_MAX]; 59 struct nlattr *tb[TCA_GACT_MAX + 1];
60 struct tc_gact *parm; 60 struct tc_gact *parm;
61 struct tcf_gact *gact; 61 struct tcf_gact *gact;
62 struct tcf_common *pc; 62 struct tcf_common *pc;
63 int ret = 0; 63 int ret = 0;
64 64
65 if (rta == NULL || rtattr_parse_nested(tb, TCA_GACT_MAX, rta) < 0) 65 if (nla == NULL || nla_parse_nested(tb, TCA_GACT_MAX, nla, NULL) < 0)
66 return -EINVAL; 66 return -EINVAL;
67 67
68 if (tb[TCA_GACT_PARMS - 1] == NULL || 68 if (tb[TCA_GACT_PARMS] == NULL ||
69 RTA_PAYLOAD(tb[TCA_GACT_PARMS - 1]) < sizeof(*parm)) 69 nla_len(tb[TCA_GACT_PARMS]) < sizeof(*parm))
70 return -EINVAL; 70 return -EINVAL;
71 parm = RTA_DATA(tb[TCA_GACT_PARMS - 1]); 71 parm = nla_data(tb[TCA_GACT_PARMS]);
72 72
73 if (tb[TCA_GACT_PROB-1] != NULL) 73 if (tb[TCA_GACT_PROB] != NULL)
74#ifdef CONFIG_GACT_PROB 74#ifdef CONFIG_GACT_PROB
75 if (RTA_PAYLOAD(tb[TCA_GACT_PROB-1]) < sizeof(struct tc_gact_p)) 75 if (nla_len(tb[TCA_GACT_PROB]) < sizeof(struct tc_gact_p))
76 return -EINVAL; 76 return -EINVAL;
77#else 77#else
78 return -EOPNOTSUPP; 78 return -EOPNOTSUPP;
@@ -97,8 +97,8 @@ static int tcf_gact_init(struct rtattr *rta, struct rtattr *est,
97 spin_lock_bh(&gact->tcf_lock); 97 spin_lock_bh(&gact->tcf_lock);
98 gact->tcf_action = parm->action; 98 gact->tcf_action = parm->action;
99#ifdef CONFIG_GACT_PROB 99#ifdef CONFIG_GACT_PROB
100 if (tb[TCA_GACT_PROB-1] != NULL) { 100 if (tb[TCA_GACT_PROB] != NULL) {
101 struct tc_gact_p *p_parm = RTA_DATA(tb[TCA_GACT_PROB-1]); 101 struct tc_gact_p *p_parm = nla_data(tb[TCA_GACT_PROB]);
102 gact->tcfg_paction = p_parm->paction; 102 gact->tcfg_paction = p_parm->paction;
103 gact->tcfg_pval = p_parm->pval; 103 gact->tcfg_pval = p_parm->pval;
104 gact->tcfg_ptype = p_parm->ptype; 104 gact->tcfg_ptype = p_parm->ptype;
@@ -154,23 +154,23 @@ static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int
154 opt.refcnt = gact->tcf_refcnt - ref; 154 opt.refcnt = gact->tcf_refcnt - ref;
155 opt.bindcnt = gact->tcf_bindcnt - bind; 155 opt.bindcnt = gact->tcf_bindcnt - bind;
156 opt.action = gact->tcf_action; 156 opt.action = gact->tcf_action;
157 RTA_PUT(skb, TCA_GACT_PARMS, sizeof(opt), &opt); 157 NLA_PUT(skb, TCA_GACT_PARMS, sizeof(opt), &opt);
158#ifdef CONFIG_GACT_PROB 158#ifdef CONFIG_GACT_PROB
159 if (gact->tcfg_ptype) { 159 if (gact->tcfg_ptype) {
160 struct tc_gact_p p_opt; 160 struct tc_gact_p p_opt;
161 p_opt.paction = gact->tcfg_paction; 161 p_opt.paction = gact->tcfg_paction;
162 p_opt.pval = gact->tcfg_pval; 162 p_opt.pval = gact->tcfg_pval;
163 p_opt.ptype = gact->tcfg_ptype; 163 p_opt.ptype = gact->tcfg_ptype;
164 RTA_PUT(skb, TCA_GACT_PROB, sizeof(p_opt), &p_opt); 164 NLA_PUT(skb, TCA_GACT_PROB, sizeof(p_opt), &p_opt);
165 } 165 }
166#endif 166#endif
167 t.install = jiffies_to_clock_t(jiffies - gact->tcf_tm.install); 167 t.install = jiffies_to_clock_t(jiffies - gact->tcf_tm.install);
168 t.lastuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.lastuse); 168 t.lastuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.lastuse);
169 t.expires = jiffies_to_clock_t(gact->tcf_tm.expires); 169 t.expires = jiffies_to_clock_t(gact->tcf_tm.expires);
170 RTA_PUT(skb, TCA_GACT_TM, sizeof(t), &t); 170 NLA_PUT(skb, TCA_GACT_TM, sizeof(t), &t);
171 return skb->len; 171 return skb->len;
172 172
173rtattr_failure: 173nla_put_failure:
174 nlmsg_trim(skb, b); 174 nlmsg_trim(skb, b);
175 return -1; 175 return -1;
176} 176}