330-v4.16-netfilter-nf_tables-remove-flag-field-from-struct-nf.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. From: Pablo Neira Ayuso <pablo@netfilter.org>
  2. Date: Tue, 19 Dec 2017 14:07:52 +0100
  3. Subject: [PATCH] netfilter: nf_tables: remove flag field from struct
  4. nft_af_info
  5. Replace it by a direct check for the netdev protocol family.
  6. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  7. ---
  8. --- a/include/net/netfilter/nf_tables.h
  9. +++ b/include/net/netfilter/nf_tables.h
  10. @@ -962,10 +962,6 @@ struct nft_table {
  11. char *name;
  12. };
  13. -enum nft_af_flags {
  14. - NFT_AF_NEEDS_DEV = (1 << 0),
  15. -};
  16. -
  17. /**
  18. * struct nft_af_info - nf_tables address family info
  19. *
  20. @@ -973,14 +969,12 @@ enum nft_af_flags {
  21. * @family: address family
  22. * @owner: module owner
  23. * @tables: used internally
  24. - * @flags: family flags
  25. */
  26. struct nft_af_info {
  27. struct list_head list;
  28. int family;
  29. struct module *owner;
  30. struct list_head tables;
  31. - u32 flags;
  32. };
  33. int nft_register_afinfo(struct net *, struct nft_af_info *);
  34. --- a/net/netfilter/nf_tables_api.c
  35. +++ b/net/netfilter/nf_tables_api.c
  36. @@ -1391,7 +1391,7 @@ static int nft_chain_parse_hook(struct n
  37. hook->type = type;
  38. hook->dev = NULL;
  39. - if (afi->flags & NFT_AF_NEEDS_DEV) {
  40. + if (afi->family == NFPROTO_NETDEV) {
  41. char ifname[IFNAMSIZ];
  42. if (!ha[NFTA_HOOK_DEV]) {
  43. --- a/net/netfilter/nf_tables_netdev.c
  44. +++ b/net/netfilter/nf_tables_netdev.c
  45. @@ -41,7 +41,6 @@ nft_do_chain_netdev(void *priv, struct s
  46. static struct nft_af_info nft_af_netdev __read_mostly = {
  47. .family = NFPROTO_NETDEV,
  48. .owner = THIS_MODULE,
  49. - .flags = NFT_AF_NEEDS_DEV,
  50. };
  51. static int nf_tables_netdev_init_net(struct net *net)