Commit 1da0faa3 authored by Thomas Graf's avatar Thomas Graf Committed by Marc Kleine-Budde

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: default avatarThomas Graf <tgraf@suug.ch>
Tested-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
Acked-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 732d35fd
......@@ -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++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment