diff options
author | Thomas Markwalder <tmark@isc.org> | 2017-12-07 11:23:36 -0500 |
---|---|---|
committer | Thomas Markwalder <tmark@isc.org> | 2017-12-07 11:23:36 -0500 |
commit | 1a6b62fe17a42b00fa234d06b6dfde3d03451894 (patch) | |
tree | 568825ac24d2723a0bd6a2c94a8d4bf082fb25ab | |
parent | 2bc53156262223ce9b9a9034361edc2a0a8f3684 (diff) | |
download | isc-dhcp-1a6b62fe17a42b00fa234d06b6dfde3d03451894.tar.gz |
[master] Plugs a socket descriptor leak in OMAPI
Merges in rt46767.
-rw-r--r-- | RELNOTES | 5 | ||||
-rw-r--r-- | omapip/buffer.c | 9 | ||||
-rw-r--r-- | omapip/message.c | 2 |
3 files changed, 15 insertions, 1 deletions
@@ -1254,6 +1254,11 @@ dhcp-users@lists.isc.org. to accomodate a change in behavior in BIND9 isc_heap_delete(). [ISC-bugs #46719] +- Plugged a socket descriptor leak in OMAPI, that can occur when there is + data pending to be written to an OMAPI connection, when the connection + is closed by the reader. + [ISc-Bugs #46767] + Changes since 4.2.0 (new features) - If a client renews before 'dhcp-cache-threshold' percent of its lease diff --git a/omapip/buffer.c b/omapip/buffer.c index 6e0621b5..a21f0a80 100644 --- a/omapip/buffer.c +++ b/omapip/buffer.c @@ -565,6 +565,15 @@ isc_result_t omapi_connection_writer (omapi_object_t *h) omapi_buffer_dereference (&buffer, MDL); } } + + /* If we had data left to write when we're told to disconnect, + * we need recall disconnect, now that we're done writing. + * See rt46767. */ + if (c->out_bytes == 0 && c->state == omapi_connection_disconnecting) { + omapi_disconnect (h, 1); + return ISC_R_SHUTTINGDOWN; + } + return ISC_R_SUCCESS; } diff --git a/omapip/message.c b/omapip/message.c index ee15d821..37abbd25 100644 --- a/omapip/message.c +++ b/omapip/message.c @@ -339,7 +339,7 @@ isc_result_t omapi_message_unregister (omapi_object_t *mo) } #ifdef DEBUG_PROTOCOL -static const char *omapi_message_op_name(int op) { +const char *omapi_message_op_name(int op) { switch (op) { case OMAPI_OP_OPEN: return "OMAPI_OP_OPEN"; case OMAPI_OP_REFRESH: return "OMAPI_OP_REFRESH"; |