Hi Harsha,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on nf-next/master]

url:    
https://github.com/0day-ci/linux/commits/Harsha-Sharma/netfilter-nft_ct-add-ct-timeout-support/20180612-061838
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
config: m68k-sun3_defconfig (attached as .config)
compiler: m68k-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=m68k 

All errors (new ones prefixed by >>):

   net/netfilter/nft_ct.c: In function 'ctnl_timeout_parse_policy':
   net/netfilter/nft_ct.c:783:16: error: 'const struct nf_conntrack_l4proto' 
has no member named 'ctnl_timeout'; did you mean 'get_timeouts'?
     if (!l4proto->ctnl_timeout.nlattr_to_obj)
                   ^~~~~~~~~~~~
                   get_timeouts
   net/netfilter/nft_ct.c:786:24: error: 'const struct nf_conntrack_l4proto' 
has no member named 'ctnl_timeout'; did you mean 'get_timeouts'?
     tb = kcalloc(l4proto->ctnl_timeout.nlattr_max + 1, sizeof(*tb),
                           ^~~~~~~~~~~~
                           get_timeouts
   net/netfilter/nft_ct.c:792:38: error: 'const struct nf_conntrack_l4proto' 
has no member named 'ctnl_timeout'; did you mean 'get_timeouts'?
     ret = nla_parse_nested(tb, l4proto->ctnl_timeout.nlattr_max,
                                         ^~~~~~~~~~~~
                                         get_timeouts
   net/netfilter/nft_ct.c:793:26: error: 'const struct nf_conntrack_l4proto' 
has no member named 'ctnl_timeout'; did you mean 'get_timeouts'?
              attr, l4proto->ctnl_timeout.nla_policy,
                             ^~~~~~~~~~~~
                             get_timeouts
   net/netfilter/nft_ct.c:798:17: error: 'const struct nf_conntrack_l4proto' 
has no member named 'ctnl_timeout'; did you mean 'get_timeouts'?
     ret = l4proto->ctnl_timeout.nlattr_to_obj(tb, net, timeouts);
                    ^~~~~~~~~~~~
                    get_timeouts
   net/netfilter/nft_ct.c: In function 'nft_ct_timeout_obj_init':
>> net/netfilter/nft_ct.c:850:28: error: 'struct net' has no member named 
>> 'nfct_timeout_list'; did you mean 'nfnl_acct_list'?
     INIT_LIST_HEAD(&ctx->net->nfct_timeout_list);
                               ^~~~~~~~~~~~~~~~~
                               nfnl_acct_list
   In file included from net/netfilter/nft_ct.c:12:0:
   net/netfilter/nft_ct.c:851:42: error: 'struct net' has no member named 
'nfct_timeout_list'; did you mean 'nfnl_acct_list'?
     list_for_each_entry(timeout, &ctx->net->nfct_timeout_list, head) {
                                             ^
   include/linux/kernel.h:961:26: note: in definition of macro 'container_of'
     void *__mptr = (void *)(ptr);     \
                             ^~~
   include/linux/list.h:377:2: note: in expansion of macro 'list_entry'
     list_entry((ptr)->next, type, member)
     ^~~~~~~~~~
   include/linux/list.h:464:13: note: in expansion of macro 'list_first_entry'
     for (pos = list_first_entry(head, typeof(*pos), member); \
                ^~~~~~~~~~~~~~~~
   net/netfilter/nft_ct.c:851:2: note: in expansion of macro 
'list_for_each_entry'
     list_for_each_entry(timeout, &ctx->net->nfct_timeout_list, head) {
     ^~~~~~~~~~~~~~~~~~~
   In file included from include/linux/kernel.h:10:0,
                    from net/netfilter/nft_ct.c:12:
   net/netfilter/nft_ct.c:851:42: error: 'struct net' has no member named 
'nfct_timeout_list'; did you mean 'nfnl_acct_list'?
     list_for_each_entry(timeout, &ctx->net->nfct_timeout_list, head) {
                                             ^
   include/linux/compiler.h:316:19: note: in definition of macro 
'__compiletime_assert'
      bool __cond = !(condition);    \
                      ^~~~~~~~~
   include/linux/compiler.h:339:2: note: in expansion of macro 
'_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:45:37: note: in expansion of macro 
'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:962:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
     ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:962:20: note: in expansion of macro '__same_type'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                       ^~~~~~~~~~~
   include/linux/list.h:366:2: note: in expansion of macro 'container_of'
     container_of(ptr, type, member)
     ^~~~~~~~~~~~
   include/linux/list.h:377:2: note: in expansion of macro 'list_entry'
     list_entry((ptr)->next, type, member)
     ^~~~~~~~~~
   include/linux/list.h:464:13: note: in expansion of macro 'list_first_entry'
     for (pos = list_first_entry(head, typeof(*pos), member); \
                ^~~~~~~~~~~~~~~~
   net/netfilter/nft_ct.c:851:2: note: in expansion of macro 
'list_for_each_entry'
     list_for_each_entry(timeout, &ctx->net->nfct_timeout_list, head) {
     ^~~~~~~~~~~~~~~~~~~
   net/netfilter/nft_ct.c:851:42: error: 'struct net' has no member named 
'nfct_timeout_list'; did you mean 'nfnl_acct_list'?
     list_for_each_entry(timeout, &ctx->net->nfct_timeout_list, head) {
                                             ^
   include/linux/compiler.h:316:19: note: in definition of macro 
'__compiletime_assert'
      bool __cond = !(condition);    \
                      ^~~~~~~~~
   include/linux/compiler.h:339:2: note: in expansion of macro 
'_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:45:37: note: in expansion of macro 
'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:962:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
     ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:963:6: note: in expansion of macro '__same_type'
        !__same_type(*(ptr), void),   \
         ^~~~~~~~~~~
   include/linux/list.h:366:2: note: in expansion of macro 'container_of'
     container_of(ptr, type, member)
     ^~~~~~~~~~~~
   include/linux/list.h:377:2: note: in expansion of macro 'list_entry'
     list_entry((ptr)->next, type, member)
     ^~~~~~~~~~
   include/linux/list.h:464:13: note: in expansion of macro 'list_first_entry'
     for (pos = list_first_entry(head, typeof(*pos), member); \
                ^~~~~~~~~~~~~~~~
   net/netfilter/nft_ct.c:851:2: note: in expansion of macro 
'list_for_each_entry'
     list_for_each_entry(timeout, &ctx->net->nfct_timeout_list, head) {
     ^~~~~~~~~~~~~~~~~~~
   In file included from include/linux/module.h:9:0,
                    from net/netfilter/nft_ct.c:14:
   net/netfilter/nft_ct.c:851:42: error: 'struct net' has no member named 
'nfct_timeout_list'; did you mean 'nfnl_acct_list'?
     list_for_each_entry(timeout, &ctx->net->nfct_timeout_list, head) {
                                             ^
   include/linux/list.h:465:24: note: in definition of macro 
'list_for_each_entry'
          &pos->member != (head);     \
                           ^~~~
   net/netfilter/nft_ct.c:873:15: error: 'const struct nf_conntrack_l4proto' 
has no member named 'ctnl_timeout'; did you mean 'get_timeouts'?
         l4proto->ctnl_timeout.obj_size, GFP_KERNEL);
                  ^~~~~~~~~~~~
                  get_timeouts
   net/netfilter/nft_ct.c:885:47: error: 'struct net' has no member named 
'nfct_timeout_list'; did you mean 'nfnl_acct_list'?
     list_add_tail_rcu(&timeout->head, &ctx->net->nfct_timeout_list);
                                                  ^~~~~~~~~~~~~~~~~
                                                  nfnl_acct_list
   net/netfilter/nft_ct.c: In function 'nft_ct_timeout_obj_dump':
   net/netfilter/nft_ct.c:927:26: error: 'const struct nf_conntrack_l4proto' 
has no member named 'ctnl_timeout'; did you mean 'get_timeouts'?
     ret = timeout->l4proto->ctnl_timeout.obj_to_nlattr(skb, &timeout->data);

vim +850 net/netfilter/nft_ct.c

   774  
   775  static int
   776  ctnl_timeout_parse_policy(void *timeouts,
   777                            const struct nf_conntrack_l4proto *l4proto,
   778                            struct net *net, const struct nlattr *attr)
   779  {
   780          int ret = 0;
   781          struct nlattr **tb;
   782  
   783          if (!l4proto->ctnl_timeout.nlattr_to_obj)
   784                  return 0;
   785  
   786          tb = kcalloc(l4proto->ctnl_timeout.nlattr_max + 1, sizeof(*tb),
   787                       GFP_KERNEL);
   788  
   789          if (!tb)
   790                  return -ENOMEM;
   791  
   792          ret = nla_parse_nested(tb, l4proto->ctnl_timeout.nlattr_max,
 > 793                                 attr, l4proto->ctnl_timeout.nla_policy,
   794                                 NULL);
   795          if (ret < 0)
   796                  goto err;
   797  
   798          ret = l4proto->ctnl_timeout.nlattr_to_obj(tb, net, timeouts);
   799  
   800  err:
   801          kfree(tb);
   802          return ret;
   803  }
   804  
   805  static void nft_ct_timeout_obj_eval(struct nft_object *obj,
   806                                      struct nft_regs *regs,
   807                                      const struct nft_pktinfo *pkt)
   808  {
   809          const struct nft_ct_timeout_obj *priv = nft_obj_data(obj);
   810          struct ctnl_timeout *to_assign = NULL;
   811          struct nf_conn_timeout *timeout_ext;
   812          struct sk_buff *skb = pkt->skb;
   813  
   814          if (!priv->tmpl ||
   815              nf_ct_is_confirmed(priv->tmpl))
   816                  return;
   817  
   818          to_assign = priv->timeout;
   819  
   820          nf_ct_set(skb, priv->tmpl, IP_CT_NEW);
   821          timeout_ext = nf_ct_timeout_ext_add(priv->tmpl, priv->timeout, 
GFP_ATOMIC);
   822  
   823          if (timeout_ext) {
   824                  rcu_assign_pointer(timeout_ext->timeout, to_assign);
   825                  __set_bit(IPS_CONFIRMED_BIT, &priv->tmpl->status);
   826          }
   827  }
   828  
   829  static int nft_ct_timeout_obj_init(const struct nft_ctx *ctx,
   830                                     const struct nlattr * const tb[],
   831                                     struct nft_object *obj)
   832  {
   833          __u8 l4num;
   834          struct nft_ct_timeout_obj *priv = nft_obj_data(obj);
   835          const struct nf_conntrack_l4proto *l4proto;
   836          struct ctnl_timeout *timeout, *matching = NULL;
   837          struct nf_conn *tmpl;
   838          const struct nf_conntrack_zone *zone = &nf_ct_zone_dflt;
   839          int ret;
   840          int l3num = ctx->family;
   841  
   842          if (!tb[NFTA_CT_TIMEOUT_L4PROTO] ||
   843              !tb[NFTA_CT_TIMEOUT_DATA])
   844                  return -EINVAL;
   845  
   846          if (tb[NFTA_CT_TIMEOUT_L3PROTO])
   847                  l3num = 
ntohs(nla_get_be16(tb[NFTA_CT_TIMEOUT_L3PROTO]));
   848          l4num = nla_get_u8(tb[NFTA_CT_TIMEOUT_L4PROTO]);
   849  
 > 850          INIT_LIST_HEAD(&ctx->net->nfct_timeout_list);
   851          list_for_each_entry(timeout, &ctx->net->nfct_timeout_list, 
head) {
   852                  matching = timeout;
   853                  break;
   854          }
   855  
   856          if (matching) {
   857                  if (matching->l3num != l3num ||
   858                      matching->l4proto->l4proto != l4num)
   859                          return -EINVAL;
   860                  return ctnl_timeout_parse_policy(&matching->data,
   861                                                   matching->l4proto, 
ctx->net,
   862                                                   
tb[NFTA_CT_TIMEOUT_DATA]);
   863          }
   864  
   865          l4proto = nf_ct_l4proto_find_get(l3num, l4num);
   866  
   867          if (l4proto->l4proto != l4num) {
   868                  ret = -EOPNOTSUPP;
   869                  goto err_proto_put;
   870          }
   871  
   872          timeout = kzalloc(sizeof(struct ctnl_timeout) +
   873                            l4proto->ctnl_timeout.obj_size, GFP_KERNEL);
   874          if (timeout == NULL) {
   875                  ret = -ENOMEM;
   876                  goto err_proto_put;
   877          }
   878  
   879          ret = ctnl_timeout_parse_policy(&timeout->data, l4proto, 
ctx->net,
   880                                          tb[NFTA_CT_TIMEOUT_DATA]);
   881          if (ret < 0)
   882                  goto err;
   883          timeout->l3num = l3num;
   884          timeout->l4proto = l4proto;
   885          list_add_tail_rcu(&timeout->head, &ctx->net->nfct_timeout_list);
   886          priv->timeout = timeout;
   887          tmpl = nf_ct_tmpl_alloc(ctx->net, zone, GFP_ATOMIC);
   888          tmpl->zone.id = 4;
   889          priv->tmpl = tmpl;
   890  
   891          return 0;
   892  err:
   893          kfree(timeout);
   894  err_proto_put:
   895          nf_ct_l4proto_put(l4proto);
   896          return ret;
   897  }
   898  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

Reply via email to