Get all link and address information when listenning to a PF_NETLINK socket

淺唱寂寞╮ 提交于 2019-12-05 12:36:10

User space needs to wait for NLMSG_DONE netlink control message before sending next request to netlink socket. In other words, if you want to send several netlink requests in a row, then the sequence should look like this:

  1. Send req1
  2. Wait for NLMSG_DONE
  3. Send req2
  4. Wait for NLMSG_DONE
  5. ...

here is an answer I found in http://www.carisma.slowglass.com/~tgr/libnl/doc/core.html

Optionally, the kernel may send out notifications for configuration changes allowing userspace to listen for changes instead of polling frequently. Notifications typically reuse an existing message type and rely on the application using a separate socket to differ between requests and notifications but you may also specify a separate message type.

but not sure what this means:

but you may also specify a separate message type.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!