331-v4.16-netfilter-nf_tables-no-need-for-struct-nft_af_info-t.patch 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. From: Pablo Neira Ayuso <pablo@netfilter.org>
  2. Date: Tue, 19 Dec 2017 12:17:52 +0100
  3. Subject: [PATCH] netfilter: nf_tables: no need for struct nft_af_info to
  4. enable/disable table
  5. nf_tables_table_enable() and nf_tables_table_disable() take a pointer to
  6. struct nft_af_info that is never used, remove it.
  7. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  8. ---
  9. --- a/net/netfilter/nf_tables_api.c
  10. +++ b/net/netfilter/nf_tables_api.c
  11. @@ -655,10 +655,7 @@ err:
  12. return err;
  13. }
  14. -static void _nf_tables_table_disable(struct net *net,
  15. - const struct nft_af_info *afi,
  16. - struct nft_table *table,
  17. - u32 cnt)
  18. +static void nft_table_disable(struct net *net, struct nft_table *table, u32 cnt)
  19. {
  20. struct nft_chain *chain;
  21. u32 i = 0;
  22. @@ -676,9 +673,7 @@ static void _nf_tables_table_disable(str
  23. }
  24. }
  25. -static int nf_tables_table_enable(struct net *net,
  26. - const struct nft_af_info *afi,
  27. - struct nft_table *table)
  28. +static int nf_tables_table_enable(struct net *net, struct nft_table *table)
  29. {
  30. struct nft_chain *chain;
  31. int err, i = 0;
  32. @@ -698,15 +693,13 @@ static int nf_tables_table_enable(struct
  33. return 0;
  34. err:
  35. if (i)
  36. - _nf_tables_table_disable(net, afi, table, i);
  37. + nft_table_disable(net, table, i);
  38. return err;
  39. }
  40. -static void nf_tables_table_disable(struct net *net,
  41. - const struct nft_af_info *afi,
  42. - struct nft_table *table)
  43. +static void nf_tables_table_disable(struct net *net, struct nft_table *table)
  44. {
  45. - _nf_tables_table_disable(net, afi, table, 0);
  46. + nft_table_disable(net, table, 0);
  47. }
  48. static int nf_tables_updtable(struct nft_ctx *ctx)
  49. @@ -735,7 +728,7 @@ static int nf_tables_updtable(struct nft
  50. nft_trans_table_enable(trans) = false;
  51. } else if (!(flags & NFT_TABLE_F_DORMANT) &&
  52. ctx->table->flags & NFT_TABLE_F_DORMANT) {
  53. - ret = nf_tables_table_enable(ctx->net, ctx->afi, ctx->table);
  54. + ret = nf_tables_table_enable(ctx->net, ctx->table);
  55. if (ret >= 0) {
  56. ctx->table->flags &= ~NFT_TABLE_F_DORMANT;
  57. nft_trans_table_enable(trans) = true;
  58. @@ -5820,7 +5813,6 @@ static int nf_tables_commit(struct net *
  59. if (nft_trans_table_update(trans)) {
  60. if (!nft_trans_table_enable(trans)) {
  61. nf_tables_table_disable(net,
  62. - trans->ctx.afi,
  63. trans->ctx.table);
  64. trans->ctx.table->flags |= NFT_TABLE_F_DORMANT;
  65. }
  66. @@ -5984,7 +5976,6 @@ static int nf_tables_abort(struct net *n
  67. if (nft_trans_table_update(trans)) {
  68. if (nft_trans_table_enable(trans)) {
  69. nf_tables_table_disable(net,
  70. - trans->ctx.afi,
  71. trans->ctx.table);
  72. trans->ctx.table->flags |= NFT_TABLE_F_DORMANT;
  73. }