* [DxeNetLib] Why do we restrict each field to have the same leading zero format?
@ 2017-04-05 10:55 Guoheyi
2017-04-06 5:30 ` Wu, Jiaxin
0 siblings, 1 reply; 3+ messages in thread
From: Guoheyi @ 2017-04-05 10:55 UTC (permalink / raw)
To: edk2-devel@lists.01.org; +Cc: Feng Tian, Star Zeng, Siyuan Fu, Jiaxin Wu
Hi folks,
We are using NetLibAsciiStrToIp6 function in DxeNetLib.c of MdeModulePkg to convert string to IPv6 address. We found this function will return invalid parameter with below input:
2001:3456:789a:0000:f012:2:2003:2005
We trace the code and believe it is handled by the branch in line 2955:
if ((Cnt != 0) && (Cnt < 4) && LeadZero) {
return EFI_INVALID_PARAMETER;
}
I think the reason is that we have field 3 of "0000" which has leading zero and causes LeadZero flag to be true, and it requires all the following fields to have the same leading zero format, while field 5 of "2" is not.
I checked RFC 4291 and only found below text; I didn't find any restriction that requires each field to have the same leading zero format.
1. The preferred form is x:x:x:x:x:x:x:x, where the 'x's are one to
four hexadecimal digits of the eight 16-bit pieces of the address.
Examples:
ABCD:EF01:2345:6789:ABCD:EF01:2345:6789
2001:DB8:0:0:8:800:200C:417A
Note that it is not necessary to write the leading zeros in an
individual field, but there must be at least one numeral in every
field (except for the case described in 2.).
Could you help to confirm whether it is a bug or there is some special reason for this?
Thanks and regards,
Gary (Heyi Guo)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [DxeNetLib] Why do we restrict each field to have the same leading zero format?
2017-04-05 10:55 [DxeNetLib] Why do we restrict each field to have the same leading zero format? Guoheyi
@ 2017-04-06 5:30 ` Wu, Jiaxin
2017-04-06 7:35 ` 答复: " Guoheyi
0 siblings, 1 reply; 3+ messages in thread
From: Wu, Jiaxin @ 2017-04-06 5:30 UTC (permalink / raw)
To: 'Guoheyi', edk2-devel@lists.01.org
Cc: Tian, Feng, Fu, Siyuan, Zeng, Star
Hi Gary,
The issue has been gone since the version of 9f5ca5efbd0bb00c9d3577b95e6322e85cb0b118. Please check that.
Thanks,
Jiaxin
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Guoheyi
> Sent: Wednesday, April 5, 2017 6:56 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng <feng.tian@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; Fu,
> Siyuan <siyuan.fu@intel.com>; Zeng, Star <star.zeng@intel.com>
> Subject: [edk2] [DxeNetLib] Why do we restrict each field to have the same
> leading zero format?
>
> Hi folks,
>
> We are using NetLibAsciiStrToIp6 function in DxeNetLib.c of MdeModulePkg
> to convert string to IPv6 address. We found this function will return invalid
> parameter with below input:
> 2001:3456:789a:0000:f012:2:2003:2005
>
> We trace the code and believe it is handled by the branch in line 2955:
>
> if ((Cnt != 0) && (Cnt < 4) && LeadZero) {
> return EFI_INVALID_PARAMETER;
> }
>
> I think the reason is that we have field 3 of "0000" which has leading zero and
> causes LeadZero flag to be true, and it requires all the following fields to have
> the same leading zero format, while field 5 of "2" is not.
>
> I checked RFC 4291 and only found below text; I didn't find any restriction
> that requires each field to have the same leading zero format.
>
> 1. The preferred form is x:x:x:x:x:x:x:x, where the 'x's are one to
> four hexadecimal digits of the eight 16-bit pieces of the address.
> Examples:
>
> ABCD:EF01:2345:6789:ABCD:EF01:2345:6789
>
> 2001:DB8:0:0:8:800:200C:417A
>
> Note that it is not necessary to write the leading zeros in an
> individual field, but there must be at least one numeral in every
> field (except for the case described in 2.).
>
> Could you help to confirm whether it is a bug or there is some special reason
> for this?
>
> Thanks and regards,
>
> Gary (Heyi Guo)
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* 答复: [DxeNetLib] Why do we restrict each field to have the same leading zero format?
2017-04-06 5:30 ` Wu, Jiaxin
@ 2017-04-06 7:35 ` Guoheyi
0 siblings, 0 replies; 3+ messages in thread
From: Guoheyi @ 2017-04-06 7:35 UTC (permalink / raw)
To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Tian, Feng, Fu, Siyuan, Zeng, Star
Many thanks. I missed to check the latest cod...
Regards,
Gary (Heyi Guo)
-----邮件原件-----
发件人: Wu, Jiaxin [mailto:jiaxin.wu@intel.com]
发送时间: 2017年4月6日 13:30
收件人: Guoheyi; edk2-devel@lists.01.org
抄送: Tian, Feng; Fu, Siyuan; Zeng, Star
主题: RE: [edk2] [DxeNetLib] Why do we restrict each field to have the same leading zero format?
Hi Gary,
The issue has been gone since the version of 9f5ca5efbd0bb00c9d3577b95e6322e85cb0b118. Please check that.
Thanks,
Jiaxin
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Guoheyi
> Sent: Wednesday, April 5, 2017 6:56 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng <feng.tian@intel.com>; Wu, Jiaxin
> <jiaxin.wu@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Zeng, Star
> <star.zeng@intel.com>
> Subject: [edk2] [DxeNetLib] Why do we restrict each field to have the
> same leading zero format?
>
> Hi folks,
>
> We are using NetLibAsciiStrToIp6 function in DxeNetLib.c of
> MdeModulePkg to convert string to IPv6 address. We found this function
> will return invalid parameter with below input:
> 2001:3456:789a:0000:f012:2:2003:2005
>
> We trace the code and believe it is handled by the branch in line 2955:
>
> if ((Cnt != 0) && (Cnt < 4) && LeadZero) {
> return EFI_INVALID_PARAMETER;
> }
>
> I think the reason is that we have field 3 of "0000" which has leading
> zero and causes LeadZero flag to be true, and it requires all the
> following fields to have the same leading zero format, while field 5 of "2" is not.
>
> I checked RFC 4291 and only found below text; I didn't find any
> restriction that requires each field to have the same leading zero format.
>
> 1. The preferred form is x:x:x:x:x:x:x:x, where the 'x's are one to
> four hexadecimal digits of the eight 16-bit pieces of the address.
> Examples:
>
> ABCD:EF01:2345:6789:ABCD:EF01:2345:6789
>
> 2001:DB8:0:0:8:800:200C:417A
>
> Note that it is not necessary to write the leading zeros in an
> individual field, but there must be at least one numeral in every
> field (except for the case described in 2.).
>
> Could you help to confirm whether it is a bug or there is some special
> reason for this?
>
> Thanks and regards,
>
> Gary (Heyi Guo)
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-06 7:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-05 10:55 [DxeNetLib] Why do we restrict each field to have the same leading zero format? Guoheyi
2017-04-06 5:30 ` Wu, Jiaxin
2017-04-06 7:35 ` 答复: " Guoheyi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox