struct mnl_socket *nft_mnl_socket_reopen(struct mnl_socket *nf_sock);
uint32_t mnl_seqnum_alloc(uint32_t *seqnum);
-uint16_t mnl_genid_get(struct netlink_ctx *ctx);
+uint32_t mnl_genid_get(struct netlink_ctx *ctx);
struct mnl_err {
struct list_head head;
/*
* Rule-set consistency check across several netlink dumps
*/
-static uint16_t nft_genid;
+static uint32_t nft_genid;
static int genid_cb(const struct nlmsghdr *nlh, void *data)
{
return MNL_CB_OK;
}
-uint16_t mnl_genid_get(struct netlink_ctx *ctx)
+uint32_t mnl_genid_get(struct netlink_ctx *ctx)
{
char buf[MNL_SOCKET_BUFFER_SIZE];
struct nlmsghdr *nlh;
return nft_genid;
}
+static uint16_t nft_genid_u16(uint32_t genid)
+{
+ return genid & 0xffff;
+}
+
static int check_genid(const struct nlmsghdr *nlh)
{
struct nfgenmsg *nfh = mnl_nlmsg_get_payload(nlh);
- if (nft_genid != ntohs(nfh->res_id)) {
+ if (nft_genid_u16(nft_genid) != ntohs(nfh->res_id)) {
errno = EINTR;
return -1;
}
int cache_update(struct nft_ctx *nft, enum cmd_ops cmd, struct list_head *msgs)
{
- uint16_t genid;
- int ret;
struct netlink_ctx ctx = {
.list = LIST_HEAD_INIT(ctx.list),
.nft = nft,
.nft = nft,
};
struct nft_cache *cache = &nft->cache;
-
+ uint32_t genid;
+ int ret;
replay:
ctx.seqnum = cache->seqnum++;
genid = mnl_genid_get(&ctx);