netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] Add support for PIO p flag
@ 2024-07-26  1:06 Patrick Rohr
  2024-07-26 10:23 ` Simon Horman
  2024-07-29 17:22 ` Maciej Żenczykowski
  0 siblings, 2 replies; 5+ messages in thread
From: Patrick Rohr @ 2024-07-26  1:06 UTC (permalink / raw)
  To: David S. Miller
  Cc: Linux Network Development Mailing List, Patrick Rohr,
	Maciej Żenczykowski, Lorenzo Colitti, David Lamparter

draft-ietf-6man-pio-pflag is adding a new flag to the Prefix Information
Option to signal the pd-per-device addressing mechanism.

When accept_pio_pflag is enabled, the presence of the p-flag will cause
an a flag in the same PIO to be ignored.

An automated test has been added in Android (r.android.com/3195335) to
go along with this change.

Cc: Maciej Żenczykowski <maze@google.com>
Cc: Lorenzo Colitti <lorenzo@google.com>
Cc: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Patrick Rohr <prohr@google.com>
---
 Documentation/networking/ip-sysctl.rst | 11 +++++++++++
 include/linux/ipv6.h                   |  1 +
 include/net/addrconf.h                 |  8 ++++++--
 net/ipv6/addrconf.c                    | 15 ++++++++++++++-
 4 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/networking/ip-sysctl.rst
index 3616389c8c2d..322a0329b366 100644
--- a/Documentation/networking/ip-sysctl.rst
+++ b/Documentation/networking/ip-sysctl.rst
@@ -2362,6 +2362,17 @@ ra_honor_pio_life - BOOLEAN
 
 	Default: 0 (disabled)
 
+accept_pio_pflag - BOOLEAN
+	Used to indicate userspace support for a DHCPv6-PD client.
+	If enabled, the presence of the PIO p flag indicates to the
+	kernel to ignore the autoconf flag.
+
+	- If disabled, the P flag is ignored.
+	- If enabled, disables SLAAC to obtain new addresses from
+	  prefixes with the P flag set.
+
+	Default: 0 (disabled)
+
 accept_ra_rt_info_min_plen - INTEGER
 	Minimum prefix length of Route Information in RA.
 
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 383a0ea2ab91..396b87d76b55 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -89,6 +89,7 @@ struct ipv6_devconf {
 	__u8		ioam6_enabled;
 	__u8		ndisc_evict_nocarrier;
 	__u8		ra_honor_pio_life;
+	__u8		accept_pio_pflag;
 
 	struct ctl_table_header *sysctl_header;
 };
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 62a407db1bf5..59496aa23012 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -38,9 +38,13 @@ struct prefix_info {
 #if defined(__BIG_ENDIAN_BITFIELD)
 			__u8	onlink : 1,
 			 	autoconf : 1,
-				reserved : 6;
+			 	routeraddr : 1,
+				pdpreferred : 1,
+				reserved : 4;
 #elif defined(__LITTLE_ENDIAN_BITFIELD)
-			__u8	reserved : 6,
+			__u8	reserved : 4,
+				pdpreferred : 1,
+			 	routeraddr : 1,
 				autoconf : 1,
 				onlink : 1;
 #else
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 55a0fd589fc8..3e27725a12fc 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -239,6 +239,7 @@ static struct ipv6_devconf ipv6_devconf __read_mostly = {
 	.ioam6_id_wide		= IOAM6_DEFAULT_IF_ID_WIDE,
 	.ndisc_evict_nocarrier	= 1,
 	.ra_honor_pio_life	= 0,
+	.accept_pio_pflag	= 0,
 };
 
 static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
@@ -302,6 +303,7 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
 	.ioam6_id_wide		= IOAM6_DEFAULT_IF_ID_WIDE,
 	.ndisc_evict_nocarrier	= 1,
 	.ra_honor_pio_life	= 0,
+	.accept_pio_pflag	= 0,
 };
 
 /* Check if link is ready: is it up and is a valid qdisc available */
