From: Stephen Hemminger <stephen@networkplumber.org>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: netdev@vger.kernel.org, Jorgen Hansen <jhansen@vmware.com>,
Dexuan Cui <decui@microsoft.com>
Subject: Re: [PATCH iproute2 1/3] ss: allow AF_FAMILY constants >32
Date: Tue, 3 Oct 2017 11:26:53 -0700 [thread overview]
Message-ID: <20171003112653.213c7cb3@xeon-e3> (raw)
In-Reply-To: <20171003175744.24987-2-stefanha@redhat.com>
On Tue, 3 Oct 2017 13:57:42 -0400
Stefan Hajnoczi <stefanha@redhat.com> wrote:
> Linux has more than 32 address families defined in <bits/socket.h>. Use
> a 64-bit type so all of them can be represented in the filter->families
> bitmask.
>
> It's easy to introduce bugs when using (1 << AF_FAMILY) because the
> value is 32-bit. This can produce incorrect results from bitmask
> operations so introduce the FAMILY_MASK() macro to eliminate these bugs.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> misc/ss.c | 54 ++++++++++++++++++++++++++++--------------------------
> 1 file changed, 28 insertions(+), 26 deletions(-)
>
> diff --git a/misc/ss.c b/misc/ss.c
> index dd8dfaa4..12a31c90 100644
> --- a/misc/ss.c
> +++ b/misc/ss.c
> @@ -170,55 +170,57 @@ enum {
> struct filter {
> int dbs;
> int states;
> - int families;
> + __u64 families;
Since this isn't a value that is coming from kernel. It should be uint64_t
rather than __u64.
next prev parent reply other threads:[~2017-10-03 18:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-03 17:57 [PATCH iproute2 0/3] ss: add AF_VSOCK support Stefan Hajnoczi
2017-10-03 17:57 ` [PATCH iproute2 1/3] ss: allow AF_FAMILY constants >32 Stefan Hajnoczi
2017-10-03 18:26 ` Stephen Hemminger [this message]
2017-10-04 15:01 ` Stefan Hajnoczi
2017-10-04 15:03 ` David Laight
2017-10-04 15:14 ` Stephen Hemminger
2017-10-03 17:57 ` [PATCH iproute2 2/3] include: add <linux/vm_sockets_diag.h> Stefan Hajnoczi
2017-10-03 18:24 ` Stephen Hemminger
2017-10-04 15:03 ` Stefan Hajnoczi
2017-10-03 17:57 ` [PATCH iproute2 3/3] ss: add AF_VSOCK support Stefan Hajnoczi
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=20171003112653.213c7cb3@xeon-e3 \
--to=stephen@networkplumber.org \
--cc=decui@microsoft.com \
--cc=jhansen@vmware.com \
--cc=netdev@vger.kernel.org \
--cc=stefanha@redhat.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