netlink: cope with growing requests
If a request ends up growing beyong the initially allocated space the
netlink functions (such as snl_add_msg_attr_u32()) will allocate a
new buffer. This invalidates the header pointer we can have received
from snl_create_msg_request(). Always use the hdr returned by
snl_finalize_msg().
Reviewed by: melifaro
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D42223
This commit is contained in:
@@ -86,7 +86,7 @@ ATF_TC_BODY(test_snl_get_genl_family_groups, tc)
|
||||
snl_init_writer(&ss, &nw);
|
||||
hdr = snl_create_genl_msg_request(&nw, GENL_ID_CTRL, CTRL_CMD_GETFAMILY);
|
||||
snl_add_msg_attr_string(&nw, CTRL_ATTR_FAMILY_NAME, "nlctrl");
|
||||
snl_finalize_msg(&nw);
|
||||
hdr = snl_finalize_msg(&nw);
|
||||
snl_send_message(&ss, hdr);
|
||||
|
||||
hdr = snl_read_reply(&ss, hdr->nlmsg_seq);
|
||||
|
||||
Reference in New Issue
Block a user