The Netlink Socket Structures – Part 2

The Part 1 of ths Netlink socket structures discussion can be found in the below link.

The Netlink Socket Structures – Part 1

The netlink message is sent using a netlink message. The format of the netlink message is shown below

Fig Courtesy: https://people.redhat.com/nhorman/papers/netlink.pdf

The nlmsghdr is the netlink message header and is given below

Fig Courtesy: https://people.redhat.com/nhorman/papers/netlink.pdf

The parameters are described below

  • nlmsg_len – length of the packet including the header
  • nlmsg_type – The type of the message. Some message types are given below
    • NLMSG_NOOP – message is to be ignored
    • NLMSG_ERROR – error message. This is part of a structure and is provided below

Fig Courtesy: https://linux.die.net/man/7/netlink

    • NLMSG_DONE – sent in a multi-part netlink message signalling the end 
  • nlmsg_flags – this is a set of logically OR’ed bit-mask which determines what action needs to be performed on the message. Some examples are provided below. For further message flags – refer  (1) in the reference section
    • NLM_F_REQUEST – Request message
    • NLM_F_ACK – Ack to a previous packet
    • NLM_F_ECHO – associated packet is echoed back to user space process
    • NLM_F_MULTI – message is a multi-part message
    • NLM_F_MATCH – This flag indicates only a subset of data
      should be returned on a protocol specific GET request 
    • NLM_F_ROOT – Used With various data retrieval (GET) operations
      for various netlink protocols, request messages with this flag
      set indicate that an entire table of data should be returned rather
      than a single entry

and various other messages.

  • nlmsg_seq – a unique sequence number for the message
  • nlms_pid – a unique number associated with the process – can be the pid of the process using getpid () API

Reference:

  1. https://people.redhat.com/nhorman/papers/netlink.pdf
  2. https://www.infradead.org/~tgr/libnl/doc/core.html#:~:text=Message%20Format,by%20a%20stream%20of%20attributes.
  3. https://linux.die.net/man/7/netlink
  4. https://man7.org/linux/man-pages/man7/netlink.7.html

Netlink Message Macros

 

Comments

  1. Pingback: The Netlink Socket Structures – Part 1 | Hitch Hiker's Guide to Learning

  2. Pingback: Netlink Message Macros | Hitch Hiker's Guide to Learning

  3. Please let me know if you’re looking for a article author for your weblog.
    You have some really good articles and I think I would be
    a good asset. If you ever want to take some of the load off, I’d really like to write some material for your blog
    in exchange for a link back to mine. Please blast
    me an email if interested. Thanks!

  4. I am truly delighted to read this webpage posts which
    includes lots of useful information, thanks for providing these kinds of statistics.

  5. What’s up, I read your new stuff like every week. Your writing style is awesome,
    keep doing what you’re doing!

  6. You’re so interesting! I do not think I have read anything like that before.
    So wonderful to discover somebody with a few genuine thoughts on this topic.
    Really.. thanks for starting this up. This website is one thing that is needed on the web,
    someone with some originality!

Leave a Reply to thưởng thức sex học sinh cực hay Cancel reply

Your email address will not be published. Required fields are marked *