@@ -2762,6 +2764,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
 	u32 addr_flags = 0;
 	struct inet6_dev *in6_dev;
 	struct net *net = dev_net(dev);
+	bool ignore_autoconf_flag = false;
 
 	pinfo = (struct prefix_info *) opt;
 
@@ -2864,7 +2867,8 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
 
 	/* Try to figure out our local address for this prefix */
 
-	if (pinfo->autoconf && in6_dev->cnf.autoconf) {
+	ignore_autoconf_flag = READ_ONCE(in6_dev->cnf.accept_pio_pflag) && pinfo->pdpreferred;
+	if (pinfo->autoconf && in6_dev->cnf.autoconf && !ignore_autoconf_flag) {
 		struct in6_addr addr;
 		bool tokenized = false, dev_addr_generated = false;
 
@@ -6926,6 +6930,15 @@ static const struct ctl_table addrconf_sysctl[] = {
 		.extra1		= SYSCTL_ZERO,
 		.extra2		= SYSCTL_ONE,
 	},
+	{
+		.procname	= "accept_pio_pflag",
+		.data		= &ipv6_devconf.accept_pio_pflag,
+		.maxlen		= sizeof(u8),
+		.mode		= 0644,
+		.proc_handler	= proc_dou8vec_minmax,
+		.extra1		= SYSCTL_ZERO,
+		.extra2		= SYSCTL_ONE,
+	},
 #ifdef CONFIG_IPV6_ROUTER_PREF
 	{
 		.procname	= "accept_ra_rtr_pref",
-- 
2.46.0.rc1.232.g9752f9e123-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] Add support for PIO p flag
  2024-07-26  1:06 [PATCH net-next] Add support for PIO p flag Patrick Rohr
@ 2024-07-26 10:23 ` Simon Horman
  2024-07-28  7:17   ` Simon Horman
  2024-07-29 17:22 ` Maciej Żenczykowski
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Horman @ 2024-07-26 10:23 UTC (permalink / raw)
  To: Patrick Rohr
  Cc: David S. Miller, Linux Network Development Mailing List,
	Maciej Żenczykowski, Lorenzo Colitti, David Lamparter

On Thu, Jul 25, 2024 at 06:06:29PM -0700, Patrick Rohr wrote:
> draft-ietf-6man-pio-pflag is adding a new flag to the Prefix Information
> Option to signal the pd-per-device addressing mechanism.
> 
> When accept_pio_pflag is enabled, the presence of the p-flag will cause
> an a flag in the same PIO to be ignored.
> 
> An automated test has been added in Android (r.android.com/3195335) to
> go along with this change.
> 
> Cc: Maciej Żenczykowski <maze@google.com>
> Cc: Lorenzo Colitti <lorenzo@google.com>
> Cc: David Lamparter <equinox@opensourcerouting.org>
> Signed-off-by: Patrick Rohr <prohr@google.com>

Hi Patrick,

This is not a full review, and as per the form letter below,
net-next is closed, so you'd be best to repost.
But I will offer some very minor review in the meantime.

Firstly, please seed the CC list for Networking patches
using get_maintainers.pl --git-min-percent 25 this.patch

Secondly, as noted inline, there are two cases of
mixed of tabs and spaces used for indenting in this patch.

## Form letter - net-next-closed

The merge window for v6.11 has begun and therefore net-next is closed
for new drivers, features, code refactoring and optimizations.
We are currently accepting bug fixes only.

Please repost when net-next reopens after 15th July

RFC patches sent for review only are welcome at any time.

See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
--
pw-bot: defer

...

> diff --git a/include/net/addrconf.h b/include/net/addrconf.h
> index 62a407db1bf5..59496aa23012 100644
> --- a/include/net/addrconf.h
> +++ b/include/net/addrconf.h
> @@ -38,9 +38,13 @@ struct prefix_info {
>  #if defined(__BIG_ENDIAN_BITFIELD)
>  			__u8	onlink : 1,
>  			 	autoconf : 1,
> -				reserved : 6;
> +			 	routeraddr : 1,

The line above puts a space before a tab in indentation.
This is already the case on the autoconf line, but let's not add another
instance.

Flagged by checkpatch.

> +				pdpreferred : 1,
> +				reserved : 4;
>  #elif defined(__LITTLE_ENDIAN_BITFIELD)
> -			__u8	reserved : 6,
> +			__u8	reserved : 4,
> +				pdpreferred : 1,
> +			 	routeraddr : 1,

Here too.

>  				autoconf : 1,
>  				onlink : 1;
>  #else

...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] Add support for PIO p flag
  2024-07-26 10:23 ` Simon Horman
@ 2024-07-28  7:17   ` Simon Horman
  2024-07-29 14:49     ` Patrick Rohr
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Horman @ 2024-07-28  7:17 UTC (permalink / raw)
  To: Patrick Rohr
  Cc: David S. Miller, Linux Network Development Mailing List,
	Maciej Żenczykowski, Lorenzo Colitti, David Lamparter

On Fri, Jul 26, 2024 at 11:23:18AM +0100, Simon Horman wrote:
> On Thu, Jul 25, 2024 at 06:06:29PM -0700, Patrick Rohr wrote:
> > draft-ietf-6man-pio-pflag is adding a new flag to the Prefix Information
> > Option to signal the pd-per-device addressing mechanism.
> > 
> > When accept_pio_pflag is enabled, the presence of the p-flag will cause
> > an a flag in the same PIO to be ignored.
> > 
> > An automated test has been added in Android (r.android.com/3195335) to
> > go along with this change.
> > 
> > Cc: Maciej Żenczykowski <maze@google.com>
> > Cc: Lorenzo Colitti <lorenzo@google.com>
> > Cc: David Lamparter <equinox@opensourcerouting.org>
> > Signed-off-by: Patrick Rohr <prohr@google.com>
> 
> Hi Patrick,
> 
> This is not a full review, and as per the form letter below,
> net-next is closed, so you'd be best to repost.
> But I will offer some very minor review in the meantime.
> 
> Firstly, please seed the CC list for Networking patches
> using get_maintainers.pl --git-min-percent 25 this.patch
> 
> Secondly, as noted inline, there are two cases of
> mixed of tabs and spaces used for indenting in this patch.
> 
> ## Form letter - net-next-closed
> 
> The merge window for v6.11 has begun and therefore net-next is closed
> for new drivers, features, code refactoring and optimizations.
> We are currently accepting bug fixes only.
> 
> Please repost when net-next reopens after 15th July

Sorry, I'm not sure why I wrote the 15th, I meant the 29th.

> 
> RFC patches sent for review only are welcome at any time.
> 
> See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle

...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] Add support for PIO p flag
  2024-07-28  7:17   ` Simon Horman
@ 2024-07-29 14:49     ` Patrick Rohr
  0 siblings, 0 replies; 5+ messages in thread
From: Patrick Rohr @ 2024-07-29 14:49 UTC (permalink / raw)
  To: Simon Horman
  Cc: David S. Miller, Linux Network Development Mailing List,
	Maciej Żenczykowski, Lorenzo Colitti, David Lamparter

On Sun, Jul 28, 2024 at 12:17 AM Simon Horman <horms@kernel.org> wrote:
>
> On Fri, Jul 26, 2024 at 11:23:18AM +0100, Simon Horman wrote:
> > On Thu, Jul 25, 2024 at 06:06:29PM -0700, Patrick Rohr wrote:
> > > draft-ietf-6man-pio-pflag is adding a new flag to the Prefix Information
> > > Option to signal the pd-per-device addressing mechanism.
> > >
> > > When accept_pio_pflag is enabled, the presence of the p-flag will cause
> > > an a flag in the same PIO to be ignored.
> > >
> > > An automated test has been added in Android (r.android.com/3195335) to
> > > go along with this change.
> > >
> > > Cc: Maciej Żenczykowski <maze@google.com>
> > > Cc: Lorenzo Colitti <lorenzo@google.com>
> > > Cc: David Lamparter <equinox@opensourcerouting.org>
> > > Signed-off-by: Patrick Rohr <prohr@google.com>
> >
> > Hi Patrick,
> >
> > This is not a full review, and as per the form letter below,
> > net-next is closed, so you'd be best to repost.
> > But I will offer some very minor review in the meantime.
> >
> > Firstly, please seed the CC list for Networking patches
> > using get_maintainers.pl --git-min-percent 25 this.patch
> >
> > Secondly, as noted inline, there are two cases of
> > mixed of tabs and spaces used for indenting in this patch.
> >
> > ## Form letter - net-next-closed
> >
> > The merge window for v6.11 has begun and therefore net-next is closed
> > for new drivers, features, code refactoring and optimizations.
> > We are currently accepting bug fixes only.
> >
> > Please repost when net-next reopens after 15th July
>
> Sorry, I'm not sure why I wrote the 15th, I meant the 29th.
>
> >
> > RFC patches sent for review only are welcome at any time.
> >
> > See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
>
> ...

Thank you, Simon! I will follow up with a v2 when the branch reopens.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] Add support for PIO p flag
  2024-07-26  1:06 [PATCH net-next] Add support for PIO p flag Patrick Rohr
  2024-07-26 10:23 ` Simon Horman
@ 2024-07-29 17:22 ` Maciej Żenczykowski
  1 sibling, 0 replies; 5+ messages in thread
