From: seanedmond@linux.microsoft.com
To: u-boot@lists.denx.de
Cc: joe.hershberger@ni.com, rfried.dev@gmail.com,
v.v.mitrofanov@yadro.com, seanedmond@microsoft.com
Subject: [PATCH] net: ipv6: Fix IPv6 netmask parsing
Date: Fri, 6 Jan 2023 14:22:55 -0800 [thread overview]
Message-ID: <20230106222255.15242-1-seanedmond@linux.microsoft.com> (raw)
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
next reply other threads:[~2023-01-07 1:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-06 22:22 seanedmond [this message]
2023-01-09 7:59 ` [PATCH] net: ipv6: Fix IPv6 netmask parsing Vyacheslav V. Mitrofanov
2023-01-10 17:02 ` Ramon Fried
2023-02-03 18:20 ` Tom Rini
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=20230106222255.15242-1-seanedmond@linux.microsoft.com \
--to=seanedmond@linux.microsoft.com \
--cc=joe.hershberger@ni.com \
--cc=rfried.dev@gmail.com \
--cc=seanedmond@microsoft.com \
--cc=u-boot@lists.denx.de \
--cc=v.v.mitrofanov@yadro.com \
/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