diff options
author | Patrick McHardy <kaber@trash.net> | 2007-12-18 01:29:45 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:58:54 -0500 |
commit | 77236b6e33b06aaf756a86ed1965ca7d460b1b53 (patch) | |
tree | 487fcefd4f686bd0fbce4ee05564349d58d2e68c /net/ipv6 | |
parent | 838965ba22066c7fcdbacfc543c387d0eb76c14c (diff) |
[NETFILTER]: ctnetlink: use netlink attribute helpers
Use NLA_PUT_BE32, nla_get_be32() etc.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c index e99384f9764d..44689d444410 100644 --- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | |||
@@ -213,12 +213,9 @@ icmpv6_error(struct sk_buff *skb, unsigned int dataoff, | |||
213 | static int icmpv6_tuple_to_nlattr(struct sk_buff *skb, | 213 | static int icmpv6_tuple_to_nlattr(struct sk_buff *skb, |
214 | const struct nf_conntrack_tuple *t) | 214 | const struct nf_conntrack_tuple *t) |
215 | { | 215 | { |
216 | NLA_PUT(skb, CTA_PROTO_ICMPV6_ID, sizeof(u_int16_t), | 216 | NLA_PUT_BE16(skb, CTA_PROTO_ICMPV6_ID, t->src.u.icmp.id); |
217 | &t->src.u.icmp.id); | 217 | NLA_PUT_U8(skb, CTA_PROTO_ICMPV6_TYPE, t->dst.u.icmp.type); |
218 | NLA_PUT(skb, CTA_PROTO_ICMPV6_TYPE, sizeof(u_int8_t), | 218 | NLA_PUT_U8(skb, CTA_PROTO_ICMPV6_CODE, t->dst.u.icmp.code); |
219 | &t->dst.u.icmp.type); | ||
220 | NLA_PUT(skb, CTA_PROTO_ICMPV6_CODE, sizeof(u_int8_t), | ||
221 | &t->dst.u.icmp.code); | ||
222 | 219 | ||
223 | return 0; | 220 | return 0; |
224 | 221 | ||
@@ -240,12 +237,9 @@ static int icmpv6_nlattr_to_tuple(struct nlattr *tb[], | |||
240 | || !tb[CTA_PROTO_ICMPV6_ID]) | 237 | || !tb[CTA_PROTO_ICMPV6_ID]) |
241 | return -EINVAL; | 238 | return -EINVAL; |
242 | 239 | ||
243 | tuple->dst.u.icmp.type = | 240 | tuple->dst.u.icmp.type = nla_get_u8(tb[CTA_PROTO_ICMPV6_TYPE]); |
244 | *(u_int8_t *)nla_data(tb[CTA_PROTO_ICMPV6_TYPE]); | 241 | tuple->dst.u.icmp.code = nla_get_u8(tb[CTA_PROTO_ICMPV6_CODE]); |
245 | tuple->dst.u.icmp.code = | 242 | tuple->src.u.icmp.id = nla_get_be16(tb[CTA_PROTO_ICMPV6_ID]); |
246 | *(u_int8_t *)nla_data(tb[CTA_PROTO_ICMPV6_CODE]); | ||
247 | tuple->src.u.icmp.id = | ||
248 | *(__be16 *)nla_data(tb[CTA_PROTO_ICMPV6_ID]); | ||
249 | 243 | ||
250 | if (tuple->dst.u.icmp.type < 128 | 244 | if (tuple->dst.u.icmp.type < 128 |
251 | || tuple->dst.u.icmp.type - 128 >= sizeof(invmap) | 245 | || tuple->dst.u.icmp.type - 128 >= sizeof(invmap) |