* [PATCH] net: ipv6: Fix IPv6 netmask parsing
@ 2023-01-06 22:22 seanedmond
2023-01-09 7:59 ` Vyacheslav V. Mitrofanov
2023-02-03 18:20 ` Tom Rini
0 siblings, 2 replies; 4+ messages in thread
From: seanedmond @ 2023-01-06 22:22 UTC (permalink / raw)
To: u-boot; +Cc: joe.hershberger, rfried.dev, v.v.mitrofanov, seanedmond
From: Sean Edmond <seanedmond@microsoft.com>
It should be possible to specify a netmask when
setting a static IPv6 address. For example:
setenv ip6addr 2001:cafe:cafe:cafe::100/64
The net_prefix_length and net_ip6 should be updated
properly.
Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
---
net/net6.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/net/net6.c b/net/net6.c
index fdea078788..75577bcea1 100644
--- a/net/net6.c
+++ b/net/net6.c
@@ -47,10 +47,13 @@ static int on_ip6addr(const char *name, const char *value, enum env_op op,
}
mask = strchr(value, '/');
- len = strlen(value);
- if (mask)
- net_prefix_length = simple_strtoul(value + len, NULL, 10);
+ if (mask) {
+ net_prefix_length = simple_strtoul(mask + 1, NULL, 10);
+ len = mask - value;
+ } else {
+ len = strlen(value);
+ }
return string_to_ip6(value, len, &net_ip6);
}
--
2.39.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] net: ipv6: Fix IPv6 netmask parsing
2023-01-06 22:22 [PATCH] net: ipv6: Fix IPv6 netmask parsing seanedmond
@ 2023-01-09 7:59 ` Vyacheslav V. Mitrofanov
2023-01-10 17:02 ` Ramon Fried
2023-02-03 18:20 ` Tom Rini
1 sibling, 1 reply; 4+ messages in thread
From: Vyacheslav V. Mitrofanov @ 2023-01-09 7:59 UTC (permalink / raw)
To: u-boot@lists.denx.de, seanedmond@linux.microsoft.com
Cc: seanedmond@microsoft.com, joe.hershberger@ni.com,
rfried.dev@gmail.com
On Fri, 2023-01-06 at 14:22 -0800, seanedmond@linux.microsoft.com
wrote:
> From: Sean Edmond <seanedmond@microsoft.com>
>
> It should be possible to specify a netmask when
> setting a static IPv6 address. For example:
> setenv ip6addr 2001:cafe:cafe:cafe::100/64
>
> The net_prefix_length and net_ip6 should be updated
> properly.
>
> Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
> ---
> net/net6.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/net/net6.c b/net/net6.c
> index fdea078788..75577bcea1 100644
> --- a/net/net6.c
> +++ b/net/net6.c
> @@ -47,10 +47,13 @@ static int on_ip6addr(const char *name, const
> char *value, enum env_op op,
> }
>
> mask = strchr(value, '/');
> - len = strlen(value);
>
> - if (mask)
> - net_prefix_length = simple_strtoul(value + len, NULL,
> 10);
> + if (mask) {
> + net_prefix_length = simple_strtoul(mask + 1, NULL,
> 10);
> + len = mask - value;
> + } else {
> + len = strlen(value);
> + }
>
> return string_to_ip6(value, len, &net_ip6);
> }
> --
> 2.39.0
I do agree with your changes.Thanks
Reviewed-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] net: ipv6: Fix IPv6 netmask parsing
2023-01-09 7:59 ` Vyacheslav V. Mitrofanov
@ 2023-01-10 17:02 ` Ramon Fried
0 siblings, 0 replies; 4+ messages in thread
From: Ramon Fried @ 2023-01-10 17:02 UTC (permalink / raw)
To: Vyacheslav V. Mitrofanov
Cc: u-boot@lists.denx.de, seanedmond@linux.microsoft.com,
seanedmond@microsoft.com, joe.hershberger@ni.com
On Mon, Jan 9, 2023 at 9:59 AM Vyacheslav V. Mitrofanov
<v.v.mitrofanov@yadro.com> wrote:
>
> On Fri, 2023-01-06 at 14:22 -0800, seanedmond@linux.microsoft.com
> wrote:
> > From: Sean Edmond <seanedmond@microsoft.com>
> >
> > It should be possible to specify a netmask when
> > setting a static IPv6 address. For example:
> > setenv ip6addr 2001:cafe:cafe:cafe::100/64
> >
> > The net_prefix_length and net_ip6 should be updated
> > properly.
> >
> > Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
> > ---
> > net/net6.c | 9 ++++++---
> > 1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/net/net6.c b/net/net6.c
> > index fdea078788..75577bcea1 100644
> > --- a/net/net6.c
> > +++ b/net/net6.c
> > @@ -47,10 +47,13 @@ static int on_ip6addr(const char *name, const
> > char *value, enum env_op op,
> > }
> >
> > mask = strchr(value, '/');
> > - len = strlen(value);
> >
> > - if (mask)
> > - net_prefix_length = simple_strtoul(value + len, NULL,
> > 10);
> > + if (mask) {
> > + net_prefix_length = simple_strtoul(mask + 1, NULL,
> > 10);
> > + len = mask - value;
> > + } else {
> > + len = strlen(value);
> > + }
> >
> > return string_to_ip6(value, len, &net_ip6);
> > }
> > --
> > 2.39.0
> I do agree with your changes.Thanks
>
> Reviewed-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: ipv6: Fix IPv6 netmask parsing
2023-01-06 22:22 [PATCH] net: ipv6: Fix IPv6 netmask parsing seanedmond
2023-01-09 7:59 ` Vyacheslav V. Mitrofanov
@ 2023-02-03 18:20 ` Tom Rini
1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2023-02-03 18:20 UTC (permalink / raw)
To: seanedmond
Cc: u-boot, joe.hershberger, rfried.dev, v.v.mitrofanov, seanedmond
[-- Attachment #1: Type: text/plain, Size: 578 bytes --]
On Fri, Jan 06, 2023 at 02:22:55PM -0800, seanedmond@linux.microsoft.com wrote:
> From: Sean Edmond <seanedmond@microsoft.com>
>
> It should be possible to specify a netmask when
> setting a static IPv6 address. For example:
> setenv ip6addr 2001:cafe:cafe:cafe::100/64
>
> The net_prefix_length and net_ip6 should be updated
> properly.
>
> Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
> Reviewed-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Applied to u-boot/master, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-03 18:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-06 22:22 [PATCH] net: ipv6: Fix IPv6 netmask parsing seanedmond
2023-01-09 7:59 ` Vyacheslav V. Mitrofanov
2023-01-10 17:02 ` Ramon Fried
2023-02-03 18:20 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox