From: David Ahern <dsahern@kernel.org>
To: Zhixing Chen <running910@gmail.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>, netdev@vger.kernel.org
Subject: Re: [PATCH iproute2-next] iprule: warn about host bits in IPv4 rule prefixes
Date: Sat, 12 Sep 2026 14:56:50 -0600 [thread overview]
Message-ID: <cd7e9145-20f4-43f7-9c18-c323b9d13a9e@kernel.org> (raw)
In-Reply-To: <20260904033138.10620-1-running910@gmail.com>
> diff --git a/ip/iprule.c b/ip/iprule.c
> index b56b1b18..d358cfdf 100644
> --- a/ip/iprule.c
> +++ b/ip/iprule.c
> @@ -276,6 +276,18 @@ static bool filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
> return true;
> }
>
> +static bool inet_prefix_host_bits_set(const inet_prefix *p)
> +{
> + __u32 mask;
> +
> + if (p->family != AF_INET || p->bitlen < 0 || p->bitlen >= 32)
> + return false;
> +
> + mask = p->bitlen ? htonl(0xffffffff << (32 - p->bitlen)) : 0;
> +
> + return p->data[0] & ~mask;
detects more than just host entries in the mask, no? 10.1.0.0/8 would
also throw a warning mesage, but that is not a host address
next prev parent reply other threads:[~2026-09-12 20:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 3:31 [PATCH iproute2-next] iprule: warn about host bits in IPv4 rule prefixes Zhixing Chen
2026-09-12 20:56 ` David Ahern [this message]
2026-09-14 7:45 ` Zhixing Chen
2026-09-14 14:06 ` David Ahern
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=cd7e9145-20f4-43f7-9c18-c323b9d13a9e@kernel.org \
--to=dsahern@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=running910@gmail.com \
--cc=stephen@networkplumber.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