aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_nat.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_nat.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_nat.c')
-rw-r--r--net/sched/act_nat.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index da5c1eae4222..be007bb31b59 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -40,22 +40,22 @@ static struct tcf_hashinfo nat_hash_info = {
40 .lock = &nat_lock, 40 .lock = &nat_lock,
41}; 41};
42 42
43static int tcf_nat_init(struct rtattr *rta, struct rtattr *est, 43static int tcf_nat_init(struct nlattr *nla, struct nlattr *est,
44 struct tc_action *a, int ovr, int bind) 44 struct tc_action *a, int ovr, int bind)
45{ 45{
46 struct rtattr *tb[TCA_NAT_MAX]; 46 struct nlattr *tb[TCA_NAT_MAX + 1];
47 struct tc_nat *parm; 47 struct tc_nat *parm;
48 int ret = 0; 48 int ret = 0;
49 struct tcf_nat *p; 49 struct tcf_nat *p;
50 struct tcf_common *pc; 50 struct tcf_common *pc;
51 51
52 if (rta == NULL || rtattr_parse_nested(tb, TCA_NAT_MAX, rta) < 0) 52 if (nla == NULL || nla_parse_nested(tb, TCA_NAT_MAX, nla, NULL) < 0)
53 return -EINVAL; 53 return -EINVAL;
54 54
55 if (tb[TCA_NAT_PARMS - 1] == NULL || 55 if (tb[TCA_NAT_PARMS] == NULL ||
56 RTA_PAYLOAD(tb[TCA_NAT_PARMS - 1]) < sizeof(*parm)) 56 nla_len(tb[TCA_NAT_PARMS]) < sizeof(*parm))
57 return -EINVAL; 57 return -EINVAL;
58 parm = RTA_DATA(tb[TCA_NAT_PARMS - 1]); 58 parm = nla_data(tb[TCA_NAT_PARMS]);
59 59
60 pc = tcf_hash_check(parm->index, a, bind, &nat_hash_info); 60 pc = tcf_hash_check(parm->index, a, bind, &nat_hash_info);
61 if (!pc) { 61 if (!pc) {
@@ -275,17 +275,17 @@ static int tcf_nat_dump(struct sk_buff *skb, struct tc_action *a,
275 opt->refcnt = p->tcf_refcnt - ref; 275 opt->refcnt = p->tcf_refcnt - ref;
276 opt->bindcnt = p->tcf_bindcnt - bind; 276 opt->bindcnt = p->tcf_bindcnt - bind;
277 277
278 RTA_PUT(skb, TCA_NAT_PARMS, s, opt); 278 NLA_PUT(skb, TCA_NAT_PARMS, s, opt);
279 t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install); 279 t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
280 t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse); 280 t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
281 t.expires = jiffies_to_clock_t(p->tcf_tm.expires); 281 t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
282 RTA_PUT(skb, TCA_NAT_TM, sizeof(t), &t); 282 NLA_PUT(skb, TCA_NAT_TM, sizeof(t), &t);
283 283
284 kfree(opt); 284 kfree(opt);
285 285
286 return skb->len; 286 return skb->len;
287 287
288rtattr_failure: 288nla_put_failure:
289 nlmsg_trim(skb, b); 289 nlmsg_trim(skb, b);
290 kfree(opt); 290 kfree(opt);
291 return -1; 291 return -1;