From: Maciej Żenczykowski @ 2024-07-29 17:22 UTC (permalink / raw)
  To: Patrick Rohr
  Cc: David S. Miller, Linux Network Development Mailing List,
	Lorenzo Colitti, David Lamparter

On Thu, Jul 25, 2024 at 6:06 PM Patrick Rohr <prohr@google.com> wrote:
>
> draft-ietf-6man-pio-pflag is adding a new flag to the Prefix Information
> Option to signal the pd-per-device addressing mechanism.
>
> When accept_pio_pflag is enabled, the presence of the p-flag will cause
> an a flag in the same PIO to be ignored.
>
> An automated test has been added in Android (r.android.com/3195335) to
> go along with this change.
>
> Cc: Maciej Żenczykowski <maze@google.com>
> Cc: Lorenzo Colitti <lorenzo@google.com>
> Cc: David Lamparter <equinox@opensourcerouting.org>
> Signed-off-by: Patrick Rohr <prohr@google.com>
> ---
>  Documentation/networking/ip-sysctl.rst | 11 +++++++++++
>  include/linux/ipv6.h                   |  1 +
>  include/net/addrconf.h                 |  8 ++++++--
>  net/ipv6/addrconf.c                    | 15 ++++++++++++++-
>  4 files changed, 32 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/networking/ip-sysctl.rst
> index 3616389c8c2d..322a0329b366 100644
> --- a/Documentation/networking/ip-sysctl.rst
> +++ b/Documentation/networking/ip-sysctl.rst
> @@ -2362,6 +2362,17 @@ ra_honor_pio_life - BOOLEAN
>
>         Default: 0 (disabled)
>
> +accept_pio_pflag - BOOLEAN

