Gentle ping... Please check if the community accepts this submission.
> -----邮件原件----- > 发件人: zhousiqi (A) > 发送时间: 2023年7月3日 11:24 > 收件人: 'busybox@busybox.net' <busybox@busybox.net> > 主题: Re: [PATCH] Simplify display of IPv6 addresses based on international > standard > > Gentle ping... Is this function easy to use and is the community willing to > accept > it? > In addition, can the community provide a default6.script for udhcpc6? > --------------------------------------------------------- > > Dear BusyBox maintainers, > > I am writing to propose a patch for dhcpc6 that simplifies the display of IPv6 > addresses based on the international standard. Currently, when dhcpc6 obtains > an IPv6 address, it displays the address in a full format, which can be > difficult to > read and compare. With this patch, the address will be displayed in a > simplified > format that is easier to read and understand. > > I have tested this patch on my own system and have not encountered any issues. > However, I welcome any feedback or suggestions from the community. > > Thank you for considering my proposal. > > Best regards, > > Zhou > > > From 757b2901fd397399f6b050a015767d2355a6f36e Mon Sep 17 00:00:00 > 2001 > From: Zhou Siqi <zhousi...@huawei.com> > Date: Tue, 6 Jun 2023 15:49:59 +0800 > Subject: [PATCH] Currently, udhcpc6 does not support simplified IPv6 address > based on standards. This modification enables udhcpc6 to support this > function. > > Signed-off-by: Zhou Siqi <zhousi...@huawei.com> > --- > networking/udhcp/Config.src | 7 +++++++ > networking/udhcp/common.c | 19 ++++++++++++++++++- > 2 files changed, 25 insertions(+), 1 deletion(-) > > diff --git a/networking/udhcp/Config.src b/networking/udhcp/Config.src index > 574c33c..c4bb89f 100644 > --- a/networking/udhcp/Config.src > +++ b/networking/udhcp/Config.src > @@ -179,3 +179,10 @@ config FEATURE_UDHCPC6_RFC4075 > help > If selected, the IPv6 client udhcpc6 can obtain the SNTP servers. > > +config FEATURE_UDHCPC6_SIMPLIFY > + bool "Support udhcpc6 simplified ipv6 address" > + default y > + depends on UDHCPC6 > + help > + If selected, the IPv6 client udhcpc6 can simplify IPv6 addresses > + based on international standards. > diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c index > 31e525c..e457734 100644 > --- a/networking/udhcp/common.c > +++ b/networking/udhcp/common.c > @@ -5,6 +5,9 @@ > * Licensed under GPLv2, see file LICENSE in this source tree. > */ > #include "common.h" > +#if ENABLE_FEATURE_UDHCPC6_SIMPLIFY > +#include <netinet/in.h> > +#endif > > #if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1 > unsigned dhcp_verbose; @@ -704,8 +707,12 @@ int FAST_FUNC > udhcp_str2optset(const char *const_str, void *arg, int FAST_FUNC > sprint_nip6(char *dest, /*const char *pre,*/ const uint8_t *ip) { > char hexstrbuf[16 * 2]; > +#if ENABLE_FEATURE_UDHCPC6_SIMPLIFY > + struct in6_addr addr; > + char compressed_address[INET6_ADDRSTRLEN]; > +#endif > bin2hex(hexstrbuf, (void*)ip, 16); > - return sprintf(dest, /* "%s" */ > + sprintf(dest, /* "%s" */ > "%.4s:%.4s:%.4s:%.4s:%.4s:%.4s:%.4s:%.4s", > /* pre, */ > hexstrbuf + 0 * 4, > @@ -717,4 +724,14 @@ int FAST_FUNC sprint_nip6(char *dest, /*const char > *pre,*/ const uint8_t *ip) > hexstrbuf + 6 * 4, > hexstrbuf + 7 * 4 > ); > +#if ENABLE_FEATURE_UDHCPC6_SIMPLIFY > + inet_pton(AF_INET6, dest, &addr); > + inet_ntop(AF_INET6, &addr, compressed_address, INET6_ADDRSTRLEN); > + /* If dest is different from compressed_address, the simplified address > is > valid. > + * In this case, assign the simplified address to dest. > + */ > + if (strcmp(dest, compressed_address) != 0) > + strcpy(dest,compressed_address); > +#endif > + return strlen(dest); > } > -- > 2.12.3 _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox