commit 629c789c60e5a1400da0f7f41ec3af6b49b056ef
parent 5130c32c7daa85792a6a07702b4960969665813c
Author: Michael Froman <mfroman@mozilla.com>
Date: Tue, 18 Nov 2025 17:44:37 +0000
Bug 2000353 - use nr_stun_get_addrs rather than nr_stun_find_local_addresses. r=bwc,ng
Once the disabled code is removed from nr_stun_find_local_addresses it
is just a passthrough to nr_stun_get_addrs.
Differential Revision: https://phabricator.services.mozilla.com/D272743
Diffstat:
5 files changed, 4 insertions(+), 64 deletions(-)
diff --git a/dom/media/webrtc/transport/nricectx.cpp b/dom/media/webrtc/transport/nricectx.cpp
@@ -61,6 +61,7 @@ extern "C" {
// clang-format off
#include "nr_api.h"
#include "registry.h"
+#include "addrs.h"
#include "async_timer.h"
#include "r_crc32.h"
#include "r_memory.h"
@@ -70,7 +71,6 @@ extern "C" {
#include "nr_socket.h"
#include "nr_socket_local.h"
#include "stun_reg.h"
-#include "stun_util.h"
#include "ice_codeword.h"
#include "ice_ctx.h"
#include "ice_candidate.h"
@@ -618,7 +618,7 @@ nsTArray<NrIceStunAddr> NrIceCtx::GetStunAddrs() {
}
MOZ_MTLOG(ML_INFO, "NrIceCtx static call to find local stun addresses");
- if (nr_stun_find_local_addresses(local_addrs, MAXADDRS, &addr_ct)) {
+ if (nr_stun_get_addrs(local_addrs, MAXADDRS, &addr_ct)) {
MOZ_MTLOG(ML_INFO, "Error finding local stun addresses");
} else {
for (int i = 0; i < addr_ct; ++i) {
diff --git a/dom/media/webrtc/transport/test/stunserver.cpp b/dom/media/webrtc/transport/test/stunserver.cpp
@@ -266,7 +266,7 @@ int TestStunServer::Initialize(int address_family) {
int r;
int i;
- r = nr_stun_find_local_addresses(addrs, max_addrs, &addr_ct);
+ r = nr_stun_get_addrs(addrs, max_addrs, &addr_ct);
if (r) {
MOZ_MTLOG(ML_ERROR, "Couldn't retrieve addresses");
return R_INTERNAL;
diff --git a/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_ctx.c b/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_ctx.c
@@ -871,7 +871,7 @@ int nr_ice_set_target_for_default_local_address_lookup(nr_ice_ctx *ctx, const ch
int stun_addr_ct;
if (!ctx->local_addrs) {
- if((r=nr_stun_find_local_addresses(stun_addrs,MAXADDRS,&stun_addr_ct))) {
+ if((r=nr_stun_get_addrs(stun_addrs,MAXADDRS,&stun_addr_ct))) {
ABORT(r);
}
if((r=nr_ice_set_local_addresses(ctx,stun_addrs,stun_addr_ct))) {
diff --git a/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_util.c b/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_util.c
@@ -47,7 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "stun_reg.h"
#include "registry.h"
#include "addrs.h"
-#include "transport_addr_reg.h"
#include "nr_crypto.h"
#include "hex.h"
@@ -113,63 +112,6 @@ nr_stun_xor_mapped_address(UINT4 magicCookie, UINT12 transactionId, nr_transport
}
int
-nr_stun_find_local_addresses(nr_local_addr addrs[], int maxaddrs, int *count)
-{
- int r,_status;
- //NR_registry *children = 0;
-
- *count = 0;
-
-#if 0
- // this really goes with the code commented out below. (mjf)
- if ((r=NR_reg_get_child_count(NR_STUN_REG_PREF_ADDRESS_PRFX, (unsigned int*)count)))
- if (r != R_NOT_FOUND)
- ABORT(r);
-#endif
-
- if (*count == 0) {
- if ((r=nr_stun_get_addrs(addrs, maxaddrs, count)))
- ABORT(r);
-
- goto done;
- }
-
- if (*count >= maxaddrs) {
- r_log(NR_LOG_STUN, LOG_INFO, "Address list truncated from %d to %d", *count, maxaddrs);
- *count = maxaddrs;
- }
-
-#if 0
- if (*count > 0) {
- /* TODO(ekr@rtfm.com): Commented out 2012-07-26.
-
- This code is currently not used in Firefox and needs to be
- ported to 64-bit */
- children = RCALLOC((*count + 10) * sizeof(*children));
- if (!children)
- ABORT(R_NO_MEMORY);
-
- assert(sizeof(size_t) == sizeof(*count));
-
- if ((r=NR_reg_get_children(NR_STUN_REG_PREF_ADDRESS_PRFX, children, (size_t)(*count + 10), (size_t*)count)))
- ABORT(r);
-
- for (i = 0; i < *count; ++i) {
- if ((r=nr_reg_get_transport_addr(children[i], 0, &addrs[i].addr)))
- ABORT(r);
- }
- }
-#endif
-
- done:
-
- _status=0;
- abort:
- //RFREE(children);
- return _status;
-}
-
-int
nr_stun_different_transaction(UCHAR *msg, size_t len, nr_stun_message *req)
{
int _status;
diff --git a/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_util.h b/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_util.h
@@ -44,8 +44,6 @@ int nr_stun_startup(void);
int nr_stun_xor_mapped_address(UINT4 magicCookie, UINT12 transactionId, nr_transport_addr *from, nr_transport_addr *to);
-int nr_stun_find_local_addresses(nr_local_addr addrs[], int maxaddrs, int *count);
-
int nr_stun_different_transaction(UCHAR *msg, size_t len, nr_stun_message *req);
char* nr_stun_msg_type(int type);