Lines Matching refs:type

332 	if (basechain->type->ops_register)
333 return basechain->type->ops_register(net, ops);
355 if (basechain->type->ops_unregister)
356 return basechain->type->ops_unregister(net, ops);
636 .type = NFT_ITER_UPDATE,
845 __nft_chain_type_get(u8 family, enum nft_chain_types type)
848 type >= NFT_CHAIN_T_MAX)
851 return chain_type[family][type];
857 const struct nft_chain_type *type;
861 type = __nft_chain_type_get(family, i);
862 if (!type)
864 if (!nla_strcmp(nla, type->name))
865 return type;
928 const struct nft_chain_type *type;
930 type = __nf_tables_chain_type_lookup(nla, family);
931 if (type != NULL)
932 return type;
954 [NFTA_TABLE_NAME] = { .type = NLA_STRING,
956 [NFTA_TABLE_FLAGS] = { .type = NLA_U32 },
957 [NFTA_TABLE_HANDLE] = { .type = NLA_U64 },
958 [NFTA_TABLE_USERDATA] = { .type = NLA_BINARY,
1632 if (WARN_ON(__nft_chain_type_get(ctype->family, ctype->type))) {
1636 chain_type[ctype->family][ctype->type] = ctype;
1644 chain_type[ctype->family][ctype->type] = NULL;
1711 [NFTA_CHAIN_TABLE] = { .type = NLA_STRING,
1713 [NFTA_CHAIN_HANDLE] = { .type = NLA_U64 },
1714 [NFTA_CHAIN_NAME] = { .type = NLA_STRING,
1716 [NFTA_CHAIN_HOOK] = { .type = NLA_NESTED },
1717 [NFTA_CHAIN_POLICY] = { .type = NLA_U32 },
1718 [NFTA_CHAIN_TYPE] = { .type = NLA_STRING,
1720 [NFTA_CHAIN_COUNTERS] = { .type = NLA_NESTED },
1721 [NFTA_CHAIN_FLAGS] = { .type = NLA_U32 },
1722 [NFTA_CHAIN_ID] = { .type = NLA_U32 },
1723 [NFTA_CHAIN_USERDATA] = { .type = NLA_BINARY,
1728 [NFTA_HOOK_HOOKNUM] = { .type = NLA_U32 },
1729 [NFTA_HOOK_PRIORITY] = { .type = NLA_U32 },
1730 [NFTA_HOOK_DEV] = { .type = NLA_STRING,
1856 if (nla_put_string(skb, NFTA_CHAIN_TYPE, basechain->type->name))
2017 [NFTA_COUNTER_PACKETS] = { .type = NLA_U64 },
2018 [NFTA_COUNTER_BYTES] = { .type = NLA_U64 },
2102 module_put(basechain->type->owner);
2213 const struct nft_chain_type *type;
2255 const struct nft_chain_type *type;
2277 type = __nft_chain_type_get(family, NFT_CHAIN_T_DEFAULT);
2278 if (!type)
2282 type = nf_tables_chain_type_lookup(net, nla[NFTA_CHAIN_TYPE],
2284 if (IS_ERR(type)) {
2286 return PTR_ERR(type);
2289 if (hook->num >= NFT_MAX_HOOKS || !(type->hook_mask & (1 << hook->num)))
2292 if (type->type == NFT_CHAIN_T_NAT &&
2308 type = __nf_tables_chain_type_lookup(nla[NFTA_CHAIN_TYPE],
2310 if (!type) {
2315 type = basechain->type;
2319 if (!try_module_get(type->owner)) {
2325 hook->type = type;
2331 module_put(type->owner);
2335 module_put(type->owner);
2350 module_put(hook->type->owner);
2393 ops->hook = hook->type->hooks[ops->hooknum];
2403 basechain->type = hook->type;
2622 if (basechain->type != hook.type) {
2745 module_put(hook.type->owner);
2762 module_put(hook.type->owner);
3031 * nft_register_expr - register nf_tables expr type
3032 * @type: expr type
3034 * Registers the expr type for use with nf_tables. Returns zero on
3037 int nft_register_expr(struct nft_expr_type *type)
3039 if (WARN_ON_ONCE(type->maxattr > NFT_EXPR_MAXATTR))
3043 if (type->family == NFPROTO_UNSPEC)
3044 list_add_tail_rcu(&type->list, &nf_tables_expressions);
3046 list_add_rcu(&type->list, &nf_tables_expressions);
3053 * nft_unregister_expr - unregister nf_tables expr type
3054 * @type: expr type
3058 void nft_unregister_expr(struct nft_expr_type *type)
3061 list_del_rcu(&type->list);
3069 const struct nft_expr_type *type, *candidate = NULL;
3071 list_for_each_entry_rcu(type, &nf_tables_expressions, list) {
3072 if (!nla_strcmp(nla, type->name)) {
3073 if (!type->family && !candidate)
3074 candidate = type;
3075 else if (type->family == family)
3076 candidate = type;
3098 const struct nft_expr_type *type;
3104 type = __nft_expr_type_get(family, nla);
3105 if (type != NULL && try_module_get(type->owner)) {
3107 return type;
3113 if (type == NULL) {
3127 [NFTA_EXPR_NAME] = { .type = NLA_STRING,
3129 [NFTA_EXPR_DATA] = { .type = NLA_NESTED },
3135 if (nla_put_string(skb, NFTA_EXPR_NAME, expr->ops->type->name))
3181 const struct nft_expr_type *type;
3191 type = nft_expr_type_get(ctx->net, ctx->family, tb[NFTA_EXPR_NAME]);
3192 if (IS_ERR(type))
3193 return PTR_ERR(type);
3196 err = nla_parse_nested_deprecated(info->tb, type->maxattr,
3198 type->policy, NULL);
3202 memset(info->tb, 0, sizeof(info->tb[0]) * (type->maxattr + 1));
3204 if (type->select_ops != NULL) {
3205 ops = type->select_ops(ctx,
3219 ops = type->ops;
3227 module_put(type->owner);
3235 const struct nft_expr_type *type;
3246 type = __nft_expr_type_get(ctx->family, tb[NFTA_EXPR_NAME]);
3247 if (!type)
3250 if (!type->inner_ops)
3253 err = nla_parse_nested_deprecated(info->tb, type->maxattr,
3255 type->policy, NULL);
3260 info->ops = type->inner_ops;
3291 const struct nft_expr_type *type = expr->ops->type;
3295 module_put(type->owner);
3311 if (!(expr_info.ops->type->flags & NFT_EXPR_STATEFUL))
3327 owner = expr_info.ops->type->owner;
3328 if (expr_info.ops->type->release_ops)
3329 expr_info.ops->type->release_ops(expr_info.ops);
3348 __module_get(src->ops->type->owner);
3387 [NFTA_RULE_TABLE] = { .type = NLA_STRING,
3389 [NFTA_RULE_CHAIN] = { .type = NLA_STRING,
3391 [NFTA_RULE_HANDLE] = { .type = NLA_U64 },
3393 [NFTA_RULE_COMPAT] = { .type = NLA_NESTED },
3394 [NFTA_RULE_POSITION] = { .type = NLA_U64 },
3395 [NFTA_RULE_USERDATA] = { .type = NLA_BINARY,
3397 [NFTA_RULE_ID] = { .type = NLA_U32 },
3398 [NFTA_RULE_POSITION_ID] = { .type = NLA_U32 },
3399 [NFTA_RULE_CHAIN_ID] = { .type = NLA_U32 },
3413 u16 type = nfnl_msg_type(NFNL_SUBSYS_NFTABLES, event);
3415 nlh = nfnl_msg_put(skb, portid, seq, type, flags, family, NFNETLINK_V0,
4171 module_put(expr_info[i].ops->type->owner);
4172 if (expr_info[i].ops->type->release_ops)
4173 expr_info[i].ops->type->release_ops(expr_info[i].ops);
4295 static bool nft_set_ops_candidate(const struct nft_set_type *type, u32 flags)
4297 return (flags & type->features) == (flags & NFT_SET_FEATURES);
4312 const struct nft_set_type *type;
4324 type = nft_set_types[i];
4325 ops = &type->ops;
4327 if (!nft_set_ops_candidate(type, flags))
4366 [NFTA_SET_TABLE] = { .type = NLA_STRING,
4368 [NFTA_SET_NAME] = { .type = NLA_STRING,
4370 [NFTA_SET_FLAGS] = { .type = NLA_U32 },
4371 [NFTA_SET_KEY_TYPE] = { .type = NLA_U32 },
4372 [NFTA_SET_KEY_LEN] = { .type = NLA_U32 },
4373 [NFTA_SET_DATA_TYPE] = { .type = NLA_U32 },
4374 [NFTA_SET_DATA_LEN] = { .type = NLA_U32 },
4375 [NFTA_SET_POLICY] = { .type = NLA_U32 },
4376 [NFTA_SET_DESC] = { .type = NLA_NESTED },
4377 [NFTA_SET_ID] = { .type = NLA_U32 },
4378 [NFTA_SET_TIMEOUT] = { .type = NLA_U64 },
4379 [NFTA_SET_GC_INTERVAL] = { .type = NLA_U32 },
4380 [NFTA_SET_USERDATA] = { .type = NLA_BINARY,
4382 [NFTA_SET_OBJ_TYPE] = { .type = NLA_U32 },
4383 [NFTA_SET_HANDLE] = { .type = NLA_U64 },
4384 [NFTA_SET_EXPR] = { .type = NLA_NESTED },
4389 [NFTA_SET_FIELD_LEN] = { .type = NLA_U32 },
4393 [NFTA_SET_DESC_SIZE] = { .type = NLA_U32 },
5396 enum nft_data_types type,
5467 iter.type = NFT_ITER_UPDATE;
5549 .type = NFT_ITER_UPDATE,
5657 [NFTA_SET_ELEM_KEY] = { .type = NLA_NESTED },
5658 [NFTA_SET_ELEM_DATA] = { .type = NLA_NESTED },
5659 [NFTA_SET_ELEM_FLAGS] = { .type = NLA_U32 },
5660 [NFTA_SET_ELEM_TIMEOUT] = { .type = NLA_U64 },
5661 [NFTA_SET_ELEM_EXPIRATION] = { .type = NLA_U64 },
5662 [NFTA_SET_ELEM_USERDATA] = { .type = NLA_BINARY,
5664 [NFTA_SET_ELEM_EXPR] = { .type = NLA_NESTED },
5665 [NFTA_SET_ELEM_OBJREF] = { .type = NLA_STRING,
5667 [NFTA_SET_ELEM_KEY_END] = { .type = NLA_NESTED },
5672 [NFTA_SET_ELEM_LIST_TABLE] = { .type = NLA_STRING,
5674 [NFTA_SET_ELEM_LIST_SET] = { .type = NLA_STRING,
5677 [NFTA_SET_ELEM_LIST_SET_ID] = { .type = NLA_U32 },
5927 args.iter.type = NFT_ITER_READ;
6053 .type = NFT_DATA_VALUE,
6073 desc->type = dtype;
6375 if (expr->ops->type->flags & NFT_EXPR_GC) {
6463 module_put(expr->ops->type->owner);
7018 desc.type, desc.len);
7022 if (desc.type == NFT_DATA_VERDICT &&
7134 nft_data_release(&elem.data.val, desc.type);
7204 * @type: type of data
7211 void nft_data_hold(const struct nft_data *data, enum nft_data_types type)
7215 if (type == NFT_DATA_VERDICT) {
7426 .type = NFT_ITER_UPDATE,
7495 * nft_register_obj- register nf_tables stateful object type
7496 * @obj_type: object type
7498 * Registers the object type for use with nf_tables. Returns zero on
7503 if (obj_type->type == NFT_OBJECT_UNSPEC)
7514 * nft_unregister_obj - unregister nf_tables object type
7515 * @obj_type: object type
7517 * Unregisters the object type for use with nf_tables.
7549 if (objtype == obj->ops->type->type &&
7569 objtype == obj->ops->type->type &&
7577 [NFTA_OBJ_TABLE] = { .type = NLA_STRING,
7579 [NFTA_OBJ_NAME] = { .type = NLA_STRING,
7581 [NFTA_OBJ_TYPE] = { .type = NLA_U32 },
7582 [NFTA_OBJ_DATA] = { .type = NLA_NESTED },
7583 [NFTA_OBJ_HANDLE] = { .type = NLA_U64},
7584 [NFTA_OBJ_USERDATA] = { .type = NLA_BINARY,
7589 const struct nft_object_type *type,
7597 tb = kmalloc_array(type->maxattr + 1, sizeof(*tb), GFP_KERNEL);
7602 err = nla_parse_nested_deprecated(tb, type->maxattr, attr,
7603 type->policy, NULL);
7607 memset(tb, 0, sizeof(tb[0]) * (type->maxattr + 1));
7610 if (type->select_ops) {
7611 ops = type->select_ops(ctx, (const struct nlattr * const *)tb);
7617 ops = type->ops;
7660 const struct nft_object_type *type;
7662 list_for_each_entry_rcu(type, &nf_tables_objects, list) {
7663 if (type->family != NFPROTO_UNSPEC &&
7664 type->family != family)
7667 if (objtype == type->type)
7668 return type;
7676 const struct nft_object_type *type;
7679 type = __nft_obj_type_get(objtype, family);
7680 if (type != NULL && try_module_get(type->owner)) {
7682 return type;
7688 if (type == NULL) {
7697 const struct nft_object_type *type,
7705 if (!try_module_get(type->owner))
7713 newobj = nft_obj_init(ctx, type, attr);
7729 module_put(type->owner);
7739 const struct nft_object_type *type;
7775 type = __nft_obj_type_get(objtype, family);
7776 if (WARN_ON_ONCE(!type))
7781 return nf_tables_updobj(&ctx, type, nla[NFTA_OBJ_DATA], obj);
7789 type = nft_obj_type_get(net, objtype, family);
7790 if (IS_ERR(type)) {
7791 err = PTR_ERR(type);
7795 obj = nft_obj_init(&ctx, type, nla[NFTA_OBJ_DATA]);
7842 module_put(type->owner);
7873 if (nla_put_be32(skb, NFTA_OBJ_TYPE, htonl(obj->ops->type->type)) ||
7903 u32 type;
7936 if (ctx->type != NFT_OBJECT_UNSPEC &&
7937 obj->ops->type->type != ctx->type)
7980 ctx->type = ntohl(nla_get_be32(nla[NFTA_OBJ_TYPE]));
8081 module_put(obj->ops->type->owner);
8202 void nft_register_flowtable_type(struct nf_flowtable_type *type)
8205 list_add_tail_rcu(&type->list, &nf_tables_flowtables);
8210 void nft_unregister_flowtable_type(struct nf_flowtable_type *type)
8213 list_del_rcu(&type->list);
8219 [NFTA_FLOWTABLE_TABLE] = { .type = NLA_STRING,
8221 [NFTA_FLOWTABLE_NAME] = { .type = NLA_STRING,
8223 [NFTA_FLOWTABLE_HOOK] = { .type = NLA_NESTED },
8224 [NFTA_FLOWTABLE_HANDLE] = { .type = NLA_U64 },
8225 [NFTA_FLOWTABLE_FLAGS] = { .type = NLA_U32 },
8280 [NFTA_FLOWTABLE_HOOK_NUM] = { .type = NLA_U32 },
8281 [NFTA_FLOWTABLE_HOOK_PRIORITY] = { .type = NLA_U32 },
8282 [NFTA_FLOWTABLE_HOOK_DEVS] = { .type = NLA_NESTED },
8350 hook->ops.hook = flowtable->data.type->hook;
8359 const struct nf_flowtable_type *type;
8361 list_for_each_entry_rcu(type, &nf_tables_flowtables, list) {
8362 if (family == type->family)
8363 return type;
8371 const struct nf_flowtable_type *type;
8374 type = __nft_flowtable_type_get(family);
8375 if (type != NULL && try_module_get(type->owner)) {
8377 return type;
8383 if (type == NULL) {
8397 flowtable->data.type->setup(&flowtable->data, hook->ops.dev,
8445 err = flowtable->data.type->setup(&flowtable->data,
8453 flowtable->data.type->setup(&flowtable->data,
8569 const struct nf_flowtable_type *type;
8629 type = nft_flowtable_type_get(net, family);
8630 if (IS_ERR(type)) {
8631 err = PTR_ERR(type);
8645 flowtable->data.type = type;
8646 err = type->init(&flowtable->data);
8681 flowtable->data.type->free(&flowtable->data);
8683 module_put(type->owner);
9058 flowtable->data.type->free(&flowtable->data);
9060 flowtable->data.type->setup(&flowtable->data, hook->ops.dev,
9066 module_put(flowtable->data.type->owner);
9197 .type = NFNL_CB_BATCH,
9203 .type = NFNL_CB_RCU,
9209 .type = NFNL_CB_BATCH,
9215 .type = NFNL_CB_BATCH,
9221 .type = NFNL_CB_BATCH,
9227 .type = NFNL_CB_RCU,
9233 .type = NFNL_CB_BATCH,
9239 .type = NFNL_CB_BATCH,
9245 .type = NFNL_CB_BATCH,
9251 .type = NFNL_CB_RCU,
9257 .type = NFNL_CB_RCU,
9263 .type = NFNL_CB_BATCH,
9269 .type = NFNL_CB_BATCH,
9275 .type = NFNL_CB_BATCH,
9281 .type = NFNL_CB_RCU,
9287 .type = NFNL_CB_BATCH,
9293 .type = NFNL_CB_BATCH,
9299 .type = NFNL_CB_BATCH,
9305 .type = NFNL_CB_RCU,
9311 .type = NFNL_CB_RCU,
9317 .type = NFNL_CB_BATCH,
9323 .type = NFNL_CB_BATCH,
9329 .type = NFNL_CB_RCU,
9333 .type = NFNL_CB_BATCH,
9339 .type = NFNL_CB_RCU,
9345 .type = NFNL_CB_BATCH,
9351 .type = NFNL_CB_BATCH,
9357 .type = NFNL_CB_RCU,
9363 .type = NFNL_CB_BATCH,
9369 .type = NFNL_CB_RCU,
9375 .type = NFNL_CB_BATCH,
9381 .type = NFNL_CB_BATCH,
10778 enum nft_chain_types type)
10784 if (basechain->type->type != type)
10900 if (strcmp(expr->ops->type->name, "immediate"))
10935 iter.type = NFT_ITER_UPDATE;
11052 enum nft_data_types type,
11059 if (type != NFT_DATA_VERDICT)
11080 if (data != NULL && type != NFT_DATA_VALUE)
11089 enum nft_data_types type, unsigned int len)
11098 err = nft_validate_register_store(ctx, reg, data, type, len);
11108 [NFTA_VERDICT_CODE] = { .type = NLA_U32 },
11109 [NFTA_VERDICT_CHAIN] = { .type = NLA_STRING,
11111 [NFTA_VERDICT_CHAIN_ID] = { .type = NLA_U32 },
11195 int nft_verdict_dump(struct sk_buff *skb, int type, const struct nft_verdict *v)
11199 nest = nla_nest_start_noflag(skb, type);
11250 [NFTA_DATA_VALUE] = { .type = NLA_BINARY },
11251 [NFTA_DATA_VERDICT] = { .type = NLA_NESTED },
11263 * The type and length of data are returned in the data description.
11265 * The caller can indicate that it only wants to accept data of type
11283 if (desc->type != NFT_DATA_VALUE)
11288 if (desc->type != NFT_DATA_VERDICT)
11304 * @type: type of data
11309 void nft_data_release(const struct nft_data *data, enum nft_data_types type)
11311 if (type < NFT_DATA_VERDICT)
11313 switch (type) {
11323 enum nft_data_types type, unsigned int len)
11332 switch (type) {