netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Colitti <lorenzo@google.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"Eric Dumazet" <eric.dumazet@gmail.com>,
	"Maciej Żenczykowski" <zenczykowski@gmail.com>
Subject: Re: [iproute PATCH v3 2/2] ss: support closing inet sockets via SOCK_DESTROY.
Date: Mon, 4 Jan 2016 10:54:33 +0900	[thread overview]
Message-ID: <CAKD1Yr1VQxVkQKpGxrtGmWd=_Z9Q2eBp1L313bqSddDXG9nNxg@mail.gmail.com> (raw)
In-Reply-To: <20151230123414.008f5e35@xeon-e3>

On Thu, Dec 31, 2015 at 5:34 AM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
>> +     req.nlh.nlmsg_type = SOCK_DESTROY;
>> +     req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
>> +     req.nlh.nlmsg_seq = ++rth->seq;
>> +     req.r.sdiag_family = d->idiag_family;
>> +     req.r.sdiag_protocol = diag_arg->protocol;
>> +     req.r.id = d->id;
>> +
>> +     return rtnl_send_check_ack(rth, &req.nlh, req.nlh.nlmsg_len, 1);
>
> Just use rtnl_talk() instead, it does request/reply.

The reason I did not use rtnl_talk is that it prints all errors to
stderr. This does not
fit well with SOCK_DESTROY, for which it is expected that some
operations will fail.

For example, if you type "ss -a -K dport = :443", you probably don't
want to see one "RTNETLINK answers: Operation not supported" error for
every TIME-WAIT socket to port 443, and you don't want to see
"RTNETLINK answers: No such file or directory" if one of those sockets
happens to be closed during the scan. Silently ignoring these errors
seemed best.

I could also add a parameter to rtnl_talk to suppress printing errors,
though the patch to do so would be roughly equivalent to the patch
where I added rtnl_send_check_ack. I can also just use rtnl_talk as
you suggest and not care about the errors.

Let me know what you prefer.

  reply	other threads:[~2016-01-04  1:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-17 13:22 [iproute PATCH v2 1/2] libnetlink: add a variant of rtnl_send_check that consumes ACKs Lorenzo Colitti
2015-12-17 13:22 ` [iproute PATCH v2 2/2] ss: support closing inet sockets via SOCK_DESTROY Lorenzo Colitti
2015-12-17 15:29   ` Eric Dumazet
2015-12-22  5:42   ` Stephen Hemminger
2015-12-22  8:31     ` Lorenzo Colitti
2015-12-22  8:31       ` [iproute PATCH v3 1/2] libnetlink: add a variant of rtnl_send_check that consumes ACKs Lorenzo Colitti
2015-12-23 21:17         ` Stephen Hemminger
2015-12-22  8:31       ` [iproute PATCH v3 2/2] ss: support closing inet sockets via SOCK_DESTROY Lorenzo Colitti
2015-12-30 20:34         ` Stephen Hemminger
2016-01-04  1:54           ` Lorenzo Colitti [this message]
2016-01-08  8:32             ` Lorenzo Colitti
2016-01-08  8:32               ` [iproute PATCH v4 1/2] libnetlink: don't print NETLINK_SOCK_DIAG errors in rtnl_talk Lorenzo Colitti
2016-01-08  8:32               ` [iproute PATCH v4 2/2] ss: support closing inet sockets via SOCK_DESTROY Lorenzo Colitti
2016-01-18 19:48                 ` Stephen Hemminger
2015-12-22  8:35       ` [iproute PATCH v2 " Lorenzo Colitti
2015-12-17 16:07 ` [iproute PATCH v2 1/2] libnetlink: add a variant of rtnl_send_check that consumes ACKs Eric Dumazet

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='CAKD1Yr1VQxVkQKpGxrtGmWd=_Z9Q2eBp1L313bqSddDXG9nNxg@mail.gmail.com' \
    --to=lorenzo@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=zenczykowski@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).