From: Ondřej Surý Date: Thu, 19 Feb 2026 11:55:45 +0000 (+0100) Subject: Rename isc_net_getudpportrange() to isc_net_getportrange() X-Git-Tag: v9.20.20~16^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae81ce723d9f94cec9ff2a76d80b8f9626153504;p=thirdparty%2Fbind9.git Rename isc_net_getudpportrange() to isc_net_getportrange() This better reflects the true nature of the function as we are reading the ephemeral port range which is not related to UDP at all. (cherry picked from commit 295139f8ca7054934ee455106385dff1905fcd01) --- diff --git a/bin/named/server.c b/bin/named/server.c index 3ea6f5d4058..796b4cc97ee 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -8849,7 +8849,7 @@ load_configuration(const char *filename, named_server_t *server, if (usev4ports != NULL) { portset_fromconf(v4portset, usev4ports, true); } else { - isc_net_getudpportrange(AF_INET, &port_low, &port_high); + isc_net_getportrange(AF_INET, &port_low, &port_high); if (port_low == port_high) { isc_portset_add(v4portset, port_low); } else { @@ -8872,7 +8872,7 @@ load_configuration(const char *filename, named_server_t *server, if (usev6ports != NULL) { portset_fromconf(v6portset, usev6ports, true); } else { - isc_net_getudpportrange(AF_INET6, &port_low, &port_high); + isc_net_getportrange(AF_INET6, &port_low, &port_high); if (port_low == port_high) { isc_portset_add(v6portset, port_low); } else { diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c index 150ca90045c..a33693d5125 100644 --- a/bin/nsupdate/nsupdate.c +++ b/bin/nsupdate/nsupdate.c @@ -771,12 +771,12 @@ set_source_ports(dns_dispatchmgr_t *manager) { result = isc_portset_create(gmctx, &v4portset); check_result(result, "isc_portset_create (v4)"); - isc_net_getudpportrange(AF_INET, &udpport_low, &udpport_high); + isc_net_getportrange(AF_INET, &udpport_low, &udpport_high); isc_portset_addrange(v4portset, udpport_low, udpport_high); result = isc_portset_create(gmctx, &v6portset); check_result(result, "isc_portset_create (v6)"); - isc_net_getudpportrange(AF_INET6, &udpport_low, &udpport_high); + isc_net_getportrange(AF_INET6, &udpport_low, &udpport_high); isc_portset_addrange(v6portset, udpport_low, udpport_high); result = dns_dispatchmgr_setavailports(manager, v4portset, v6portset); diff --git a/bin/tools/mdig.c b/bin/tools/mdig.c index d6ade76584c..3da295db3f8 100644 --- a/bin/tools/mdig.c +++ b/bin/tools/mdig.c @@ -2046,7 +2046,7 @@ set_source_ports(dns_dispatchmgr_t *manager) { fatal("isc_portset_create (v4) failed"); } - isc_net_getudpportrange(AF_INET, &udpport_low, &udpport_high); + isc_net_getportrange(AF_INET, &udpport_low, &udpport_high); isc_portset_addrange(v4portset, udpport_low, udpport_high); @@ -2054,7 +2054,7 @@ set_source_ports(dns_dispatchmgr_t *manager) { if (result != ISC_R_SUCCESS) { fatal("isc_portset_create (v6) failed"); } - isc_net_getudpportrange(AF_INET6, &udpport_low, &udpport_high); + isc_net_getportrange(AF_INET6, &udpport_low, &udpport_high); isc_portset_addrange(v6portset, udpport_low, udpport_high); diff --git a/lib/dns/client.c b/lib/dns/client.c index 12c61a09bf5..5f9e5d0557a 100644 --- a/lib/dns/client.c +++ b/lib/dns/client.c @@ -146,14 +146,14 @@ setsourceports(isc_mem_t *mctx, dns_dispatchmgr_t *manager) { if (result != ISC_R_SUCCESS) { goto cleanup; } - isc_net_getudpportrange(AF_INET, &udpport_low, &udpport_high); + isc_net_getportrange(AF_INET, &udpport_low, &udpport_high); isc_portset_addrange(v4portset, udpport_low, udpport_high); result = isc_portset_create(mctx, &v6portset); if (result != ISC_R_SUCCESS) { goto cleanup; } - isc_net_getudpportrange(AF_INET6, &udpport_low, &udpport_high); + isc_net_getportrange(AF_INET6, &udpport_low, &udpport_high); isc_portset_addrange(v6portset, udpport_low, udpport_high); result = dns_dispatchmgr_setavailports(manager, v4portset, v6portset); diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c index a31ad8833ec..61134236591 100644 --- a/lib/dns/dispatch.c +++ b/lib/dns/dispatch.c @@ -917,7 +917,7 @@ static void create_default_portset(isc_mem_t *mctx, int family, isc_portset_t **portsetp) { in_port_t low, high; - isc_net_getudpportrange(family, &low, &high); + isc_net_getportrange(family, &low, &high); isc_portset_create(mctx, portsetp); isc_portset_addrange(*portsetp, low, high); diff --git a/lib/isc/include/isc/net.h b/lib/isc/include/isc/net.h index e29967b59c7..4cd42696415 100644 --- a/lib/isc/include/isc/net.h +++ b/lib/isc/include/isc/net.h @@ -249,7 +249,7 @@ void isc_net_enableipv6(void); void -isc_net_getudpportrange(int af, in_port_t *low, in_port_t *high); +isc_net_getportrange(int af, in_port_t *low, in_port_t *high); /*%< * Returns system's default range of ephemeral UDP ports, if defined. * If the range is not available or unknown, ISC_NET_PORTRANGELOW and diff --git a/lib/isc/net.c b/lib/isc/net.c index af951c0e29e..42d86548d62 100644 --- a/lib/isc/net.c +++ b/lib/isc/net.c @@ -333,7 +333,7 @@ isc_net_probe_ipv6pktinfo(void) { #if defined(USE_SYSCTL_PORTRANGE) #if defined(HAVE_SYSCTLBYNAME) static isc_result_t -getudpportrange_sysctl(int af, in_port_t *low, in_port_t *high) { +getportrange_sysctl(int af, in_port_t *low, in_port_t *high) { int port_low, port_high; size_t portlen; const char *sysctlname_lowport, *sysctlname_hiport; @@ -366,7 +366,7 @@ getudpportrange_sysctl(int af, in_port_t *low, in_port_t *high) { } #else /* !HAVE_SYSCTLBYNAME */ static isc_result_t -getudpportrange_sysctl(int af, in_port_t *low, in_port_t *high) { +getportrange_sysctl(int af, in_port_t *low, in_port_t *high) { int mib_lo4[4] = SYSCTL_V4PORTRANGE_LOW; int mib_hi4[4] = SYSCTL_V4PORTRANGE_HIGH; int mib_lo6[4] = SYSCTL_V6PORTRANGE_LOW; @@ -408,17 +408,17 @@ getudpportrange_sysctl(int af, in_port_t *low, in_port_t *high) { #endif /* USE_SYSCTL_PORTRANGE */ void -isc_net_getudpportrange(int af, in_port_t *low, in_port_t *high) { +isc_net_getportrange(int af, in_port_t *low, in_port_t *high) { int result = ISC_R_FAILURE; -#if !defined(USE_SYSCTL_PORTRANGE) && defined(__linux) +#if !defined(USE_SYSCTL_PORTRANGE) && defined(__linux__) FILE *fp; -#endif /* if !defined(USE_SYSCTL_PORTRANGE) && defined(__linux) */ +#endif /* if !defined(USE_SYSCTL_PORTRANGE) && defined(__linux__) */ REQUIRE(low != NULL && high != NULL); #if defined(USE_SYSCTL_PORTRANGE) - result = getudpportrange_sysctl(af, low, high); -#elif defined(__linux) + result = getportrange_sysctl(af, low, high); +#elif defined(__linux__) UNUSED(af); diff --git a/lib/isc/netmgr/netmgr.c b/lib/isc/netmgr/netmgr.c index 70471465c7c..3f3be464bb0 100644 --- a/lib/isc/netmgr/netmgr.c +++ b/lib/isc/netmgr/netmgr.c @@ -247,10 +247,10 @@ isc_netmgr_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr, isc_nm_t **netmgrp) { /* * Set the initial port range for IP_LOCAL_PORT_RANGE. */ - isc_net_getudpportrange(AF_INET, &port_low, &port_high); + isc_net_getportrange(AF_INET, &port_low, &port_high); isc_netmgr_portrange(netmgr, AF_INET, port_low, port_high); - isc_net_getudpportrange(AF_INET6, &port_low, &port_high); + isc_net_getportrange(AF_INET6, &port_low, &port_high); isc_netmgr_portrange(netmgr, AF_INET6, port_low, port_high); }