宏NLMSG_DATA(nlh)用于取得消息的数据部分的首地址,设置和读取消息数据部分时需要使用该宏。
2 NLMSG_DATA #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) //用于取得消息的数据部分的首地址,设置和读取消息数据部分时,需要使用 附录 netlink协议清单 路由daemon(NETLINK_ROUTE) 1-wire 子系统(NETLINK_W1) 用户态 socket 协议(NETLINK_USERSOCK), 防火墙(NETLINK_FIREWALL...
这里,nlmsg_data(nlh) 是一个宏,用于获取 Netlink 消息的数据部分(即除了 nlmsghdr 之外的部分)。struct nlmsgerr 是一个用于表示错误消息的特定结构体,它通常包含一个 error 字段,用于表示错误代码。 4. 提供如何使用nlmsg_error的步骤或示例代码 下面是一个简单的示例,展示了如何使用 nlmsg_error 来处理 Netlin...
void *hdr = genlmsg_data(nlmsg_data(nlh)); if (genlmsg_end(msg, hdr) < 0) goto out; genlmsg_end(msg, hdr); return genlmsg_reply(msg, info); out: nlmsg_free(msg); return -ENOBUFS; } static const struct genl_ops ieee8021154_ops[] = {3...
Fixes data remnant seen when we fail to reserve space for a nexthop group during a larger dump. If we fail the reservation, we goto nla_put_failure and cancel the message. Reproduce with the following iproute2 commands: === ip link add dummy1 type dummy...
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b529ccf2799c14346d1518e9bdf1f88f03643e99
Signed-off-by: Hong Zhiguo <honk...@gmail.com> --- drivers/scsi/scsi_netlink.c | 4 +-- drivers/scsi/scsi_transport_fc.c | 21 +++++--- drivers/scsi/scsi_transport_iscsi.c | 56 ++++++++++--- 3 files changed, 38 insertions(+), 43 ...