[ISC-support #9937] some isc_xxx_get/setname became no-op
From BUGS RT #41902 From Support ticket #9937
I just realized some of the isc_xxx_getname() and isc_xxx_setname() functions are no-op since BIND 9.10. Specific cases I've noticed are isc_socket_setname() and isc_task_getname(), but I suspect there are more.
This is because these now always use thin-wrapper functions that change the behavior whether they are used for BIND 9's internal applications or for other general apps, e.g.:
isc_sockettype_t isc_socket_gettype(isc_socket_t *sock) { REQUIRE(ISCAPI_SOCKET_VALID(sock));
if (isc_bind9) return (isc__socket_gettype(sock));
return (sock->methods->gettype(sock)); }
But some of the wrappers were left no-op like in the case of isc_socket_setname()
void isc_socket_setname(isc_socket_t *socket, const char *name, void *tag) { REQUIRE(ISCAPI_SOCKET_VALID(socket));
UNUSED(socket); /* in case REQUIRE() is empty */ UNUSED(name); UNUSED(tag); }
so they lost the previous behavior even if called from BIND 9 applications.
I suspect this is an unintentional regression rather than a deliberate change; in fact, xml/json statistics still refer to the name set by isc_socket_name() (if the change were intentional you could have cleaned up these pieces of code, too).
Right now, this is not a critical issue for us, but you might want to check and fix it if it's really a regression.
follow up message and patch:
BIND 9.10 unified "export" and "bind9" versions of libisc and libdns, and, as a result of that, isc_socket_setname() and isc_task_getname() became no-op for BIND 9 (and, for that matter, the latter has always been undefined for the export/non-BIND9 case). I suspect it's accidental, not intentional. It can be fixed by the following trivial patch. You might also want to add a "getname" method to isc_taskmethods{}.
diff --git a/lib/isc/socket_api.c b/lib/isc/socket_api.c index 78158c7..bc44dcf 100644 --- a/lib/isc/socket_api.c +++ b/lib/isc/socket_api.c @@ -230,9 +230,8 @@ void isc_socket_setname(isc_socket_t *sock, const char *name, void *tag) { REQUIRE(ISCAPI_SOCKET_VALID(sock));
- UNUSED(sock); /* in case REQUIRE() is empty */
- UNUSED(name);
- UNUSED(tag);
- if (isc_bind9)
- return (isc__socket_setname(sock, name, tag)); }
isc_result_t
diff --git a/lib/isc/task.c b/lib/isc/task.c index 1fac0df..aa1850a 100644 --- a/lib/isc/task.c +++ b/lib/isc/task.c @@ -2236,6 +2236,16 @@ isc_task_setname(isc_task_t *task, const char *name, void *tag) { task->methods->setname(task, name, tag); }
+const char * +isc_task_getname(isc_task_t *task) {
- REQUIRE(ISCAPI_TASK_VALID(task));
- if (isc_bind9)
- return (isc__task_getname(task));
- else
- return (NULL); /* no public method is exposed yet */ +}
unsigned int isc_task_purge(isc_task_t *task, void *sender, isc_eventtype_t type, void *tag) {