const char *name;
uint8_t family;
uint32_t table_flags;
+ uint32_t use;
uint32_t flags;
};
case NFT_TABLE_ATTR_FLAGS:
case NFT_TABLE_ATTR_FAMILY:
break;
+ case NFT_TABLE_ATTR_USE:
+ /* Cannot be unset, ignoring it */
+ return;
}
t->flags &= ~(1 << attr);
}
t->family = *((uint8_t *)data);
t->flags |= (1 << NFT_TABLE_ATTR_FAMILY);
break;
+ case NFT_TABLE_ATTR_USE:
+ /* Cannot be unset, ignoring it */
+ break;
}
}
EXPORT_SYMBOL(nft_table_attr_set);
return &t->table_flags;
case NFT_TABLE_ATTR_FAMILY:
return &t->family;
+ case NFT_TABLE_ATTR_USE:
+ return &t->use;
}
return NULL;
}
return MNL_CB_ERROR;
}
break;
+ case NFTA_TABLE_USE:
+ if (mnl_attr_validate(attr, MNL_TYPE_U32) < 0) {
+ perror("mnl_attr_validate");
+ return MNL_CB_ERROR;
+ }
+ break;
}
tb[type] = attr;
t->table_flags = ntohl(mnl_attr_get_u32(tb[NFTA_TABLE_FLAGS]));
t->flags |= (1 << NFT_TABLE_ATTR_FLAGS);
}
+ if (tb[NFTA_TABLE_USE]) {
+ t->use = ntohl(mnl_attr_get_u32(tb[NFTA_TABLE_USE]));
+ t->flags |= (1 << NFT_TABLE_ATTR_USE);
+ }
t->family = nfg->nfgen_family;
t->flags |= (1 << NFT_TABLE_ATTR_FAMILY);
"{\"table\":{"
"\"name\":\"%s\","
"\"family\":\"%s\","
- "\"flags\":%d"
+ "\"flags\":%d,"
+ "\"use\":%d"
"}"
"}" ,
- t->name, nft_family2str(t->family), t->table_flags);
+ t->name, nft_family2str(t->family),
+ t->table_flags, t->use);
}
static int nft_table_snprintf_xml(char *buf, size_t size, struct nft_table *t)
{
return snprintf(buf, size, "<table><name>%s</name><family>%s</family>"
- "<flags>%d</flags></table>",
- t->name, nft_family2str(t->family), t->table_flags);
+ "<flags>%d</flags><use>%d</use></table>",
+ t->name, nft_family2str(t->family),
+ t->table_flags, t->use);
}
static int nft_table_snprintf_default(char *buf, size_t size, struct nft_table *t)
{
- return snprintf(buf, size, "table %s %s flags %x",
- t->name, nft_family2str(t->family), t->table_flags);
+ return snprintf(buf, size, "table %s %s flags %x use %d",
+ t->name, nft_family2str(t->family),
+ t->table_flags, t->use);
}
int nft_table_snprintf(char *buf, size_t size, struct nft_table *t,