|
|
DescriptionChange the size of the ICE ufrag to 4 bytes.
This is the minumum allowed size, and will allow STUN pings to be smaller.
The unit tests on the the Gturn are also modified. A username with length of 16 bytes will be generated for Gturn only.
Committed: https://crrev.com/6d0d4bf31de1e36cab276ec3db994a952ba4b612
Cr-Commit-Position: refs/heads/master@{#12876}
Patch Set 1 #
Total comments: 2
Patch Set 2 : git status #
Total comments: 5
Patch Set 3 : Revert the relayserver.cc. Modified the Port unit test. #Patch Set 4 : Revert unnecessary change. Minor. #Patch Set 5 : Modified the constants in unit tests based on new ICE_UFRAG_LENGTH. #
Messages
Total messages: 41 (18 generated)
zhihuang@webrtc.org changed reviewers: + deadbeef@webrtc.org, pthatcher@webrtc.org
Description was changed from ========== reset the size of ICE_UFRAG remove the dead code BUG= ========== to ========== Change the size of the ICE ufrag to 4 bytes. This is the minumum allowed size, and will allow STUN pings to be smaller. ==========
https://codereview.webrtc.org/1848083002/diff/1/webrtc/p2p/base/transport.cc File webrtc/p2p/base/transport.cc (left): https://codereview.webrtc.org/1848083002/diff/1/webrtc/p2p/base/transport.cc#... webrtc/p2p/base/transport.cc:244: } This is unrelated to changing the size of the UFRAG, so I'd put it in a separate CL.
On 2016/03/31 22:20:24, Taylor Brandstetter wrote: > https://codereview.webrtc.org/1848083002/diff/1/webrtc/p2p/base/transport.cc > File webrtc/p2p/base/transport.cc (left): > > https://codereview.webrtc.org/1848083002/diff/1/webrtc/p2p/base/transport.cc#... > webrtc/p2p/base/transport.cc:244: } > This is unrelated to changing the size of the UFRAG, so I'd put it in a separate > CL. Done. I reverted the unrelated code change and amended the commit.
lgtm Question for Peter: Do you think there are any legacy (GTURN) servers that still require a ufrag length of 16? https://codereview.webrtc.org/1848083002/diff/1/webrtc/p2p/base/transport.cc File webrtc/p2p/base/transport.cc (left): https://codereview.webrtc.org/1848083002/diff/1/webrtc/p2p/base/transport.cc#... webrtc/p2p/base/transport.cc:244: } On 2016/03/31 22:20:24, Taylor Brandstetter wrote: > This is unrelated to changing the size of the UFRAG, so I'd put it in a separate > CL. Done.
https://codereview.webrtc.org/1848083002/diff/20001/webrtc/p2p/base/relayserv... File webrtc/p2p/base/relayserver.cc (right): https://codereview.webrtc.org/1848083002/diff/20001/webrtc/p2p/base/relayserv... webrtc/p2p/base/relayserver.cc:268: username = username.substr(0, colonpos); I don't think this is correct. The place where we put a binding into bindings_ gets a username from code kind of like this: std::string username; const StunByteStringAttribute* username_attr = msg->GetByteString(STUN_ATTR_USERNAME); username.append(username_attr->bytes(), username_attr->length()); So we should just make this code match and use the full username, not the username up to a colon. The only thing the code did before that we might remove is set a maximum username length to 16. But this is legacy code and it's probably not worth changing it for that. In other words, just revert this file. It doesn't need to be changed.
On 2016/04/01 00:46:55, Taylor Brandstetter wrote: > lgtm > > Question for Peter: Do you think there are any legacy (GTURN) servers that still > require a ufrag length of 16? Yes, Chromoting, I believe, is still using GTURN servers. And they use this constant here: https://code.google.com/p/chromium/codesearch#chromium/src/remoting/protocol/... We should probably warn them that we are changing this. Luckily, the fix is very easy. They just need to change "rtc::CreateRandomString(cricket::ICE_UFRAG_LENGTH)" to "rtc::CreateRandomString(16)" and that's it. In fact, we could make that CL for them and mail it to them for review. > > https://codereview.webrtc.org/1848083002/diff/1/webrtc/p2p/base/transport.cc > File webrtc/p2p/base/transport.cc (left): > > https://codereview.webrtc.org/1848083002/diff/1/webrtc/p2p/base/transport.cc#... > webrtc/p2p/base/transport.cc:244: } > On 2016/03/31 22:20:24, Taylor Brandstetter wrote: > > This is unrelated to changing the size of the UFRAG, so I'd put it in a > separate > > CL. > > Done.
https://codereview.webrtc.org/1848083002/diff/20001/webrtc/p2p/base/relayserv... File webrtc/p2p/base/relayserver.cc (right): https://codereview.webrtc.org/1848083002/diff/20001/webrtc/p2p/base/relayserv... webrtc/p2p/base/relayserver.cc:268: username = username.substr(0, colonpos); On 2016/05/05 18:07:19, pthatcher1 wrote: > I don't think this is correct. > > The place where we put a binding into bindings_ gets a username from code kind > of like this: > > std::string username; > const StunByteStringAttribute* username_attr = > msg->GetByteString(STUN_ATTR_USERNAME); > username.append(username_attr->bytes(), username_attr->length()); > > So we should just make this code match and use the full username, not the > username up to a colon. > > The only thing the code did before that we might remove is set a maximum > username length to 16. But this is legacy code and it's probably not worth > changing it for that. > > > In other words, just revert this file. It doesn't need to be changed. > > The reason I made these changes is some unit tests will fail. I looked into this and I found that username_attr contains two parts (two names I think) which is separated by a colon and the length of user_name is 2 * length(ufrag) + 1. When the ufrag length is 16, the length of username_attr is 33. After min(33, 16), the length will be 16, which works fine. However, when the ufrag length is 4, the length(username_attr) = 9. After min(9, 16), the length will be 9, which will be a problem.
https://codereview.webrtc.org/1848083002/diff/20001/webrtc/p2p/base/relayserv... File webrtc/p2p/base/relayserver.cc (right): https://codereview.webrtc.org/1848083002/diff/20001/webrtc/p2p/base/relayserv... webrtc/p2p/base/relayserver.cc:268: username = username.substr(0, colonpos); On 2016/05/05 18:27:09, Zhi Huang wrote: > On 2016/05/05 18:07:19, pthatcher1 wrote: > > I don't think this is correct. > > > > The place where we put a binding into bindings_ gets a username from code kind > > of like this: > > > > std::string username; > > const StunByteStringAttribute* username_attr = > > msg->GetByteString(STUN_ATTR_USERNAME); > > username.append(username_attr->bytes(), username_attr->length()); > > > > So we should just make this code match and use the full username, not the > > username up to a colon. > > > > The only thing the code did before that we might remove is set a maximum > > username length to 16. But this is legacy code and it's probably not worth > > changing it for that. > > > > > > In other words, just revert this file. It doesn't need to be changed. > > > > > > The reason I made these changes is some unit tests will fail. > > I looked into this and I found that username_attr contains two parts (two names > I think) which is separated by a colon and the length of user_name is 2 * > length(ufrag) + 1. When the ufrag length is 16, the length of username_attr is > 33. After min(33, 16), the length will be 16, which works fine. However, when > the ufrag length is 4, the length(username_attr) = 9. After min(9, 16), the > length will be 9, which will be a problem. I don't see why a length of 9 would cause this code to fail, but perhaps there is something I missing. In that case, we should fix the unittest to use 16 rather than 4. Which unit test is it?
https://codereview.webrtc.org/1848083002/diff/20001/webrtc/p2p/base/relayserv... File webrtc/p2p/base/relayserver.cc (right): https://codereview.webrtc.org/1848083002/diff/20001/webrtc/p2p/base/relayserv... webrtc/p2p/base/relayserver.cc:268: username = username.substr(0, colonpos); On 2016/05/05 20:24:31, pthatcher1 wrote: > On 2016/05/05 18:27:09, Zhi Huang wrote: > > On 2016/05/05 18:07:19, pthatcher1 wrote: > > > I don't think this is correct. > > > > > > The place where we put a binding into bindings_ gets a username from code > kind > > > of like this: > > > > > > std::string username; > > > const StunByteStringAttribute* username_attr = > > > msg->GetByteString(STUN_ATTR_USERNAME); > > > username.append(username_attr->bytes(), username_attr->length()); > > > > > > So we should just make this code match and use the full username, not the > > > username up to a colon. > > > > > > The only thing the code did before that we might remove is set a maximum > > > username length to 16. But this is legacy code and it's probably not worth > > > changing it for that. > > > > > > > > > In other words, just revert this file. It doesn't need to be changed. > > > > > > > > > > The reason I made these changes is some unit tests will fail. > > > > I looked into this and I found that username_attr contains two parts (two > names > > I think) which is separated by a colon and the length of user_name is 2 * > > length(ufrag) + 1. When the ufrag length is 16, the length of username_attr is > > 33. After min(33, 16), the length will be 16, which works fine. However, when > > the ufrag length is 4, the length(username_attr) = 9. After min(9, 16), the > > length will be 9, which will be a problem. > > I don't see why a length of 9 would cause this code to fail, but perhaps there > is something I missing. In that case, we should fix the unittest to use 16 > rather than 4. > > Which unit test is it? I changed code like this: const uint32_t USERNAME_LENGTH = 16; ... uint32_t length = std::min(static_cast<uint32_t>(username_attr->length()), USERNAME_LENGTH); std::string username(username_attr->bytes(), length); // TODO: Check the HMAC. // The binding should already be present. BindingMap::iterator biter = bindings_.find(username); if (biter == bindings_.end()) { LOG(LS_WARNING) << "Dropping packet: no binding with username"; return; } These tests will fail. out/Debug/rtc_unittests: PortTest.TestLocalToTcpGturn out/Debug/rtc_unittests: PortTest.TestLocalToGturn out/Debug/rtc_unittests: PortTest.TestPRNatToTcpGturn out/Debug/rtc_unittests: PortTest.TestLocalToSslTcpGturn out/Debug/rtc_unittests: PortTest.TestPRNatToGturn out/Debug/rtc_unittests: PortTest.TestSymNatToGturn out/Debug/rtc_unittests: PortTest.TestSymNatToTcpGturn out/Debug/rtc_unittests: PortTest.TestARNatToGturn out/Debug/rtc_unittests: PortTest.TestARNATNatToTcpGturn out/Debug/rtc_unittests: PortTest.TestConeNatToGturn out/Debug/rtc_unittests: PortTest.TestConeNatToTcpGturn When I change USERNAME_LENGTH = 4, these tests will fail. out/Debug/rtc_unittests: RelayServerTest.TestRemoteBind out/Debug/rtc_unittests: RelayServerTest.TestSendRequestBadUsername out/Debug/rtc_unittests: RelayServerTest.TestSendRequestNoDestinationAddress out/Debug/rtc_unittests: RelayServerTest.TestSendRequestNoData out/Debug/rtc_unittests: RelayServerTest.TestSendRaw Since the USERNAME_LENGTH is only used here, I think its purpose is to extract the substring from username_attribute. So using the colon to extract the username might be more flexible.
Please try this code. https://codereview.webrtc.org/1848083002/diff/20001/webrtc/p2p/base/relayserv... File webrtc/p2p/base/relayserver.cc (right): https://codereview.webrtc.org/1848083002/diff/20001/webrtc/p2p/base/relayserv... webrtc/p2p/base/relayserver.cc:268: username = username.substr(0, colonpos); uint32_t length = static_cast<uint32_t>(username_attr->length())); std::string username(username_attr->bytes(), length); // TODO: Check the HMAC. // The binding should already be present. BindingMap::iterator biter = bindings_.find(username); if (biter == bindings_.end()) { LOG(LS_WARNING) << "Dropping packet: no binding with username"; return; } On 2016/05/05 23:10:59, Zhi Huang wrote: > On 2016/05/05 20:24:31, pthatcher1 wrote: > > On 2016/05/05 18:27:09, Zhi Huang wrote: > > > On 2016/05/05 18:07:19, pthatcher1 wrote: > > > > I don't think this is correct. > > > > > > > > The place where we put a binding into bindings_ gets a username from code > > kind > > > > of like this: > > > > > > > > std::string username; > > > > const StunByteStringAttribute* username_attr = > > > > msg->GetByteString(STUN_ATTR_USERNAME); > > > > username.append(username_attr->bytes(), username_attr->length()); > > > > > > > > So we should just make this code match and use the full username, not the > > > > username up to a colon. > > > > > > > > The only thing the code did before that we might remove is set a maximum > > > > username length to 16. But this is legacy code and it's probably not > worth > > > > changing it for that. > > > > > > > > > > > > In other words, just revert this file. It doesn't need to be changed. > > > > > > > > > > > > > > The reason I made these changes is some unit tests will fail. > > > > > > I looked into this and I found that username_attr contains two parts (two > > names > > > I think) which is separated by a colon and the length of user_name is 2 * > > > length(ufrag) + 1. When the ufrag length is 16, the length of username_attr > is > > > 33. After min(33, 16), the length will be 16, which works fine. However, > when > > > the ufrag length is 4, the length(username_attr) = 9. After min(9, 16), the > > > length will be 9, which will be a problem. > > > > I don't see why a length of 9 would cause this code to fail, but perhaps there > > is something I missing. In that case, we should fix the unittest to use 16 > > rather than 4. > > > > Which unit test is it? > > I changed code like this: > const uint32_t USERNAME_LENGTH = 16; > ... > uint32_t length = > std::min(static_cast<uint32_t>(username_attr->length()), > USERNAME_LENGTH); > std::string username(username_attr->bytes(), length); > // TODO: Check the HMAC. > // The binding should already be present. > BindingMap::iterator biter = bindings_.find(username); > if (biter == bindings_.end()) { > LOG(LS_WARNING) << "Dropping packet: no binding with username"; > return; > } > > These tests will fail. > out/Debug/rtc_unittests: PortTest.TestLocalToTcpGturn > out/Debug/rtc_unittests: PortTest.TestLocalToGturn > out/Debug/rtc_unittests: PortTest.TestPRNatToTcpGturn > out/Debug/rtc_unittests: PortTest.TestLocalToSslTcpGturn > out/Debug/rtc_unittests: PortTest.TestPRNatToGturn > out/Debug/rtc_unittests: PortTest.TestSymNatToGturn > out/Debug/rtc_unittests: PortTest.TestSymNatToTcpGturn > out/Debug/rtc_unittests: PortTest.TestARNatToGturn > out/Debug/rtc_unittests: PortTest.TestARNATNatToTcpGturn > out/Debug/rtc_unittests: PortTest.TestConeNatToGturn > out/Debug/rtc_unittests: PortTest.TestConeNatToTcpGturn > > When I change USERNAME_LENGTH = 4, these tests will fail. > out/Debug/rtc_unittests: RelayServerTest.TestRemoteBind > out/Debug/rtc_unittests: RelayServerTest.TestSendRequestBadUsername > out/Debug/rtc_unittests: RelayServerTest.TestSendRequestNoDestinationAddress > out/Debug/rtc_unittests: RelayServerTest.TestSendRequestNoData > out/Debug/rtc_unittests: RelayServerTest.TestSendRaw > > Since the USERNAME_LENGTH is only used here, I think its purpose is to extract > the substring from username_attribute. So using the colon to extract the > username might be more flexible. >
zhihuang@chromium.org changed reviewers: + zhihuang@chromium.org
lgtm!
The CQ bit was checked by zhihuang@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from deadbeef@webrtc.org Link to the patchset: https://codereview.webrtc.org/1848083002/#ps60001 (title: "Revert unnecessary change. Minor.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1848083002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1848083002/60001
The CQ bit was unchecked by zhihuang@chromium.org
Description was changed from ========== Change the size of the ICE ufrag to 4 bytes. This is the minumum allowed size, and will allow STUN pings to be smaller. ========== to ========== Change the size of the ICE ufrag to 4 bytes. This is the minumum allowed size, and will allow STUN pings to be smaller. The unit tests on the the Gturn are also modified. A username with length of 16 bytes will be generated for Gturn only. ==========
Description was changed from ========== Change the size of the ICE ufrag to 4 bytes. This is the minumum allowed size, and will allow STUN pings to be smaller. The unit tests on the the Gturn are also modified. A username with length of 16 bytes will be generated for Gturn only. ========== to ========== Change the size of the ICE ufrag to 4 bytes. This is the minumum allowed size, and will allow STUN pings to be smaller. The unit tests on the the Gturn are also modified. A username with length of 16 bytes will be generated for Gturn only. ==========
The CQ bit was checked by zhihuang@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1848083002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1848083002/60001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_compile_x86_dbg on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/android_compile_x86_dbg...)
The CQ bit was checked by zhihuang@webrtc.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1848083002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1848083002/60001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_arm64_rel on tryserver.webrtc (JOB_TIMED_OUT, no build URL)
The CQ bit was checked by zhihuang@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from deadbeef@webrtc.org, pthatcher@webrtc.org Link to the patchset: https://codereview.webrtc.org/1848083002/#ps80001 (title: "Modified the constants in unit tests based on new ICE_UFRAG_LENGTH.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1848083002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1848083002/80001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_arm64_rel on tryserver.webrtc (JOB_TIMED_OUT, no build URL) android_dbg on tryserver.webrtc (JOB_TIMED_OUT, no build URL)
The CQ bit was checked by zhihuang@webrtc.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1848083002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1848083002/80001
Message was sent while issue was closed.
Description was changed from ========== Change the size of the ICE ufrag to 4 bytes. This is the minumum allowed size, and will allow STUN pings to be smaller. The unit tests on the the Gturn are also modified. A username with length of 16 bytes will be generated for Gturn only. ========== to ========== Change the size of the ICE ufrag to 4 bytes. This is the minumum allowed size, and will allow STUN pings to be smaller. The unit tests on the the Gturn are also modified. A username with length of 16 bytes will be generated for Gturn only. ==========
Message was sent while issue was closed.
Committed patchset #5 (id:80001)
Message was sent while issue was closed.
Description was changed from ========== Change the size of the ICE ufrag to 4 bytes. This is the minumum allowed size, and will allow STUN pings to be smaller. The unit tests on the the Gturn are also modified. A username with length of 16 bytes will be generated for Gturn only. ========== to ========== Change the size of the ICE ufrag to 4 bytes. This is the minumum allowed size, and will allow STUN pings to be smaller. The unit tests on the the Gturn are also modified. A username with length of 16 bytes will be generated for Gturn only. Committed: https://crrev.com/6d0d4bf31de1e36cab276ec3db994a952ba4b612 Cr-Commit-Position: refs/heads/master@{#12876} ==========
Message was sent while issue was closed.
Patchset 5 (id:??) landed as https://crrev.com/6d0d4bf31de1e36cab276ec3db994a952ba4b612 Cr-Commit-Position: refs/heads/master@{#12876}
Message was sent while issue was closed.
A revert of this CL (patchset #5 id:80001) has been created in https://codereview.webrtc.org/2006903004/ by zhihuang@webrtc.org. The reason for reverting is: Break the build on Win32.. |