feat(libwebrtc): implement four rtc::NetworkManagerBase address helpers #24668
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24668"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Callimann8 on 2026-11-20T22:53:46Z.
What
Implements four
rtc::NetworkManagerBaseexports of libwebrtc that threwNotImplemented:enumeration_permission() const(McIeA-8x1V0)set_default_local_addresses(const IPAddress&, const IPAddress&)(YasEM+qA8is)GetDefaultLocalAddress(int, IPAddress*) const(0Y6e9BZKB6Y)GetNetworkFromAddress(const IPAddress&) const(O1-Pt00dDLQ)They follow network.cc at M134. The new
include/NetworkManager.hppgives the layouts fromnetwork.h, with libc++ containers and the bundledsigslot.h, whose default policy issingle_threaded(56-byte signals):NetworkManagerBaseis 272 bytes withenumeration_permission_at 128,networks_at 136 and the default IPv4/IPv6 addresses at 200 and 232.Networkhasprefix_at 176 andips_at 240, andInterfaceAddresskeepsipv6_flags_in the tail padding ofIPAddressat 28.set_default_local_addressesstores each address only when its family matches (AF_INET,AF_INET6).GetDefaultLocalAddressreturns false for a nil default. For IPv6 it returns the best address of the network that holds the default one, followingNetwork::GetBestIP(skips deprecated addresses, prefers a temporary global, then link-local, then ULA), or the default itself when no network holds it.GetNetworkFromAddresswalksnetworks_and theirips_with the existingIPAddress::operator==.Address copies write the family and address and leave the destination vtable alone, as
IPAddress::operator=does. A null manager, or a null address that upstream would read or write, throws. A debt fragment records the layout assumptions.Tested
guest_webrtc_network_managergainsTestDefaultLocalAddressesandTestNetworkFromAddress: permission read, family filtering, untouched vtables, nil defaults, network lookup (IPv4 bytes that match an IPv6 entry don't match), eachGetBestIPbranch (temporary, global, link-local, ULA, IPv4 prefix, all deprecated), the unknown-network fallback and the null-argument throws.guest_webrtc_network_managerpasses in a Release build and in an ASan + UBSan build (ANYPS5_ENABLE_ASAN=ON,-fsanitize=undefined).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T23:47:16Z.
Review: APPROVED
Reviewed — looks good
No verified blocking defect was found in the six changed files; the console layout remains explicitly unverified.
What I ran
4f5db69dc38149969c84b468eebe15fdb89ec39cusing the prepared diff and readerrepo_read.py.core/libs/prx/libwebrtc/Export.cpp(diff only),core/libs/prx/libwebrtc/include/Api.hpp,core/libs/prx/libwebrtc/include/NetworkManager.hpp,core/libs/prx/libwebrtc/src/NetworkManager.cpp,core/libs/prx/libwebrtc/tests/NetworkManager.cpp(diff only),docs/dev/debt/changes/feat-libwebrtc-network-manager-base.md(diff only), andcore/libs/prx/libwebrtc/include/IpAddress.hpp,core/libs/prx/libwebrtc/src/IpAddress.cppfor context. All six changed files were included in the review bundle.Results
Findings
Blocking
None.
Non-blocking
NetworkManager.hpp; the debt record correctly tracks that they still need comparison against the console. Record that validation when available. This is a follow-up, not a verified defect in the reviewed code.Not verified
Export.cppand the added tests were inspected through the diff only; unchanged surrounding lines were not read.To get this to a good state
Nothing is required. Optional: compare the layout assumptions with the console and update the debt record with the result.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T23:55:47Z.
Review: COMMENTED
Reviewed — comments
Changes are not ready for a formal decision because the IPv6 address selection logic does not match the documented upstream selection behavior.
What I ran
Reviewed head
9f16f5b9344b2426736012ac5e80423acfd62a34. No commands or tests were run; this review used the prepared diff and pinned repository reader.Results
Findings
Blocking
None.
Non-blocking
BestIpcan replace an earlier ULA with a later one, and returns the last matching link-local/ULA address. UpstreamNetwork::GetBestIPretains the first candidate in each category, so a network with multiple candidate addresses can return a different result. Preserve the first link-local and ULA candidates (for example, assign them only when their stored pointer is null).core/libs/prx/libwebrtc/src/NetworkManager.cpp:93Sources
Behavior is implemented in
NetworkManager.cppat the reviewed head; equality used for address lookup compares families and address bytes inIpAddress.cpp.Not verified
No test commands, build, sanitizer run, or console/title behavior were verified. The description reports successful Linux GCC 13 Release and ASan/UBSan test runs, but those results were not independently checked. All six files marked reviewed in
manifest.jsonwere read:Export.cpp,include/Api.hpp,include/NetworkManager.hpp,src/NetworkManager.cpp,tests/NetworkManager.cpp, anddocs/dev/debt/changes/feat-libwebrtc-network-manager-base.md. No changed files were excluded.To get this to a good state
Nothing is required. Optional: retain the first link-local and ULA candidates to match upstream selection behavior.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T01:13:13Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
9f16f5b934:tools/check_conventions.pypassed.guest_webrtc_network_manager_testsbuilt cleanly.guest_webrtc_network_manager):core/libs/prx/libwebrtc/Export.cpp,core/libs/prx/libwebrtc/include/Api.hpp,core/libs/prx/libwebrtc/src/NetworkManager.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me