n = setsockopt(netlink_sock, SOL_NETLINK, NETLINK_CAP_ACK,
&one, sizeof(one));
ASSERT_EQ(n, 0);
n = setsockopt(netlink_sock, SOL_NETLINK, NETLINK_EXT_ACK,
&one, sizeof(one));
ASSERT_EQ(n, 0);
n = setsockopt(netlink_sock, SOL_NETLINK, NETLINK_GET_STRICT_CHK,
&one, sizeof(one));
ASSERT_EQ(n, 0);
/* Dump so many times we fill up the buffer */
cnt = 80; for (i = 0; i < cnt; i++) {
n = send(netlink_sock, &dump_neigh_bad, sizeof(dump_neigh_bad), 0);
ASSERT_EQ(n, sizeof(dump_neigh_bad));
}
/* Read out the ENOBUFS */
n = recv(netlink_sock, buf, sizeof(buf), MSG_DONTWAIT);
EXPECT_EQ(n, -1);
EXPECT_EQ(errno, ENOBUFS);
for (i = 0; i < cnt; i++) { struct ext_ack ea = {};
n = recv(netlink_sock, buf, sizeof(buf), MSG_DONTWAIT); if (n < 0) {
ASSERT_GE(i, 10); break;
}
ASSERT_GE(n, (ssize_t)sizeof(struct nlmsghdr));
ret = nl_get_extack(buf, n, &ea); /* Once we fill the buffer we'll see one ENOBUFS followed * by a number of EBUSYs. Then the last recv() will finally * trigger and complete the dump.
*/ if (ret == FOUND_ERR && (ea.err == ENOBUFS || ea.err == EBUSY)) continue;
EXPECT_EQ(ret, FOUND_EXTACK);
EXPECT_EQ(ea.err, EINVAL);
EXPECT_EQ(ea.attr_offs, sizeof(struct nlmsghdr) + sizeof(struct ndmsg));
} /* Make sure last message was a full DONE+extack */
EXPECT_EQ(ret, FOUND_EXTACK);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.