aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/netfilter/nf_tables.h174
1 files changed, 87 insertions, 87 deletions
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 9eaaa7884586..04188b47629d 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -393,74 +393,6 @@ struct nft_rule {
393 __attribute__((aligned(__alignof__(struct nft_expr)))); 393 __attribute__((aligned(__alignof__(struct nft_expr))));
394}; 394};
395 395
396/**
397 * struct nft_trans - nf_tables object update in transaction
398 *
399 * @list: used internally
400 * @msg_type: message type
401 * @ctx: transaction context
402 * @data: internal information related to the transaction
403 */
404struct nft_trans {
405 struct list_head list;
406 int msg_type;
407 struct nft_ctx ctx;
408 char data[0];
409};
410
411struct nft_trans_rule {
412 struct nft_rule *rule;
413};
414
415#define nft_trans_rule(trans) \
416 (((struct nft_trans_rule *)trans->data)->rule)
417
418struct nft_trans_set {
419 struct nft_set *set;
420 u32 set_id;
421};
422
423#define nft_trans_set(trans) \
424 (((struct nft_trans_set *)trans->data)->set)
425#define nft_trans_set_id(trans) \
426 (((struct nft_trans_set *)trans->data)->set_id)
427
428struct nft_trans_chain {
429 bool update;
430 char name[NFT_CHAIN_MAXNAMELEN];
431 struct nft_stats __percpu *stats;
432 u8 policy;
433};
434
435#define nft_trans_chain_update(trans) \
436 (((struct nft_trans_chain *)trans->data)->update)
437#define nft_trans_chain_name(trans) \
438 (((struct nft_trans_chain *)trans->data)->name)
439#define nft_trans_chain_stats(trans) \
440 (((struct nft_trans_chain *)trans->data)->stats)
441#define nft_trans_chain_policy(trans) \
442 (((struct nft_trans_chain *)trans->data)->policy)
443
444struct nft_trans_table {
445 bool update;
446 bool enable;
447};
448
449#define nft_trans_table_update(trans) \
450 (((struct nft_trans_table *)trans->data)->update)
451#define nft_trans_table_enable(trans) \
452 (((struct nft_trans_table *)trans->data)->enable)
453
454struct nft_trans_elem {
455 struct nft_set *set;
456 struct nft_set_elem elem;
457};
458
459#define nft_trans_elem_set(trans) \
460 (((struct nft_trans_elem *)trans->data)->set)
461#define nft_trans_elem(trans) \
462 (((struct nft_trans_elem *)trans->data)->elem)
463
464static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule) 396static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule)
465{ 397{
466 return (struct nft_expr *)&rule->data[0]; 398 return (struct nft_expr *)&rule->data[0];
@@ -528,6 +460,25 @@ enum nft_chain_type {
528 NFT_CHAIN_T_MAX 460 NFT_CHAIN_T_MAX
529}; 461};
530 462
463/**
464 * struct nf_chain_type - nf_tables chain type info
465 *
466 * @name: name of the type
467 * @type: numeric identifier
468 * @family: address family
469 * @owner: module owner
470 * @hook_mask: mask of valid hooks
471 * @hooks: hookfn overrides
472 */
473struct nf_chain_type {
474 const char *name;
475 enum nft_chain_type type;
476 int family;
477 struct module *owner;
478 unsigned int hook_mask;
479 nf_hookfn *hooks[NF_MAX_HOOKS];
480};
481
531int nft_chain_validate_dependency(const struct nft_chain *chain, 482int nft_chain_validate_dependency(const struct nft_chain *chain,
532 enum nft_chain_type type); 483 enum nft_chain_type type);
533int nft_chain_validate_hooks(const struct nft_chain *chain, 484int nft_chain_validate_hooks(const struct nft_chain *chain,
@@ -614,25 +565,6 @@ struct nft_af_info {
614int nft_register_afinfo(struct net *, struct nft_af_info *); 565int nft_register_afinfo(struct net *, struct nft_af_info *);
615void nft_unregister_afinfo(struct nft_af_info *); 566void nft_unregister_afinfo(struct nft_af_info *);
616 567
617/**
618 * struct nf_chain_type - nf_tables chain type info
619 *
620 * @name: name of the type
621 * @type: numeric identifier
622 * @family: address family
623 * @owner: module owner
624 * @hook_mask: mask of valid hooks
625 * @hooks: hookfn overrides
626 */
627struct nf_chain_type {
628 const char *name;
629 enum nft_chain_type type;
630 int family;
631 struct module *owner;
632 unsigned int hook_mask;
633 nf_hookfn *hooks[NF_MAX_HOOKS];
634};
635
636int nft_register_chain_type(const struct nf_chain_type *); 568int nft_register_chain_type(const struct nf_chain_type *);
637void nft_unregister_chain_type(const struct nf_chain_type *); 569void nft_unregister_chain_type(const struct nf_chain_type *);
638 570
@@ -657,4 +589,72 @@ void nft_unregister_expr(struct nft_expr_type *);
657#define MODULE_ALIAS_NFT_SET() \ 589#define MODULE_ALIAS_NFT_SET() \
658 MODULE_ALIAS("nft-set") 590 MODULE_ALIAS("nft-set")
659 591
592/**
593 * struct nft_trans - nf_tables object update in transaction
594 *
595 * @list: used internally
596 * @msg_type: message type
597 * @ctx: transaction context
598 * @data: internal information related to the transaction
599 */
600struct nft_trans {
601 struct list_head list;
602 int msg_type;
603 struct nft_ctx ctx;
604 char data[0];
605};
606
607struct nft_trans_rule {
608 struct nft_rule *rule;
609};
610
611#define nft_trans_rule(trans) \
612 (((struct nft_trans_rule *)trans->data)->rule)
613
614struct nft_trans_set {
615 struct nft_set *set;
616 u32 set_id;
617};
618
619#define nft_trans_set(trans) \
620 (((struct nft_trans_set *)trans->data)->set)
621#define nft_trans_set_id(trans) \
622 (((struct nft_trans_set *)trans->data)->set_id)
623
624struct nft_trans_chain {
625 bool update;
626 char name[NFT_CHAIN_MAXNAMELEN];
627 struct nft_stats __percpu *stats;
628 u8 policy;
629};
630
631#define nft_trans_chain_update(trans) \
632 (((struct nft_trans_chain *)trans->data)->update)
633#define nft_trans_chain_name(trans) \
634 (((struct nft_trans_chain *)trans->data)->name)
635#define nft_trans_chain_stats(trans) \
636 (((struct nft_trans_chain *)trans->data)->stats)
637#define nft_trans_chain_policy(trans) \
638 (((struct nft_trans_chain *)trans->data)->policy)
639
640struct nft_trans_table {
641 bool update;
642 bool enable;
643};
644
645#define nft_trans_table_update(trans) \
646 (((struct nft_trans_table *)trans->data)->update)
647#define nft_trans_table_enable(trans) \
648 (((struct nft_trans_table *)trans->data)->enable)
649
650struct nft_trans_elem {
651 struct nft_set *set;
652 struct nft_set_elem elem;
653};
654
655#define nft_trans_elem_set(trans) \
656 (((struct nft_trans_elem *)trans->data)->set)
657#define nft_trans_elem(trans) \
658 (((struct nft_trans_elem *)trans->data)->elem)
659
660#endif /* _NET_NF_TABLES_H */ 660#endif /* _NET_NF_TABLES_H */