All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: iwd@lists.01.org
Subject: Re: [PATCH 04/11] ap: Add subnet address selection logic
Date: Tue, 11 May 2021 10:06:09 -0500	[thread overview]
Message-ID: <bff1b2f2-c61e-bc8a-0574-ce371a897ec2@gmail.com> (raw)
In-Reply-To: <20210510085806.174213-4-andrew.zaborowski@intel.com>

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

Hi Andrew,

On 5/10/21 3:57 AM, Andrew Zaborowski wrote:
> Add the ap_select_addr4 function to select a random subnet of requested
> size from an address space defined by a string list (for use with the
> AP profile [IPv4].Address and the global [IPv4].APAddressPool settings),
> avoiding those subnets that conflict with subnets from a second list.
> We take care to give a similar weight to all subnets contained in the
> specified ranges regardless of how many ranges contain each, basically
> so that overlapping ranges don't affect the probabilities (debatable.)
> 
> This is added as src/ap-addr.c so that it's self-contained.
> ---
>   Makefile.am   |   3 +-
>   src/ap-addr.c | 231 ++++++++++++++++++++++++++++++++++++++++++++++++++
>   src/ap.h      |   9 ++
>   3 files changed, 242 insertions(+), 1 deletion(-)
>   create mode 100644 src/ap-addr.c
> 

I would rather we made this into a self contained module that pays attention to 
RTNL and tracks any addresses added / removed.  That way the caller isn't forced 
into performing an RTNL dump first...

> diff --git a/src/ap.h b/src/ap.h
> index b0100f34..2163d2db 100644
> --- a/src/ap.h
> +++ b/src/ap.h
> @@ -97,3 +97,12 @@ bool ap_station_disconnect(struct ap_state *ap, const uint8_t *mac,
>   
>   bool ap_push_button(struct ap_state *ap);
>   void ap_update_beacon(struct ap_state *ap);
> +
> +struct ap_rtnl_addr4_record {
> +	uint32_t addr;
> +	uint8_t prefix_len;
> +};
> +
> +int ap_select_addr4(const char **addr_str_list, uint8_t prefix,
> +			const struct l_queue *used_addr_dump,
> +			uint32_t *out_addr);
> 

Do we have a chance of collisions if 2 APs are brought up simultaneously? 
Should there be an explicit reserve / release semantic?  I know you use 
l_getrandom to pick the subnet, but what if the IP pool size is pretty small?

Regards,
-Denis

  reply	other threads:[~2021-05-11 15:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10  8:57 [PATCH 01/11] ap: Move sending CMD_START_AP to common function Andrew Zaborowski
2021-05-10  8:57 ` [PATCH 02/11] ap: Refactor DHCP settings loading Andrew Zaborowski
2021-05-11 14:56   ` Denis Kenzior
2021-05-10  8:57 ` [PATCH 03/11] ap: Refactor global address pool loading Andrew Zaborowski
2021-05-10  8:57 ` [PATCH 04/11] ap: Add subnet address selection logic Andrew Zaborowski
2021-05-11 15:06   ` Denis Kenzior [this message]
2021-05-11 21:04     ` Andrew Zaborowski
2021-05-11 22:20       ` Denis Kenzior
2021-05-10  8:58 ` [PATCH 05/11] ap: Dump addreses in use and assign local IP Andrew Zaborowski
2021-05-10  8:58 ` [PATCH 06/11] ap: Move the DHCP server freeing to ap_reset Andrew Zaborowski
2021-05-10  8:58 ` [PATCH 07/11] ap: Send a specific error message on async AP start failure Andrew Zaborowski
2021-05-10  8:58 ` [PATCH 08/11] autotests: Update APRanges usage in testAP Andrew Zaborowski
2021-05-10  8:58 ` [PATCH 09/11] doc: Update AP settings in iwd.ap(5) and iwd.config(5) Andrew Zaborowski
2021-05-10  8:58 ` [PATCH 10/11] main: Add NetworkConfigurationEnabled to Daemon.GetInfo() Andrew Zaborowski
2021-05-11 15:09   ` Denis Kenzior
2021-05-10  8:58 ` [PATCH 11/11] doc: Document NetworkConfigurationEnabled in Daemon.GetInfo() Andrew Zaborowski
2021-05-11 14:48 ` [PATCH 01/11] ap: Move sending CMD_START_AP to common function 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=bff1b2f2-c61e-bc8a-0574-ce371a897ec2@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.