All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: iwd@lists.01.org
Subject: Re: [PATCH 1/7] ip-pool: Track IPv4 addresses in use
Date: Wed, 26 May 2021 16:56:27 -0500	[thread overview]
Message-ID: <5b4e127b-33a4-545a-8041-98a1db8430df@gmail.com> (raw)
In-Reply-To: <CAOq732+O4wegunRRYFKg5eUA-_-E=KkbZrTkE8k=Xhwaj9Ydyg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2052 bytes --]

Hi Andrew,

>> I mean in
>> theory ip-pool can be reused by netconfig for example, which also tracks IPv4/v6
>> addresses (for some unknown reason, but one thing at a time...)
> 
> That shouldn't be a problem but ok, I'll drop the netdev usage.
> 

netconfig depends on netdev right now, but it really shouldn't.  The only reason 
is that it needs the device name, which really belongs elsewhere since netconfig 
will end up being used by ead, which will not even come with netconfig module at 
all.

So the looser you make this coupling, the easier it will be for us to reuse this 
stuff in other projects.  Start thinking along those lines please.

>>
>>> +
>>> +struct ip_pool_addr4_record {
>>> +     uint32_t addr;
>>> +     uint8_t prefix_len;
>>> +     uint32_t ifindex;
>>> +     bool secondary;
>>> +};
>>
>> Is there a compelling reason to use a dedicated structure (leaking
>> implementation details) instead of returning a newly allocated l_rtnl_address
>> instead?
> 
> Again, convenience, readability, better fit for the use case.  But

readability? Yeah I don't buy that one ;)  You were doing stuff like storing the 
ip address in host order for whatever reason.  And you expect someone reading 
ap.c to remember / know that?

> like I said I can move to using l_rtnl_address, I didn't do it this
> time because it sounded like I convinced you against it.  I'll switch
> to l_rtnl_address though.

I'm fine if you use a custom type inside ip-pool for ease of implementation, but 
you should make the public API 'nice'.

> 
> Using l_rtnl_address here is like using a class for a simple integer
> or boolean value (Java style), I wouldn't call directly accessing the
> actual value "leaking implementation details."

You're returning a const struct foo * back, which basically screams 'I'm sending 
internal details out'.  Also see my comment about host/network ordering.

If you think l_rtnl_address isn't suitable for whatever reason, then lets fix 
that instead.

Regards,
-Denis

  reply	other threads:[~2021-05-26 21:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25 12:55 [PATCH 1/7] ip-pool: Track IPv4 addresses in use Andrew Zaborowski
2021-05-25 12:55 ` [PATCH 2/7] ip-pool: Add subnet address selection logic Andrew Zaborowski
2021-05-26 19:56   ` Denis Kenzior
2021-05-26 20:06     ` Denis Kenzior
2021-05-26 21:50     ` Andrew Zaborowski
2021-05-25 12:55 ` [PATCH 3/7] ap: Refactor DHCP settings loading Andrew Zaborowski
2021-05-25 12:55 ` [PATCH 4/7] ap: Refactor global address pool loading Andrew Zaborowski
2021-05-25 12:55 ` [PATCH 5/7] ap: Send a specific error message on async AP start failure Andrew Zaborowski
2021-05-25 12:55 ` [PATCH 6/7] autotests: Update APRanges usage in testAP Andrew Zaborowski
2021-05-25 12:55 ` [PATCH 7/7] doc: Update AP settings in iwd.ap(5) and iwd.config(5) Andrew Zaborowski
2021-05-26 19:43 ` [PATCH 1/7] ip-pool: Track IPv4 addresses in use Denis Kenzior
2021-05-26 21:37   ` Andrew Zaborowski
2021-05-26 21:56     ` Denis Kenzior [this message]
2021-05-26 22:02       ` Denis Kenzior
2021-05-26 22:36       ` Andrew Zaborowski
2021-05-26 22:55         ` Denis Kenzior
2021-05-26 23:26           ` Andrew Zaborowski
2021-05-26 23:33             ` Denis Kenzior

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=5b4e127b-33a4-545a-8041-98a1db8430df@gmail.com \
    --to=denkenz@gmail.com \
    --cc=iwd@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.