diff options
author | 2012-07-05 14:19:57 +0200 | |
---|---|---|
committer | 2012-07-10 22:36:01 +0200 | |
commit | 1da0faa3801e0dcb585b33266a2ac0842f26e58c (patch) | |
tree | 30d62927d4601adafc78574deecb7ed0eb3141e3 | |
parent | can: gw: Use nla_policy to validate netlink attributes (diff) | |
download | linux-1da0faa3801e0dcb585b33266a2ac0842f26e58c.tar.gz linux-1da0faa3801e0dcb585b33266a2ac0842f26e58c.tar.bz2 linux-1da0faa3801e0dcb585b33266a2ac0842f26e58c.zip |
can: gw: Properly fill the netlink header when responding to RTM_GETROUTE
- set message type to RTM_NEWROUTE
- relate to original request by inheriting the sequence and port number.
- set NLM_F_MULTI because it's a dump and more messages will follow
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Tested-by: Oliver Hartkopp <socketcan@hartkopp.net>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
-rw-r--r-- | net/can/gw.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/net/can/gw.c b/net/can/gw.c index a1c639c730a3..20c36e10ce85 100644 --- a/net/can/gw.c +++ b/net/can/gw.c @@ -444,11 +444,14 @@ static int cgw_notifier(struct notifier_block *nb, return NOTIFY_DONE; } -static int cgw_put_job(struct sk_buff *skb, struct cgw_job *gwj) +static int cgw_put_job(struct sk_buff *skb, struct cgw_job *gwj, int type, + u32 pid, u32 seq, int flags) { struct cgw_frame_mod mb; struct rtcanmsg *rtcan; - struct nlmsghdr *nlh = nlmsg_put(skb, 0, 0, 0, sizeof(*rtcan), 0); + struct nlmsghdr *nlh; + + nlh = nlmsg_put(skb, pid, seq, type, sizeof(*rtcan), flags); if (!nlh) return -EMSGSIZE; @@ -546,7 +549,8 @@ static int cgw_dump_jobs(struct sk_buff *skb, struct netlink_callback *cb) if (idx < s_idx) goto cont; - if (cgw_put_job(skb, gwj) < 0) + if (cgw_put_job(skb, gwj, RTM_NEWROUTE, NETLINK_CB(cb->skb).pid, + cb->nlh->nlmsg_seq, NLM_F_MULTI) < 0) break; cont: idx++; |