diff options
author | Jamal Hadi Salim <hadi@cyberus.ca> | 2005-06-19 01:54:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-06-19 01:54:12 -0400 |
commit | b6544c0b4cf2bd96195f3cdb7cebfb35090fc557 (patch) | |
tree | 717f69a0c204b12eeedb8035fb66c8e9bb2d5a09 /net/ipv4/devinet.c | |
parent | 1797754ea7ee5e0d859b0a32506ff999f8d5fb71 (diff) |
[NETLINK]: Correctly set NLM_F_MULTI without checking the pid
This patch rectifies some rtnetlink message builders that derive the
flags from the pid. It is now explicit like the other cases
which get it right. Also fixes half a dozen dumpers which did not
set NLM_F_MULTI at all.
Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/devinet.c')
-rw-r--r-- | net/ipv4/devinet.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 478a30179a52..fd47a1e890fa 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1030,14 +1030,13 @@ static struct notifier_block ip_netdev_notifier = { | |||
1030 | }; | 1030 | }; |
1031 | 1031 | ||
1032 | static int inet_fill_ifaddr(struct sk_buff *skb, struct in_ifaddr *ifa, | 1032 | static int inet_fill_ifaddr(struct sk_buff *skb, struct in_ifaddr *ifa, |
1033 | u32 pid, u32 seq, int event) | 1033 | u32 pid, u32 seq, int event, unsigned int flags) |
1034 | { | 1034 | { |
1035 | struct ifaddrmsg *ifm; | 1035 | struct ifaddrmsg *ifm; |
1036 | struct nlmsghdr *nlh; | 1036 | struct nlmsghdr *nlh; |
1037 | unsigned char *b = skb->tail; | 1037 | unsigned char *b = skb->tail; |
1038 | 1038 | ||
1039 | nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(*ifm)); | 1039 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*ifm), flags); |
1040 | if (pid) nlh->nlmsg_flags |= NLM_F_MULTI; | ||
1041 | ifm = NLMSG_DATA(nlh); | 1040 | ifm = NLMSG_DATA(nlh); |
1042 | ifm->ifa_family = AF_INET; | 1041 | ifm->ifa_family = AF_INET; |
1043 | ifm->ifa_prefixlen = ifa->ifa_prefixlen; | 1042 | ifm->ifa_prefixlen = ifa->ifa_prefixlen; |
@@ -1090,7 +1089,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) | |||
1090 | continue; | 1089 | continue; |
1091 | if (inet_fill_ifaddr(skb, ifa, NETLINK_CB(cb->skb).pid, | 1090 | if (inet_fill_ifaddr(skb, ifa, NETLINK_CB(cb->skb).pid, |
1092 | cb->nlh->nlmsg_seq, | 1091 | cb->nlh->nlmsg_seq, |
1093 | RTM_NEWADDR) <= 0) { | 1092 | RTM_NEWADDR, NLM_F_MULTI) <= 0) { |
1094 | rcu_read_unlock(); | 1093 | rcu_read_unlock(); |
1095 | goto done; | 1094 | goto done; |
1096 | } | 1095 | } |
@@ -1113,7 +1112,7 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa) | |||
1113 | 1112 | ||
1114 | if (!skb) | 1113 | if (!skb) |
1115 | netlink_set_err(rtnl, 0, RTMGRP_IPV4_IFADDR, ENOBUFS); | 1114 | netlink_set_err(rtnl, 0, RTMGRP_IPV4_IFADDR, ENOBUFS); |
1116 | else if (inet_fill_ifaddr(skb, ifa, 0, 0, event) < 0) { | 1115 | else if (inet_fill_ifaddr(skb, ifa, 0, 0, event, 0) < 0) { |
1117 | kfree_skb(skb); | 1116 | kfree_skb(skb); |
1118 | netlink_set_err(rtnl, 0, RTMGRP_IPV4_IFADDR, EINVAL); | 1117 | netlink_set_err(rtnl, 0, RTMGRP_IPV4_IFADDR, EINVAL); |
1119 | } else { | 1118 | } else { |