netlink.7: Clarify details of netlink error responses

Make it clear that netlink error responses (i.e., messages with
type NLMSG_ERROR (0x2)), can be longer than sizeof(struct
nlmsgerr). In certain circumstances, the payload can be longer.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Philipp Schuster 2021-02-20 23:48:36 +01:00 committed by Michael Kerrisk
parent 04fd7f3121
commit efbcc10934
1 changed files with 13 additions and 1 deletions

View File

@ -189,13 +189,25 @@ message signals an error and the payload contains an
.I nlmsgerr
structure,
.B NLMSG_DONE
message terminates a multipart message.
message terminates a multipart message. Error messages get the
original request appened, unless the user requests to cap the
error message, and get extra error data if requested.
.PP
.in +4n
.EX
struct nlmsgerr {
int error; /* Negative errno or 0 for acknowledgements */
struct nlmsghdr msg; /* Message header that caused the error */
/*
* followed by the message contents unless NETLINK_CAP_ACK was set
* or the ACK indicates success (error == 0).
* For example Generic Netlink message with attributes.
* message length is aligned with NLMSG_ALIGN()
*/
/*
* followed by TLVs defined in enum nlmsgerr_attrs
* if NETLINK_EXT_ACK was set
*/
};
.EE
.in