lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpWmM8bJ5up47gt06VpoSrP6YVd=RZO2HTD0quXtQkRyxg@mail.gmail.com>
Date:   Sun, 5 Jul 2020 22:40:17 -0700
From:   Cong Wang <xiyou.wangcong@...il.com>
To:     wenxu <wenxu@...oud.cn>
Cc:     David Miller <davem@...emloft.net>,
        Pablo Neira Ayuso <pablo@...filter.org>,
        Linux Kernel Network Developers <netdev@...r.kernel.org>,
        NetFilter <netfilter-devel@...r.kernel.org>
Subject: Re: [PATCH net-next 1/3] netfilter: nf_defrag_ipv4: Add
 nf_ct_frag_gather support

On Sun, Jul 5, 2020 at 7:34 AM <wenxu@...oud.cn> wrote:
> +static int nf_ct_frag_reinit(struct ipq *qp)
> +{
> +       unsigned int sum_truesize = 0;
> +
> +       if (!mod_timer(&qp->q.timer, jiffies + qp->q.fqdir->timeout)) {
> +               refcount_inc(&qp->q.refcnt);
> +               return -ETIMEDOUT;
> +       }
> +
> +       sum_truesize = inet_frag_rbtree_purge(&qp->q.rb_fragments);
> +       sub_frag_mem_limit(qp->q.fqdir, sum_truesize);
> +
> +       qp->q.flags = 0;
> +       qp->q.len = 0;
> +       qp->q.meat = 0;
> +       qp->q.rb_fragments = RB_ROOT;
> +       qp->q.fragments_tail = NULL;
> +       qp->q.last_run_head = NULL;
> +       qp->iif = 0;
> +       qp->ecn = 0;
> +
> +       return 0;
> +}
> +
> +static struct ipq *ip_find(struct net *net, struct iphdr *iph,
> +                          u32 user, int vif)
> +{
> +       struct frag_v4_compare_key key = {
> +               .saddr = iph->saddr,
> +               .daddr = iph->daddr,
> +               .user = user,
> +               .vif = vif,
> +               .id = iph->id,
> +               .protocol = iph->protocol,
> +       };
> +       struct inet_frag_queue *q;
> +
> +       q = inet_frag_find(net->ipv4.fqdir, &key);
> +       if (!q)
> +               return NULL;
> +
> +       return container_of(q, struct ipq, q);
> +}


Please avoid copy-n-paste code by finding a proper way
to reuse them.

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