diff options
Diffstat (limited to 'include/net')
| -rw-r--r-- | include/net/netfilter/nf_tables_core.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/net/netfilter/nf_tables_core.h b/include/net/netfilter/nf_tables_core.h index cf2b7ae2b9d8..a75fc8e27cd6 100644 --- a/include/net/netfilter/nf_tables_core.h +++ b/include/net/netfilter/nf_tables_core.h | |||
| @@ -13,6 +13,16 @@ struct nft_cmp_fast_expr { | |||
| 13 | u8 len; | 13 | u8 len; |
| 14 | }; | 14 | }; |
| 15 | 15 | ||
| 16 | /* Calculate the mask for the nft_cmp_fast expression. On big endian the | ||
| 17 | * mask needs to include the *upper* bytes when interpreting that data as | ||
| 18 | * something smaller than the full u32, therefore a cpu_to_le32 is done. | ||
| 19 | */ | ||
| 20 | static inline u32 nft_cmp_fast_mask(unsigned int len) | ||
| 21 | { | ||
| 22 | return cpu_to_le32(~0U >> (FIELD_SIZEOF(struct nft_cmp_fast_expr, | ||
| 23 | data) * BITS_PER_BYTE - len)); | ||
| 24 | } | ||
| 25 | |||
| 16 | extern const struct nft_expr_ops nft_cmp_fast_ops; | 26 | extern const struct nft_expr_ops nft_cmp_fast_ops; |
| 17 | 27 | ||
| 18 | int nft_cmp_module_init(void); | 28 | int nft_cmp_module_init(void); |
