diff options
author | Hong zhi guo <honkiko@gmail.com> | 2013-03-27 02:47:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-28 14:25:25 -0400 |
commit | 573ce260b385a4d14a1ef046558fad9f1daeee42 (patch) | |
tree | b577de870934c583a66514b1206964fbd262c340 | |
parent | e5c5d22e8dcf7c2d430336cbf8e180bd38e8daf1 (diff) |
net-next: replace obsolete NLMSG_* with type safe nlmsg_*
Signed-off-by: Hong Zhiguo <honkiko@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/bridge/netfilter/ebt_ulog.c | 4 | ||||
-rw-r--r-- | net/core/rtnetlink.c | 4 | ||||
-rw-r--r-- | net/decnet/dn_table.c | 4 | ||||
-rw-r--r-- | net/decnet/netfilter/dn_rtmsg.c | 12 | ||||
-rw-r--r-- | net/ieee802154/netlink.c | 4 | ||||
-rw-r--r-- | net/ipv4/fib_frontend.c | 6 | ||||
-rw-r--r-- | net/ipv4/ipmr.c | 10 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_ULOG.c | 4 | ||||
-rw-r--r-- | net/ipv4/udp_diag.c | 6 | ||||
-rw-r--r-- | net/ipv6/ip6mr.c | 10 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_core.c | 5 | ||||
-rw-r--r-- | net/netfilter/nfnetlink.c | 7 | ||||
-rw-r--r-- | net/netfilter/nfnetlink_log.c | 4 | ||||
-rw-r--r-- | net/netfilter/nfnetlink_queue_core.c | 2 | ||||
-rw-r--r-- | net/netlink/af_netlink.c | 4 | ||||
-rw-r--r-- | net/sched/cls_api.c | 4 | ||||
-rw-r--r-- | net/sched/sch_api.c | 2 | ||||
-rw-r--r-- | net/tipc/netlink.c | 6 |
18 files changed, 48 insertions, 50 deletions
diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c index 442b0321acb9..961d870ab283 100644 --- a/net/bridge/netfilter/ebt_ulog.c +++ b/net/bridge/netfilter/ebt_ulog.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <linux/skbuff.h> | 35 | #include <linux/skbuff.h> |
36 | #include <linux/kernel.h> | 36 | #include <linux/kernel.h> |
37 | #include <linux/timer.h> | 37 | #include <linux/timer.h> |
38 | #include <linux/netlink.h> | 38 | #include <net/netlink.h> |
39 | #include <linux/netdevice.h> | 39 | #include <linux/netdevice.h> |
40 | #include <linux/netfilter/x_tables.h> | 40 | #include <linux/netfilter/x_tables.h> |
41 | #include <linux/netfilter_bridge/ebtables.h> | 41 | #include <linux/netfilter_bridge/ebtables.h> |
@@ -134,7 +134,7 @@ static void ebt_ulog_packet(unsigned int hooknr, const struct sk_buff *skb, | |||
134 | else | 134 | else |
135 | copy_len = uloginfo->cprange; | 135 | copy_len = uloginfo->cprange; |
136 | 136 | ||
137 | size = NLMSG_SPACE(sizeof(*pm) + copy_len); | 137 | size = nlmsg_total_size(sizeof(*pm) + copy_len); |
138 | if (size > nlbufsiz) { | 138 | if (size > nlbufsiz) { |
139 | pr_debug("Size %Zd needed, but nlbufsiz=%d\n", size, nlbufsiz); | 139 | pr_debug("Size %Zd needed, but nlbufsiz=%d\n", size, nlbufsiz); |
140 | return; | 140 | return; |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index aeb81316a704..6fdfac8978f2 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -2613,10 +2613,10 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
2613 | type -= RTM_BASE; | 2613 | type -= RTM_BASE; |
2614 | 2614 | ||
2615 | /* All the messages must have at least 1 byte length */ | 2615 | /* All the messages must have at least 1 byte length */ |
2616 | if (nlh->nlmsg_len < NLMSG_LENGTH(sizeof(struct rtgenmsg))) | 2616 | if (nlmsg_len(nlh) < sizeof(struct rtgenmsg)) |
2617 | return 0; | 2617 | return 0; |
2618 | 2618 | ||
2619 | family = ((struct rtgenmsg *)NLMSG_DATA(nlh))->rtgen_family; | 2619 | family = ((struct rtgenmsg *)nlmsg_data(nlh))->rtgen_family; |
2620 | sz_idx = type>>2; | 2620 | sz_idx = type>>2; |
2621 | kind = type&3; | 2621 | kind = type&3; |
2622 | 2622 | ||
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c index fc42a0afd306..b15c1d1720fb 100644 --- a/net/decnet/dn_table.c +++ b/net/decnet/dn_table.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/sockios.h> | 19 | #include <linux/sockios.h> |
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/skbuff.h> | 21 | #include <linux/skbuff.h> |
22 | #include <linux/netlink.h> | 22 | #include <net/netlink.h> |
23 | #include <linux/rtnetlink.h> | 23 | #include <linux/rtnetlink.h> |
24 | #include <linux/proc_fs.h> | 24 | #include <linux/proc_fs.h> |
25 | #include <linux/netdevice.h> | 25 | #include <linux/netdevice.h> |
@@ -492,7 +492,7 @@ int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
492 | if (!net_eq(net, &init_net)) | 492 | if (!net_eq(net, &init_net)) |
493 | return 0; | 493 | return 0; |
494 | 494 | ||
495 | if (NLMSG_PAYLOAD(cb->nlh, 0) >= sizeof(struct rtmsg) && | 495 | if (nlmsg_len(cb->nlh) >= sizeof(struct rtmsg) && |
496 | ((struct rtmsg *)nlmsg_data(cb->nlh))->rtm_flags&RTM_F_CLONED) | 496 | ((struct rtmsg *)nlmsg_data(cb->nlh))->rtm_flags&RTM_F_CLONED) |
497 | return dn_cache_dump(skb, cb); | 497 | return dn_cache_dump(skb, cb); |
498 | 498 | ||
diff --git a/net/decnet/netfilter/dn_rtmsg.c b/net/decnet/netfilter/dn_rtmsg.c index dfe42012a044..2a7efe388344 100644 --- a/net/decnet/netfilter/dn_rtmsg.c +++ b/net/decnet/netfilter/dn_rtmsg.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/netdevice.h> | 19 | #include <linux/netdevice.h> |
20 | #include <linux/netfilter.h> | 20 | #include <linux/netfilter.h> |
21 | #include <linux/spinlock.h> | 21 | #include <linux/spinlock.h> |
22 | #include <linux/netlink.h> | 22 | #include <net/netlink.h> |
23 | #include <linux/netfilter_decnet.h> | 23 | #include <linux/netfilter_decnet.h> |
24 | 24 | ||
25 | #include <net/sock.h> | 25 | #include <net/sock.h> |
@@ -39,21 +39,21 @@ static struct sk_buff *dnrmg_build_message(struct sk_buff *rt_skb, int *errp) | |||
39 | unsigned char *ptr; | 39 | unsigned char *ptr; |
40 | struct nf_dn_rtmsg *rtm; | 40 | struct nf_dn_rtmsg *rtm; |
41 | 41 | ||
42 | size = NLMSG_SPACE(rt_skb->len); | 42 | size = NLMSG_ALIGN(rt_skb->len) + |
43 | size += NLMSG_ALIGN(sizeof(struct nf_dn_rtmsg)); | 43 | NLMSG_ALIGN(sizeof(struct nf_dn_rtmsg)); |
44 | skb = alloc_skb(size, GFP_ATOMIC); | 44 | skb = nlmsg_new(size, GFP_ATOMIC); |
45 | if (!skb) { | 45 | if (!skb) { |
46 | *errp = -ENOMEM; | 46 | *errp = -ENOMEM; |
47 | return NULL; | 47 | return NULL; |
48 | } | 48 | } |
49 | old_tail = skb->tail; | 49 | old_tail = skb->tail; |
50 | nlh = nlmsg_put(skb, 0, 0, 0, size - sizeof(*nlh), 0); | 50 | nlh = nlmsg_put(skb, 0, 0, 0, size, 0); |
51 | if (!nlh) { | 51 | if (!nlh) { |
52 | kfree_skb(skb); | 52 | kfree_skb(skb); |
53 | *errp = -ENOMEM; | 53 | *errp = -ENOMEM; |
54 | return NULL; | 54 | return NULL; |
55 | } | 55 | } |
56 | rtm = (struct nf_dn_rtmsg *)NLMSG_DATA(nlh); | 56 | rtm = (struct nf_dn_rtmsg *)nlmsg_data(nlh); |
57 | rtm->nfdn_ifindex = rt_skb->dev->ifindex; | 57 | rtm->nfdn_ifindex = rt_skb->dev->ifindex; |
58 | ptr = NFDN_RTMSG(rtm); | 58 | ptr = NFDN_RTMSG(rtm); |
59 | skb_copy_from_linear_data(rt_skb, ptr, rt_skb->len); | 59 | skb_copy_from_linear_data(rt_skb, ptr, rt_skb->len); |
diff --git a/net/ieee802154/netlink.c b/net/ieee802154/netlink.c index 97351e1d07a4..92472528106b 100644 --- a/net/ieee802154/netlink.c +++ b/net/ieee802154/netlink.c | |||
@@ -65,7 +65,7 @@ struct sk_buff *ieee802154_nl_create(int flags, u8 req) | |||
65 | int ieee802154_nl_mcast(struct sk_buff *msg, unsigned int group) | 65 | int ieee802154_nl_mcast(struct sk_buff *msg, unsigned int group) |
66 | { | 66 | { |
67 | /* XXX: nlh is right at the start of msg */ | 67 | /* XXX: nlh is right at the start of msg */ |
68 | void *hdr = genlmsg_data(NLMSG_DATA(msg->data)); | 68 | void *hdr = genlmsg_data(nlmsg_data(msg->data)); |
69 | 69 | ||
70 | if (genlmsg_end(msg, hdr) < 0) | 70 | if (genlmsg_end(msg, hdr) < 0) |
71 | goto out; | 71 | goto out; |
@@ -98,7 +98,7 @@ struct sk_buff *ieee802154_nl_new_reply(struct genl_info *info, | |||
98 | int ieee802154_nl_reply(struct sk_buff *msg, struct genl_info *info) | 98 | int ieee802154_nl_reply(struct sk_buff *msg, struct genl_info *info) |
99 | { | 99 | { |
100 | /* XXX: nlh is right at the start of msg */ | 100 | /* XXX: nlh is right at the start of msg */ |
101 | void *hdr = genlmsg_data(NLMSG_DATA(msg->data)); | 101 | void *hdr = genlmsg_data(nlmsg_data(msg->data)); |
102 | 102 | ||
103 | if (genlmsg_end(msg, hdr) < 0) | 103 | if (genlmsg_end(msg, hdr) < 0) |
104 | goto out; | 104 | goto out; |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 0e74398bc8e6..c7629a209f9d 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -957,8 +957,8 @@ static void nl_fib_input(struct sk_buff *skb) | |||
957 | 957 | ||
958 | net = sock_net(skb->sk); | 958 | net = sock_net(skb->sk); |
959 | nlh = nlmsg_hdr(skb); | 959 | nlh = nlmsg_hdr(skb); |
960 | if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len || | 960 | if (skb->len < NLMSG_HDRLEN || skb->len < nlh->nlmsg_len || |
961 | nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn))) | 961 | nlmsg_len(nlh) < sizeof(*frn)) |
962 | return; | 962 | return; |
963 | 963 | ||
964 | skb = skb_clone(skb, GFP_KERNEL); | 964 | skb = skb_clone(skb, GFP_KERNEL); |
@@ -966,7 +966,7 @@ static void nl_fib_input(struct sk_buff *skb) | |||
966 | return; | 966 | return; |
967 | nlh = nlmsg_hdr(skb); | 967 | nlh = nlmsg_hdr(skb); |
968 | 968 | ||
969 | frn = (struct fib_result_nl *) NLMSG_DATA(nlh); | 969 | frn = (struct fib_result_nl *) nlmsg_data(nlh); |
970 | tb = fib_get_table(net, frn->tb_id_in); | 970 | tb = fib_get_table(net, frn->tb_id_in); |
971 | 971 | ||
972 | nl_fib_lookup(frn, tb); | 972 | nl_fib_lookup(frn, tb); |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index fd61fe16679f..9d9610ae7855 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -626,9 +626,9 @@ static void ipmr_destroy_unres(struct mr_table *mrt, struct mfc_cache *c) | |||
626 | if (ip_hdr(skb)->version == 0) { | 626 | if (ip_hdr(skb)->version == 0) { |
627 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr)); | 627 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr)); |
628 | nlh->nlmsg_type = NLMSG_ERROR; | 628 | nlh->nlmsg_type = NLMSG_ERROR; |
629 | nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr)); | 629 | nlh->nlmsg_len = nlmsg_msg_size(sizeof(struct nlmsgerr)); |
630 | skb_trim(skb, nlh->nlmsg_len); | 630 | skb_trim(skb, nlh->nlmsg_len); |
631 | e = NLMSG_DATA(nlh); | 631 | e = nlmsg_data(nlh); |
632 | e->error = -ETIMEDOUT; | 632 | e->error = -ETIMEDOUT; |
633 | memset(&e->msg, 0, sizeof(e->msg)); | 633 | memset(&e->msg, 0, sizeof(e->msg)); |
634 | 634 | ||
@@ -910,14 +910,14 @@ static void ipmr_cache_resolve(struct net *net, struct mr_table *mrt, | |||
910 | if (ip_hdr(skb)->version == 0) { | 910 | if (ip_hdr(skb)->version == 0) { |
911 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr)); | 911 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr)); |
912 | 912 | ||
913 | if (__ipmr_fill_mroute(mrt, skb, c, NLMSG_DATA(nlh)) > 0) { | 913 | if (__ipmr_fill_mroute(mrt, skb, c, nlmsg_data(nlh)) > 0) { |
914 | nlh->nlmsg_len = skb_tail_pointer(skb) - | 914 | nlh->nlmsg_len = skb_tail_pointer(skb) - |
915 | (u8 *)nlh; | 915 | (u8 *)nlh; |
916 | } else { | 916 | } else { |
917 | nlh->nlmsg_type = NLMSG_ERROR; | 917 | nlh->nlmsg_type = NLMSG_ERROR; |
918 | nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr)); | 918 | nlh->nlmsg_len = nlmsg_msg_size(sizeof(struct nlmsgerr)); |
919 | skb_trim(skb, nlh->nlmsg_len); | 919 | skb_trim(skb, nlh->nlmsg_len); |
920 | e = NLMSG_DATA(nlh); | 920 | e = nlmsg_data(nlh); |
921 | e->error = -EMSGSIZE; | 921 | e->error = -EMSGSIZE; |
922 | memset(&e->msg, 0, sizeof(e->msg)); | 922 | memset(&e->msg, 0, sizeof(e->msg)); |
923 | } | 923 | } |
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c index 7d168dcbd135..e7f8cad11393 100644 --- a/net/ipv4/netfilter/ipt_ULOG.c +++ b/net/ipv4/netfilter/ipt_ULOG.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/skbuff.h> | 37 | #include <linux/skbuff.h> |
38 | #include <linux/kernel.h> | 38 | #include <linux/kernel.h> |
39 | #include <linux/timer.h> | 39 | #include <linux/timer.h> |
40 | #include <linux/netlink.h> | 40 | #include <net/netlink.h> |
41 | #include <linux/netdevice.h> | 41 | #include <linux/netdevice.h> |
42 | #include <linux/mm.h> | 42 | #include <linux/mm.h> |
43 | #include <linux/moduleparam.h> | 43 | #include <linux/moduleparam.h> |
@@ -172,7 +172,7 @@ static void ipt_ulog_packet(unsigned int hooknum, | |||
172 | else | 172 | else |
173 | copy_len = loginfo->copy_range; | 173 | copy_len = loginfo->copy_range; |
174 | 174 | ||
175 | size = NLMSG_SPACE(sizeof(*pm) + copy_len); | 175 | size = nlmsg_total_size(sizeof(*pm) + copy_len); |
176 | 176 | ||
177 | ub = &ulog_buffers[groupnum]; | 177 | ub = &ulog_buffers[groupnum]; |
178 | 178 | ||
diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c index 505b30ad9182..369a781851ad 100644 --- a/net/ipv4/udp_diag.c +++ b/net/ipv4/udp_diag.c | |||
@@ -64,9 +64,9 @@ static int udp_dump_one(struct udp_table *tbl, struct sk_buff *in_skb, | |||
64 | goto out; | 64 | goto out; |
65 | 65 | ||
66 | err = -ENOMEM; | 66 | err = -ENOMEM; |
67 | rep = alloc_skb(NLMSG_SPACE((sizeof(struct inet_diag_msg) + | 67 | rep = nlmsg_new(sizeof(struct inet_diag_msg) + |
68 | sizeof(struct inet_diag_meminfo) + | 68 | sizeof(struct inet_diag_meminfo) + 64, |
69 | 64)), GFP_KERNEL); | 69 | GFP_KERNEL); |
70 | if (!rep) | 70 | if (!rep) |
71 | goto out; | 71 | goto out; |
72 | 72 | ||
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 96bfb4e4b820..241fb8ad9fcf 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -842,9 +842,9 @@ static void ip6mr_destroy_unres(struct mr6_table *mrt, struct mfc6_cache *c) | |||
842 | if (ipv6_hdr(skb)->version == 0) { | 842 | if (ipv6_hdr(skb)->version == 0) { |
843 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct ipv6hdr)); | 843 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct ipv6hdr)); |
844 | nlh->nlmsg_type = NLMSG_ERROR; | 844 | nlh->nlmsg_type = NLMSG_ERROR; |
845 | nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr)); | 845 | nlh->nlmsg_len = nlmsg_msg_size(sizeof(struct nlmsgerr)); |
846 | skb_trim(skb, nlh->nlmsg_len); | 846 | skb_trim(skb, nlh->nlmsg_len); |
847 | ((struct nlmsgerr *)NLMSG_DATA(nlh))->error = -ETIMEDOUT; | 847 | ((struct nlmsgerr *)nlmsg_data(nlh))->error = -ETIMEDOUT; |
848 | rtnl_unicast(skb, net, NETLINK_CB(skb).portid); | 848 | rtnl_unicast(skb, net, NETLINK_CB(skb).portid); |
849 | } else | 849 | } else |
850 | kfree_skb(skb); | 850 | kfree_skb(skb); |
@@ -1100,13 +1100,13 @@ static void ip6mr_cache_resolve(struct net *net, struct mr6_table *mrt, | |||
1100 | if (ipv6_hdr(skb)->version == 0) { | 1100 | if (ipv6_hdr(skb)->version == 0) { |
1101 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct ipv6hdr)); | 1101 | struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct ipv6hdr)); |
1102 | 1102 | ||
1103 | if (__ip6mr_fill_mroute(mrt, skb, c, NLMSG_DATA(nlh)) > 0) { | 1103 | if (__ip6mr_fill_mroute(mrt, skb, c, nlmsg_data(nlh)) > 0) { |
1104 | nlh->nlmsg_len = skb_tail_pointer(skb) - (u8 *)nlh; | 1104 | nlh->nlmsg_len = skb_tail_pointer(skb) - (u8 *)nlh; |
1105 | } else { | 1105 | } else { |
1106 | nlh->nlmsg_type = NLMSG_ERROR; | 1106 | nlh->nlmsg_type = NLMSG_ERROR; |
1107 | nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr)); | 1107 | nlh->nlmsg_len = nlmsg_msg_size(sizeof(struct nlmsgerr)); |
1108 | skb_trim(skb, nlh->nlmsg_len); | 1108 | skb_trim(skb, nlh->nlmsg_len); |
1109 | ((struct nlmsgerr *)NLMSG_DATA(nlh))->error = -EMSGSIZE; | 1109 | ((struct nlmsgerr *)nlmsg_data(nlh))->error = -EMSGSIZE; |
1110 | } | 1110 | } |
1111 | rtnl_unicast(skb, net, NETLINK_CB(skb).portid); | 1111 | rtnl_unicast(skb, net, NETLINK_CB(skb).portid); |
1112 | } else | 1112 | } else |
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c index 1ba9dbc0e107..86f5e26f39d3 100644 --- a/net/netfilter/ipset/ip_set_core.c +++ b/net/netfilter/ipset/ip_set_core.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/ip.h> | 15 | #include <linux/ip.h> |
16 | #include <linux/skbuff.h> | 16 | #include <linux/skbuff.h> |
17 | #include <linux/spinlock.h> | 17 | #include <linux/spinlock.h> |
18 | #include <linux/netlink.h> | ||
19 | #include <linux/rculist.h> | 18 | #include <linux/rculist.h> |
20 | #include <net/netlink.h> | 19 | #include <net/netlink.h> |
21 | 20 | ||
@@ -1085,7 +1084,7 @@ static int | |||
1085 | dump_init(struct netlink_callback *cb) | 1084 | dump_init(struct netlink_callback *cb) |
1086 | { | 1085 | { |
1087 | struct nlmsghdr *nlh = nlmsg_hdr(cb->skb); | 1086 | struct nlmsghdr *nlh = nlmsg_hdr(cb->skb); |
1088 | int min_len = NLMSG_SPACE(sizeof(struct nfgenmsg)); | 1087 | int min_len = nlmsg_total_size(sizeof(struct nfgenmsg)); |
1089 | struct nlattr *cda[IPSET_ATTR_CMD_MAX+1]; | 1088 | struct nlattr *cda[IPSET_ATTR_CMD_MAX+1]; |
1090 | struct nlattr *attr = (void *)nlh + min_len; | 1089 | struct nlattr *attr = (void *)nlh + min_len; |
1091 | u32 dump_type; | 1090 | u32 dump_type; |
@@ -1301,7 +1300,7 @@ call_ad(struct sock *ctnl, struct sk_buff *skb, struct ip_set *set, | |||
1301 | struct sk_buff *skb2; | 1300 | struct sk_buff *skb2; |
1302 | struct nlmsgerr *errmsg; | 1301 | struct nlmsgerr *errmsg; |
1303 | size_t payload = sizeof(*errmsg) + nlmsg_len(nlh); | 1302 | size_t payload = sizeof(*errmsg) + nlmsg_len(nlh); |
1304 | int min_len = NLMSG_SPACE(sizeof(struct nfgenmsg)); | 1303 | int min_len = nlmsg_total_size(sizeof(struct nfgenmsg)); |
1305 | struct nlattr *cda[IPSET_ATTR_CMD_MAX+1]; | 1304 | struct nlattr *cda[IPSET_ATTR_CMD_MAX+1]; |
1306 | struct nlattr *cmdattr; | 1305 | struct nlattr *cmdattr; |
1307 | u32 *errline; | 1306 | u32 *errline; |
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index 0b1b32cda307..bc4c499adb13 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
@@ -24,10 +24,9 @@ | |||
24 | #include <linux/skbuff.h> | 24 | #include <linux/skbuff.h> |
25 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
26 | #include <net/sock.h> | 26 | #include <net/sock.h> |
27 | #include <net/netlink.h> | ||
28 | #include <linux/init.h> | 27 | #include <linux/init.h> |
29 | 28 | ||
30 | #include <linux/netlink.h> | 29 | #include <net/netlink.h> |
31 | #include <linux/netfilter/nfnetlink.h> | 30 | #include <linux/netfilter/nfnetlink.h> |
32 | 31 | ||
33 | MODULE_LICENSE("GPL"); | 32 | MODULE_LICENSE("GPL"); |
@@ -144,7 +143,7 @@ static int nfnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
144 | return -EPERM; | 143 | return -EPERM; |
145 | 144 | ||
146 | /* All the messages must at least contain nfgenmsg */ | 145 | /* All the messages must at least contain nfgenmsg */ |
147 | if (nlh->nlmsg_len < NLMSG_LENGTH(sizeof(struct nfgenmsg))) | 146 | if (nlmsg_len(nlh) < sizeof(struct nfgenmsg)) |
148 | return 0; | 147 | return 0; |
149 | 148 | ||
150 | type = nlh->nlmsg_type; | 149 | type = nlh->nlmsg_type; |
@@ -172,7 +171,7 @@ replay: | |||
172 | } | 171 | } |
173 | 172 | ||
174 | { | 173 | { |
175 | int min_len = NLMSG_SPACE(sizeof(struct nfgenmsg)); | 174 | int min_len = nlmsg_total_size(sizeof(struct nfgenmsg)); |
176 | u_int8_t cb_id = NFNL_MSG_TYPE(nlh->nlmsg_type); | 175 | u_int8_t cb_id = NFNL_MSG_TYPE(nlh->nlmsg_type); |
177 | struct nlattr *cda[ss->cb[cb_id].attr_count + 1]; | 176 | struct nlattr *cda[ss->cb[cb_id].attr_count + 1]; |
178 | struct nlattr *attr = (void *)nlh + min_len; | 177 | struct nlattr *attr = (void *)nlh + min_len; |
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index f248db572972..4a2593f100cb 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/ipv6.h> | 19 | #include <linux/ipv6.h> |
20 | #include <linux/netdevice.h> | 20 | #include <linux/netdevice.h> |
21 | #include <linux/netfilter.h> | 21 | #include <linux/netfilter.h> |
22 | #include <linux/netlink.h> | 22 | #include <net/netlink.h> |
23 | #include <linux/netfilter/nfnetlink.h> | 23 | #include <linux/netfilter/nfnetlink.h> |
24 | #include <linux/netfilter/nfnetlink_log.h> | 24 | #include <linux/netfilter/nfnetlink_log.h> |
25 | #include <linux/spinlock.h> | 25 | #include <linux/spinlock.h> |
@@ -609,7 +609,7 @@ nfulnl_log_packet(u_int8_t pf, | |||
609 | /* FIXME: do we want to make the size calculation conditional based on | 609 | /* FIXME: do we want to make the size calculation conditional based on |
610 | * what is actually present? way more branches and checks, but more | 610 | * what is actually present? way more branches and checks, but more |
611 | * memory efficient... */ | 611 | * memory efficient... */ |
612 | size = NLMSG_SPACE(sizeof(struct nfgenmsg)) | 612 | size = nlmsg_total_size(sizeof(struct nfgenmsg)) |
613 | + nla_total_size(sizeof(struct nfulnl_msg_packet_hdr)) | 613 | + nla_total_size(sizeof(struct nfulnl_msg_packet_hdr)) |
614 | + nla_total_size(sizeof(u_int32_t)) /* ifindex */ | 614 | + nla_total_size(sizeof(u_int32_t)) /* ifindex */ |
615 | + nla_total_size(sizeof(u_int32_t)) /* ifindex */ | 615 | + nla_total_size(sizeof(u_int32_t)) /* ifindex */ |
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c index 19845e34f70f..e92c9161e396 100644 --- a/net/netfilter/nfnetlink_queue_core.c +++ b/net/netfilter/nfnetlink_queue_core.c | |||
@@ -281,7 +281,7 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, | |||
281 | struct nf_conn *ct = NULL; | 281 | struct nf_conn *ct = NULL; |
282 | enum ip_conntrack_info uninitialized_var(ctinfo); | 282 | enum ip_conntrack_info uninitialized_var(ctinfo); |
283 | 283 | ||
284 | size = NLMSG_SPACE(sizeof(struct nfgenmsg)) | 284 | size = nlmsg_total_size(sizeof(struct nfgenmsg)) |
285 | + nla_total_size(sizeof(struct nfqnl_msg_packet_hdr)) | 285 | + nla_total_size(sizeof(struct nfqnl_msg_packet_hdr)) |
286 | + nla_total_size(sizeof(u_int32_t)) /* ifindex */ | 286 | + nla_total_size(sizeof(u_int32_t)) /* ifindex */ |
287 | + nla_total_size(sizeof(u_int32_t)) /* ifindex */ | 287 | + nla_total_size(sizeof(u_int32_t)) /* ifindex */ |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index a500ce201438..ce2e0064e7f6 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1646,7 +1646,7 @@ struct nlmsghdr * | |||
1646 | __nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, int type, int len, int flags) | 1646 | __nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, int type, int len, int flags) |
1647 | { | 1647 | { |
1648 | struct nlmsghdr *nlh; | 1648 | struct nlmsghdr *nlh; |
1649 | int size = NLMSG_LENGTH(len); | 1649 | int size = nlmsg_msg_size(len); |
1650 | 1650 | ||
1651 | nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size)); | 1651 | nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size)); |
1652 | nlh->nlmsg_type = type; | 1652 | nlh->nlmsg_type = type; |
@@ -1655,7 +1655,7 @@ __nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, int type, int len, int fla | |||
1655 | nlh->nlmsg_pid = portid; | 1655 | nlh->nlmsg_pid = portid; |
1656 | nlh->nlmsg_seq = seq; | 1656 | nlh->nlmsg_seq = seq; |
1657 | if (!__builtin_constant_p(size) || NLMSG_ALIGN(size) - size != 0) | 1657 | if (!__builtin_constant_p(size) || NLMSG_ALIGN(size) - size != 0) |
1658 | memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size); | 1658 | memset(nlmsg_data(nlh) + len, 0, NLMSG_ALIGN(size) - size); |
1659 | return nlh; | 1659 | return nlh; |
1660 | } | 1660 | } |
1661 | EXPORT_SYMBOL(__nlmsg_put); | 1661 | EXPORT_SYMBOL(__nlmsg_put); |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 9d71d4ded53b..5c81b2603239 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/skbuff.h> | 22 | #include <linux/skbuff.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/kmod.h> | 24 | #include <linux/kmod.h> |
25 | #include <linux/netlink.h> | 25 | #include <net/netlink.h> |
26 | #include <linux/err.h> | 26 | #include <linux/err.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <net/net_namespace.h> | 28 | #include <net/net_namespace.h> |
@@ -428,7 +428,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) | |||
428 | const struct Qdisc_class_ops *cops; | 428 | const struct Qdisc_class_ops *cops; |
429 | struct tcf_dump_args arg; | 429 | struct tcf_dump_args arg; |
430 | 430 | ||
431 | if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) | 431 | if (nlmsg_len(cb->nlh) < sizeof(*tcm)) |
432 | return skb->len; | 432 | return skb->len; |
433 | dev = __dev_get_by_index(net, tcm->tcm_ifindex); | 433 | dev = __dev_get_by_index(net, tcm->tcm_ifindex); |
434 | if (!dev) | 434 | if (!dev) |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index d7468baf890e..2b935e7cfe7b 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -1642,7 +1642,7 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) | |||
1642 | struct net_device *dev; | 1642 | struct net_device *dev; |
1643 | int t, s_t; | 1643 | int t, s_t; |
1644 | 1644 | ||
1645 | if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) | 1645 | if (nlmsg_len(cb->nlh) < sizeof(*tcm)) |
1646 | return 0; | 1646 | return 0; |
1647 | dev = dev_get_by_index(net, tcm->tcm_ifindex); | 1647 | dev = dev_get_by_index(net, tcm->tcm_ifindex); |
1648 | if (!dev) | 1648 | if (!dev) |
diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c index 6675914dc592..8bcd4985d0fb 100644 --- a/net/tipc/netlink.c +++ b/net/tipc/netlink.c | |||
@@ -44,7 +44,7 @@ static int handle_cmd(struct sk_buff *skb, struct genl_info *info) | |||
44 | struct nlmsghdr *rep_nlh; | 44 | struct nlmsghdr *rep_nlh; |
45 | struct nlmsghdr *req_nlh = info->nlhdr; | 45 | struct nlmsghdr *req_nlh = info->nlhdr; |
46 | struct tipc_genlmsghdr *req_userhdr = info->userhdr; | 46 | struct tipc_genlmsghdr *req_userhdr = info->userhdr; |
47 | int hdr_space = NLMSG_SPACE(GENL_HDRLEN + TIPC_GENL_HDRLEN); | 47 | int hdr_space = nlmsg_total_size(GENL_HDRLEN + TIPC_GENL_HDRLEN); |
48 | u16 cmd; | 48 | u16 cmd; |
49 | 49 | ||
50 | if ((req_userhdr->cmd & 0xC000) && (!capable(CAP_NET_ADMIN))) | 50 | if ((req_userhdr->cmd & 0xC000) && (!capable(CAP_NET_ADMIN))) |
@@ -53,8 +53,8 @@ static int handle_cmd(struct sk_buff *skb, struct genl_info *info) | |||
53 | cmd = req_userhdr->cmd; | 53 | cmd = req_userhdr->cmd; |
54 | 54 | ||
55 | rep_buf = tipc_cfg_do_cmd(req_userhdr->dest, cmd, | 55 | rep_buf = tipc_cfg_do_cmd(req_userhdr->dest, cmd, |
56 | NLMSG_DATA(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN, | 56 | nlmsg_data(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN, |
57 | NLMSG_PAYLOAD(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN), | 57 | nlmsg_attrlen(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN), |
58 | hdr_space); | 58 | hdr_space); |
59 | 59 | ||
60 | if (rep_buf) { | 60 | if (rep_buf) { |