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/route.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/route.c')
-rw-r--r-- | net/ipv4/route.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index a682d28e247b..f4d53c919869 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2581,7 +2581,7 @@ int ip_route_output_key(struct rtable **rp, struct flowi *flp) | |||
2581 | } | 2581 | } |
2582 | 2582 | ||
2583 | static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | 2583 | static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, |
2584 | int nowait) | 2584 | int nowait, unsigned int flags) |
2585 | { | 2585 | { |
2586 | struct rtable *rt = (struct rtable*)skb->dst; | 2586 | struct rtable *rt = (struct rtable*)skb->dst; |
2587 | struct rtmsg *r; | 2587 | struct rtmsg *r; |
@@ -2591,9 +2591,8 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
2591 | #ifdef CONFIG_IP_MROUTE | 2591 | #ifdef CONFIG_IP_MROUTE |
2592 | struct rtattr *eptr; | 2592 | struct rtattr *eptr; |
2593 | #endif | 2593 | #endif |
2594 | nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(*r)); | 2594 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*r), flags); |
2595 | r = NLMSG_DATA(nlh); | 2595 | r = NLMSG_DATA(nlh); |
2596 | nlh->nlmsg_flags = (nowait && pid) ? NLM_F_MULTI : 0; | ||
2597 | r->rtm_family = AF_INET; | 2596 | r->rtm_family = AF_INET; |
2598 | r->rtm_dst_len = 32; | 2597 | r->rtm_dst_len = 32; |
2599 | r->rtm_src_len = 0; | 2598 | r->rtm_src_len = 0; |
@@ -2744,7 +2743,7 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) | |||
2744 | NETLINK_CB(skb).dst_pid = NETLINK_CB(in_skb).pid; | 2743 | NETLINK_CB(skb).dst_pid = NETLINK_CB(in_skb).pid; |
2745 | 2744 | ||
2746 | err = rt_fill_info(skb, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq, | 2745 | err = rt_fill_info(skb, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq, |
2747 | RTM_NEWROUTE, 0); | 2746 | RTM_NEWROUTE, 0, 0); |
2748 | if (!err) | 2747 | if (!err) |
2749 | goto out_free; | 2748 | goto out_free; |
2750 | if (err < 0) { | 2749 | if (err < 0) { |
@@ -2781,8 +2780,8 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
2781 | continue; | 2780 | continue; |
2782 | skb->dst = dst_clone(&rt->u.dst); | 2781 | skb->dst = dst_clone(&rt->u.dst); |
2783 | if (rt_fill_info(skb, NETLINK_CB(cb->skb).pid, | 2782 | if (rt_fill_info(skb, NETLINK_CB(cb->skb).pid, |
2784 | cb->nlh->nlmsg_seq, | 2783 | cb->nlh->nlmsg_seq, RTM_NEWROUTE, |
2785 | RTM_NEWROUTE, 1) <= 0) { | 2784 | 1, NLM_F_MULTI) <= 0) { |
2786 | dst_release(xchg(&skb->dst, NULL)); | 2785 | dst_release(xchg(&skb->dst, NULL)); |
2787 | rcu_read_unlock_bh(); | 2786 | rcu_read_unlock_bh(); |
2788 | goto done; | 2787 | goto done; |