Bug 1860685 - Vendor libwebrtc from 597e7ba370

Upstream commit: https://webrtc.googlesource.com/src/+/597e7ba370a973f64f822aa247cb2355de7c5f47
    [M118] Obfuscate prflx raddr when using mdns

    BUG=chromium:1478690

    (cherry picked from commit a8e3111d8c6622eeb930c32ab7a2e6be51b3d801)

    Change-Id: I7a1caad7bbd2fc82507b61b59be71546494a304c
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/319580
    Reviewed-by: Harald Alvestrand <hta@webrtc.org>
    Reviewed-by: Henrik Boström <hbos@webrtc.org>
    Commit-Queue: Philipp Hancke <phancke@microsoft.com>
    Cr-Original-Commit-Position: refs/heads/main@{#40724}
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/320580
    Cr-Commit-Position: refs/branch-heads/5993@{#2}
    Cr-Branched-From: 5afcec093c1403fe9e3872706d04671cbc6d2983-refs/heads/main@{#40703}
This commit is contained in:
Byron Campen 2023-10-27 16:12:40 -05:00
parent 553777d97c
commit 555b024dda
4 changed files with 24 additions and 1 deletions

View File

@ -25821,3 +25821,6 @@ ff281aa328
# MOZ_LIBWEBRTC_SRC=/home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
7349579c42
# MOZ_LIBWEBRTC_SRC=/home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
597e7ba370

View File

@ -17238,3 +17238,5 @@ libwebrtc updated from /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebr
libwebrtc updated from /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-10-27T21:10:43.186110.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-10-27T21:11:33.670827.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-10-27T21:12:29.956641.

View File

@ -340,9 +340,12 @@ Candidate PortAllocator::SanitizeCandidate(const Candidate& c) const {
// If the candidate filter doesn't allow reflexive addresses, empty TURN raddr
// to avoid reflexive address leakage.
bool filter_turn_related_address = !(candidate_filter_ & CF_REFLEXIVE);
// Sanitize related_address when using MDNS.
bool filter_prflx_related_address = MdnsObfuscationEnabled();
bool filter_related_address =
((c.type() == STUN_PORT_TYPE && filter_stun_related_address) ||
(c.type() == RELAY_PORT_TYPE && filter_turn_related_address));
(c.type() == RELAY_PORT_TYPE && filter_turn_related_address) ||
(c.type() == PRFLX_PORT_TYPE && filter_prflx_related_address));
return c.ToSanitizedCopy(use_hostname_address, filter_related_address);
}

View File

@ -357,6 +357,21 @@ TEST_F(PortAllocatorTest, SanitizePrflxCandidateMdnsObfuscationEnabled) {
EXPECT_EQ("", output.address().ipaddr().ToString());
}
TEST_F(PortAllocatorTest,
SanitizePrflxCandidateMdnsObfuscationEnabledRelatedAddress) {
allocator_->SetMdnsObfuscationEnabledForTesting(true);
// Create the candidate from an IP literal. This populates the hostname.
cricket::Candidate input(1, "udp", rtc::SocketAddress(kIpv4Address, 443), 1,
"username", "password", cricket::PRFLX_PORT_TYPE, 1,
"foundation", 1, 1);
cricket::Candidate output = allocator_->SanitizeCandidate(input);
EXPECT_NE(kIpv4AddressWithPort, output.address().ToString());
EXPECT_EQ("", output.address().ipaddr().ToString());
EXPECT_NE(kIpv4AddressWithPort, output.related_address().ToString());
EXPECT_EQ("", output.related_address().ipaddr().ToString());
}
TEST_F(PortAllocatorTest, SanitizeIpv4NonLiteralMdnsObfuscationEnabled) {
// Create the candidate with an empty hostname.
allocator_->SetMdnsObfuscationEnabledForTesting(true);