I wonder if this should be 'honour_pio_pflag' instead?
accept seems weird since the result is actually to ignore...

> +       Used to indicate userspace support for a DHCPv6-PD client.
> +       If enabled, the presence of the PIO p flag indicates to the
> +       kernel to ignore the autoconf flag.
> +
> +       - If disabled, the P flag is ignored.
> +       - If enabled, disables SLAAC to obtain new addresses from
> +         prefixes with the P flag set.

I think the phrasing/grammar here could use some work...

perhaps 'if enabled, the P flag will disable SLAAC autoconfiguration.'

> +
> +       Default: 0 (disabled)
> +
>  accept_ra_rt_info_min_plen - INTEGER
>         Minimum prefix length of Route Information in RA.
>
> diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
> index 383a0ea2ab91..396b87d76b55 100644
> --- a/include/linux/ipv6.h
> +++ b/include/linux/ipv6.h
> @@ -89,6 +89,7 @@ struct ipv6_devconf {
>         __u8            ioam6_enabled;
>         __u8            ndisc_evict_nocarrier;
>         __u8            ra_honor_pio_life;
> +       __u8            accept_pio_pflag;

perhaps 'ra_honor_pio_pflag' to match 'ra_honor_pio_life'

>
>         struct ctl_table_header *sysctl_header;
>  };
> diff --git a/include/net/addrconf.h b/include/net/addrconf.h
> index 62a407db1bf5..59496aa23012 100644
> --- a/include/net/addrconf.h
> +++ b/include/net/addrconf.h
> @@ -38,9 +38,13 @@ struct prefix_info {
>  #if defined(__BIG_ENDIAN_BITFIELD)
>                         __u8    onlink : 1,
>                                 autoconf : 1,
> -                               reserved : 6;
> +                               routeraddr : 1,
> +                               pdpreferred : 1,

would 'preferpd' be better/shorter?

> +                               reserved : 4;
>  #elif defined(__LITTLE_ENDIAN_BITFIELD)
> -                       __u8    reserved : 6,
> +                       __u8    reserved : 4,
> +                               pdpreferred : 1,
> +                               routeraddr : 1,
>                                 autoconf : 1,
>                                 onlink : 1;
>  #else
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 55a0fd589fc8..3e27725a12fc 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -239,6 +239,7 @@ static struct ipv6_devconf ipv6_devconf __read_mostly = {
>         .ioam6_id_wide          = IOAM6_DEFAULT_IF_ID_WIDE,
>         .ndisc_evict_nocarrier  = 1,
>         .ra_honor_pio_life      = 0,
> +       .accept_pio_pflag       = 0,
>  };
>
>  static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
> @@ -302,6 +303,7 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
>         .ioam6_id_wide          = IOAM6_DEFAULT_IF_ID_WIDE,
>         .ndisc_evict_nocarrier  = 1,
>         .ra_honor_pio_life      = 0,
> +       .accept_pio_pflag       = 0,
>  };
>
>  /* Check if link is ready: is it up and is a valid qdisc available */
> @@ -2762,6 +2764,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
>         u32 addr_flags = 0;
>         struct inet6_dev *in6_dev;
>         struct net *net = dev_net(dev);
> +       bool ignore_autoconf_flag = false;

