From: Sabrina Dubroca <sd@queasysnail.net>
To: Ivan Delalande <colona@arista.com>
Cc: David Miller <davem@davemloft.net>,
Eric Dumazet <eric.dumazet@gmail.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next v5 2/2] tcp_diag: report TCP MD5 signing keys and addresses
Date: Fri, 1 Sep 2017 01:26:33 +0200 [thread overview]
Message-ID: <20170831232633.GA678@bistromath.localdomain> (raw)
In-Reply-To: <20170831165939.5121-3-colona@arista.com>
2017-08-31, 09:59:39 -0700, Ivan Delalande wrote:
> diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
> index a748c74aa8b7..abbf0edcf6c2 100644
> --- a/net/ipv4/tcp_diag.c
> +++ b/net/ipv4/tcp_diag.c
[...]
> +static int tcp_diag_get_aux(struct sock *sk, bool net_admin,
> + struct sk_buff *skb)
> +{
> +#ifdef CONFIG_TCP_MD5SIG
> + if (net_admin) {
In tcp_diag_get_aux_size() you put a check for sk_fullsock. I don't
see anything preventing you from reaching this with a !fullsock?
> + struct tcp_md5sig_info *md5sig;
> + int err = 0;
> +
> + rcu_read_lock();
> + md5sig = rcu_dereference(tcp_sk(sk)->md5sig_info);
> + if (md5sig)
> + err = tcp_diag_put_md5sig(skb, md5sig);
> + rcu_read_unlock();
> + if (err < 0)
> + return err;
> + }
> +#endif
> +
> + return 0;
> +}
> +
> +static size_t tcp_diag_get_aux_size(struct sock *sk, bool net_admin)
> +{
> + size_t size = 0;
> +
> +#ifdef CONFIG_TCP_MD5SIG
> + if (net_admin && sk_fullsock(sk)) {
> + const struct tcp_md5sig_info *md5sig;
> + const struct tcp_md5sig_key *key;
> + size_t md5sig_count = 0;
> +
> + rcu_read_lock();
> + md5sig = rcu_dereference(tcp_sk(sk)->md5sig_info);
> + if (md5sig) {
> + hlist_for_each_entry_rcu(key, &md5sig->head, node)
> + md5sig_count++;
> + }
> + rcu_read_unlock();
> + size += nla_total_size(md5sig_count *
> + sizeof(struct tcp_diag_md5sig));
> + }
> +#endif
> +
> + return size;
> +}
> +
> static void tcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
> const struct inet_diag_req_v2 *r, struct nlattr *bc)
> {
--
Sabrina
next prev parent reply other threads:[~2017-08-31 23:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-31 16:59 [PATCH net-next v5 0/2] report TCP MD5 signing keys and addresses Ivan Delalande
2017-08-31 16:59 ` [PATCH net-next v5 1/2] inet_diag: allow protocols to provide additional data Ivan Delalande
2017-09-01 2:57 ` Eric Dumazet
2017-08-31 16:59 ` [PATCH net-next v5 2/2] tcp_diag: report TCP MD5 signing keys and addresses Ivan Delalande
2017-08-31 23:26 ` Sabrina Dubroca [this message]
2017-09-01 0:21 ` Ivan Delalande
2017-09-01 15:47 ` Sabrina Dubroca
2017-09-01 2:58 ` Eric Dumazet
2017-09-02 1:38 ` [PATCH net-next v5 0/2] " David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170831232633.GA678@bistromath.localdomain \
--to=sd@queasysnail.net \
--cc=colona@arista.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox