From 7ba699c604ab811972eee2e041fd6b07659a2e6e Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 22 Jan 2008 22:11:50 -0800 Subject: [NET_SCHED]: Convert actions from rtnetlink to new netlink API Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- net/sched/act_simple.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'net/sched/act_simple.c') diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index fb84ef33d14f..d3226e24070b 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c @@ -84,10 +84,10 @@ static int realloc_defdata(struct tcf_defact *d, u32 datalen, void *defdata) return alloc_defdata(d, datalen, defdata); } -static int tcf_simp_init(struct rtattr *rta, struct rtattr *est, +static int tcf_simp_init(struct nlattr *nla, struct nlattr *est, struct tc_action *a, int ovr, int bind) { - struct rtattr *tb[TCA_DEF_MAX]; + struct nlattr *tb[TCA_DEF_MAX + 1]; struct tc_defact *parm; struct tcf_defact *d; struct tcf_common *pc; @@ -95,19 +95,19 @@ static int tcf_simp_init(struct rtattr *rta, struct rtattr *est, u32 datalen = 0; int ret = 0; - if (rta == NULL || rtattr_parse_nested(tb, TCA_DEF_MAX, rta) < 0) + if (nla == NULL || nla_parse_nested(tb, TCA_DEF_MAX, nla, NULL) < 0) return -EINVAL; - if (tb[TCA_DEF_PARMS - 1] == NULL || - RTA_PAYLOAD(tb[TCA_DEF_PARMS - 1]) < sizeof(*parm)) + if (tb[TCA_DEF_PARMS] == NULL || + nla_len(tb[TCA_DEF_PARMS]) < sizeof(*parm)) return -EINVAL; - parm = RTA_DATA(tb[TCA_DEF_PARMS - 1]); - defdata = RTA_DATA(tb[TCA_DEF_DATA - 1]); + parm = nla_data(tb[TCA_DEF_PARMS]); + defdata = nla_data(tb[TCA_DEF_DATA]); if (defdata == NULL) return -EINVAL; - datalen = RTA_PAYLOAD(tb[TCA_DEF_DATA - 1]); + datalen = nla_len(tb[TCA_DEF_DATA]); if (datalen <= 0) return -EINVAL; @@ -164,15 +164,15 @@ static inline int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a, opt.refcnt = d->tcf_refcnt - ref; opt.bindcnt = d->tcf_bindcnt - bind; opt.action = d->tcf_action; - RTA_PUT(skb, TCA_DEF_PARMS, sizeof(opt), &opt); - RTA_PUT(skb, TCA_DEF_DATA, d->tcfd_datalen, d->tcfd_defdata); + NLA_PUT(skb, TCA_DEF_PARMS, sizeof(opt), &opt); + NLA_PUT(skb, TCA_DEF_DATA, d->tcfd_datalen, d->tcfd_defdata); t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse); t.expires = jiffies_to_clock_t(d->tcf_tm.expires); - RTA_PUT(skb, TCA_DEF_TM, sizeof(t), &t); + NLA_PUT(skb, TCA_DEF_TM, sizeof(t), &t); return skb->len; -rtattr_failure: +nla_put_failure: nlmsg_trim(skb, b); return -1; } -- cgit v1.2.3-59-g8ed1b