Hi Marcel,
Attaching a patch which implements a generic netlink command
GET_DEVLIST(HCIGETDEVLIST).
1. Will the netlink plugin expose an API like
int hci_get_devlist(struct hci_dev_list_req *dl) ?
2. If netlink registration fails would we fallback to raw sockets in the
plugin ?
Let me know if anything in the patch needs modification.
Thanks,
Alok.
Hi Marcel,
Attaching a modified netlink patch.
Forgot to free the buffer :) Thanks to ville for spotting it.
-Alok.
Hi Alok,
ext Alok wrote:
> Hi Marcel,
>
> Attaching a patch which implements a generic netlink command
> GET_DEVLIST(HCIGETDEVLIST).
I don't know anything about netlink stuff but I'll give some generic comments :)
+
+ if (info->attrs[NLBLUETOOTH_ATTR_DEVNUM]) {
+ dev_num = nla_get_u16(info->attrs[NLBLUETOOTH_ATTR_DEVNUM]);
+ if (!dev_num)
+ return -EINVAL;
+ } else
+ return -EINVAL;
+
I would prefer this kind code paths. Easier to read.
if (!info->attrs[NLBLUETOOTH_ATTR_DEVNUM])
return -EINVAL;
dev_num = nla_get_u16(info->attrs[NLBLUETOOTH_ATTR_DEVNUM]);
if (!dev_num)
return -EINVAL;
+ msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
+
+ if (!msg)
+ return -ENOBUFS;
+
+ hdr = genlmsg_put(msg, 0, info->snd_seq+1, &nlbluetooth_fam, 0, NLBLUETOOTH_CMD_GET_DEVLIST);
+
+ if (hdr == NULL)
+ return -ENOMEM;
Is msg left unfreed here?
+
+ nl_list = nla_nest_start(msg, NLBLUETOOTH_ATTR_DEVLIST);
+ if (!nl_list)
+ goto nla_put_failure;
And here? I cannot find skb_free or friends from genlmsg_cancel() path.
--
Ville