From: Denis Kenzior <denkenz at gmail.com>
To: ell at lists.01.org
Subject: Re: [PATCH 01/13] net: Add l_net_clear_host_bits utility
Date: Fri, 13 May 2022 09:15:45 -0500 [thread overview]
Message-ID: <913bb777-2b72-47e8-7b57-de3de66b3af4@gmail.com> (raw)
In-Reply-To: CAOq732+eiU7dB=8ZDrej9BkaiTKv_U_18Y5gz=2=UYUxosYWYA@mail.gmail.com
[-- Attachment #1: Type: text/plain, Size: 1337 bytes --]
Hi Andrew,
>>> +static inline void l_net_clear_host_bits(uint8_t *address, uint8_t prefix_len,
>>> + uint8_t bytes)
>>
>> I'm not super excited about the naming. What about l_net_prefix_from_address()?
>
> Ok, I guess host mask is an IPv4 term with the v6 term being interface
> ID. l_net_prefix_from_address sounds good, or how about
You could also add a separate v4/v6 version instead? Your set only uses this
for v6 right now, and you'd be able to drop the bytes parameter? You could also
use a static buffer for the return value (or simply a uint32 for the v4 version)
and make address in-only instead of in-out.
> l_net_mask_prefix?
The use of l_net_prefix_from_address() would make it very clear what is
happening in netconfig_add_v6_static_address_routes(). l_net_mask_prefix better
suites the usage in patch 13, though your original naming also works well here.
Question is, if you're already sanitizing & dropping the address portion in
netconfig_add_v6_static_routes(), do you even need the use of
l_net_clear_host_bits in patch 13?
Anyhow, maybe the outcome from this discussion is to just put this into
net-private.h for now and we can agree on the name later if this function needs
to be exposed into public API.
Regards,
-Denis
next reply other threads:[~2022-05-13 14:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-13 14:15 Denis Kenzior [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-05-13 22:41 [PATCH 01/13] net: Add l_net_clear_host_bits utility Andrew Zaborowski
2022-05-13 12:26 Andrew Zaborowski
2022-05-12 16:02 Denis Kenzior
2022-05-05 23:15 Andrew Zaborowski
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=913bb777-2b72-47e8-7b57-de3de66b3af4@gmail.com \
--to=ell@lists.linux.dev \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).