I think you can skip '_flag'

>
>         pinfo = (struct prefix_info *) opt;
>
> @@ -2864,7 +2867,8 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
>
>         /* Try to figure out our local address for this prefix */
>
> -       if (pinfo->autoconf && in6_dev->cnf.autoconf) {
> +       ignore_autoconf_flag = READ_ONCE(in6_dev->cnf.accept_pio_pflag) && pinfo->pdpreferred;
> +       if (pinfo->autoconf && in6_dev->cnf.autoconf && !ignore_autoconf_flag) {
>                 struct in6_addr addr;
>                 bool tokenized = false, dev_addr_generated = false;
>
> @@ -6926,6 +6930,15 @@ static const struct ctl_table addrconf_sysctl[] = {
>                 .extra1         = SYSCTL_ZERO,
>                 .extra2         = SYSCTL_ONE,
>         },
> +       {
> +               .procname       = "accept_pio_pflag",
> +               .data           = &ipv6_devconf.accept_pio_pflag,
> +               .maxlen         = sizeof(u8),
> +               .mode           = 0644,
> +               .proc_handler   = proc_dou8vec_minmax,
> +               .extra1         = SYSCTL_ZERO,
> +               .extra2         = SYSCTL_ONE,
> +       },
>  #ifdef CONFIG_IPV6_ROUTER_PREF
>         {
>                 .procname       = "accept_ra_rtr_pref",
> --
> 2.46.0.rc1.232.g9752f9e123-goog
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-07-29 17:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-26  1:06 [PATCH net-next] Add support for PIO p flag Patrick Rohr
2024-07-26 10:23 ` Simon Horman
2024-07-28  7:17   ` Simon Horman
2024-07-29 14:49     ` Patrick Rohr
2024-07-29 17:22 ` Maciej Żenczykowski

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 NNTP newsgroup(s).