You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2022/10/26 06:57:51 UTC
[GitHub] [incubator-brpc] wayslog opened a new pull request, #1965: fix: domain name length
wayslog opened a new pull request, #1965:
URL: https://github.com/apache/incubator-brpc/pull/1965
### What problem does this PR solve?
Issue Number: #1911
Problem Summary: hostname2endpoint implement not compatite with domain RFCs.
### What is changed and the side effects?
Changed: change the buf length as 256, and use MAX_DOMAIN_LENGTH to check the domain name valid. But I don't have an exists domain to test it.
Side effects:
- Performance effects(性能影响): hostname2endpoint will allocate more 192 byte memory in stack.
- Breaking backward compatibility(向后兼容性): yes
---
### Check List:
- Please make sure your changes are compilable(请确保你的更改可以通过编译).
- When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
- Please follow [Contributor Covenant Code of Conduct](../CODE_OF_CONDUCT.md).(请遵循贡献者准则).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] serverglen commented on pull request #1965: fix: domain name length
Posted by GitBox <gi...@apache.org>.
serverglen commented on PR #1965:
URL: https://github.com/apache/incubator-brpc/pull/1965#issuecomment-1313685986
@wayslog remind
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] lorinlee merged pull request #1965: fix: domain name length
Posted by GitBox <gi...@apache.org>.
lorinlee merged PR #1965:
URL: https://github.com/apache/incubator-brpc/pull/1965
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] wwbmmm commented on pull request #1965: fix: domain name length
Posted by GitBox <gi...@apache.org>.
wwbmmm commented on PR #1965:
URL: https://github.com/apache/incubator-brpc/pull/1965#issuecomment-1291755562
建议补充一下边界值的单测
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] wwbmmm commented on a diff in pull request #1965: fix: domain name length
Posted by GitBox <gi...@apache.org>.
wwbmmm commented on code in PR #1965:
URL: https://github.com/apache/incubator-brpc/pull/1965#discussion_r1005438299
##########
src/butil/endpoint.cpp:
##########
@@ -304,12 +304,17 @@ int str2endpoint(const char* ip_str, int port, EndPoint* point) {
int hostname2endpoint(const char* str, EndPoint* point) {
// Should be enough to hold ip address
- char buf[64];
+ // The definitive descriptions of the rules for forming domain names appear in RFC 1035, RFC 1123, RFC 2181,
+ // and RFC 5892. The full domain name may not exceed the length of 253 characters in its textual representation
+ // (Domain Names - Domain Concepts and Facilities. IETF. doi:10.17487/RFC1034. RFC 1034.).
+ // For cacheline optimize, use buf size as 256;
+ char buf[256];
Review Comment:
建议加个static_assert
MAX_DOMAIN_LENGTH < sizeof(buf)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] wayslog commented on pull request #1965: fix: domain name length
Posted by GitBox <gi...@apache.org>.
wayslog commented on PR #1965:
URL: https://github.com/apache/incubator-brpc/pull/1965#issuecomment-1293163267
> 建议补充一下边界值的单测
这里有个麻烦的地方在于我没有一个可用的足够长的域名,导致我的返回值无论正确错误都是 -1 的。
这个地方是否可以考虑开个特例,比如参数不对的时候返回 -2 什么的,这样好做测试?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] wwbmmm commented on pull request #1965: fix: domain name length
Posted by GitBox <gi...@apache.org>.
wwbmmm commented on PR #1965:
URL: https://github.com/apache/incubator-brpc/pull/1965#issuecomment-1293177008
> > 建议补充一下边界值的单测
>
> 这里有个麻烦的地方在于我没有一个可用的足够长的域名,导致我的返回值无论正确错误都是 -1 的。 这个地方是否可以考虑开个特例,比如参数不对的时候返回 -2 什么的,这样好做测试?
可以,或者返回-1,并设置errno
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org