aboutsummaryrefslogtreecommitdiffstats
path: root/net/can/gw.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2012-07-05 08:19:57 -0400
committerMarc Kleine-Budde <mkl@pengutronix.de>2012-07-10 16:36:01 -0400
commit1da0faa3801e0dcb585b33266a2ac0842f26e58c (patch)
tree30d62927d4601adafc78574deecb7ed0eb3141e3 /net/can/gw.c
parent732d35fd08058a678327ec908528fcc9514c9e48 (diff)
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>
Diffstat (limited to 'net/can/gw.c')
-rw-r--r--net/can/gw.c10
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,
444 return NOTIFY_DONE; 444 return NOTIFY_DONE;
445} 445}
446 446
447static int cgw_put_job(struct sk_buff *skb, struct cgw_job *gwj) 447static int cgw_put_job(struct sk_buff *skb, struct cgw_job *gwj, int type,
448 u32 pid, u32 seq, int flags)
448{ 449{
449 struct cgw_frame_mod mb; 450 struct cgw_frame_mod mb;
450 struct rtcanmsg *rtcan; 451 struct rtcanmsg *rtcan;
451 struct nlmsghdr *nlh = nlmsg_put(skb, 0, 0, 0, sizeof(*rtcan), 0); 452 struct nlmsghdr *nlh;
453
454 nlh = nlmsg_put(skb, pid, seq, type, sizeof(*rtcan), flags);
452 if (!nlh) 455 if (!nlh)
453 return -EMSGSIZE; 456 return -EMSGSIZE;
454 457
@@ -546,7 +549,8 @@ static int cgw_dump_jobs(struct sk_buff *skb, struct netlink_callback *cb)
546 if (idx < s_idx) 549 if (idx < s_idx)
547 goto cont; 550 goto cont;
548 551
549 if (cgw_put_job(skb, gwj) < 0) 552 if (cgw_put_job(skb, gwj, RTM_NEWROUTE, NETLINK_CB(cb->skb).pid,
553 cb->nlh->nlmsg_seq, NLM_F_MULTI) < 0)
550 break; 554 break;
551cont: 555cont:
552 idx++; 556 idx++;