mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-09-02 15:25:48 +00:00
Fix handling of changing a connectiong from connecting to connected, avoiding
releasing the memory for the omapi io object.
This commit is contained in:
5
RELNOTES
5
RELNOTES
@@ -205,6 +205,11 @@ work on other platforms. Please report any problems and suggested fixes to
|
|||||||
- ./configure now checks to ensure the intX_t and u_intX_t types are defined,
|
- ./configure now checks to ensure the intX_t and u_intX_t types are defined,
|
||||||
correcting a compilation failure when using Sun's compiler.
|
correcting a compilation failure when using Sun's compiler.
|
||||||
|
|
||||||
|
- Modified the handling of a connection to avoid releasing the omapi io
|
||||||
|
object for the connection while it is still in use. One symptom from
|
||||||
|
this error was a segfault when a failover secondary attempted to connect
|
||||||
|
to the failover primary if their clocks were not synchronized.
|
||||||
|
|
||||||
Changes since 4.1.0b1
|
Changes since 4.1.0b1
|
||||||
|
|
||||||
- A missing "else" in dhcrelay.c could have caused an interface not to
|
- A missing "else" in dhcrelay.c could have caused an interface not to
|
||||||
|
@@ -380,6 +380,12 @@ isc_result_t omapi_register_io_object (omapi_object_t *,
|
|||||||
isc_result_t (*)(omapi_object_t *),
|
isc_result_t (*)(omapi_object_t *),
|
||||||
isc_result_t (*)(omapi_object_t *),
|
isc_result_t (*)(omapi_object_t *),
|
||||||
isc_result_t (*)(omapi_object_t *));
|
isc_result_t (*)(omapi_object_t *));
|
||||||
|
isc_result_t omapi_reregister_io_object (omapi_object_t *,
|
||||||
|
int (*)(omapi_object_t *),
|
||||||
|
int (*)(omapi_object_t *),
|
||||||
|
isc_result_t (*)(omapi_object_t *),
|
||||||
|
isc_result_t (*)(omapi_object_t *),
|
||||||
|
isc_result_t (*)(omapi_object_t *));
|
||||||
isc_result_t omapi_unregister_io_object (omapi_object_t *);
|
isc_result_t omapi_unregister_io_object (omapi_object_t *);
|
||||||
isc_result_t omapi_dispatch (struct timeval *);
|
isc_result_t omapi_dispatch (struct timeval *);
|
||||||
isc_result_t omapi_wait_for_completion (omapi_object_t *, struct timeval *);
|
isc_result_t omapi_wait_for_completion (omapi_object_t *, struct timeval *);
|
||||||
|
@@ -674,11 +674,11 @@ static isc_result_t omapi_connection_connect_internal (omapi_object_t *h)
|
|||||||
(struct sockaddr *)&c -> local_addr, &sl) < 0) {
|
(struct sockaddr *)&c -> local_addr, &sl) < 0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disconnect from I/O object, if any. */
|
/* Reregister with the I/O object. If we don't already have an
|
||||||
if (h -> outer)
|
I/O object this turns into a register call, otherwise we simply
|
||||||
omapi_unregister_io_object (h);
|
modify the pointers in the I/O object. */
|
||||||
|
|
||||||
status = omapi_register_io_object (h,
|
status = omapi_reregister_io_object (h,
|
||||||
omapi_connection_readfd,
|
omapi_connection_readfd,
|
||||||
omapi_connection_writefd,
|
omapi_connection_writefd,
|
||||||
omapi_connection_reader,
|
omapi_connection_reader,
|
||||||
|
@@ -167,6 +167,50 @@ isc_result_t omapi_register_io_object (omapi_object_t *h,
|
|||||||
return ISC_R_SUCCESS;
|
return ISC_R_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ReRegister an I/O handle so that we can do asynchronous I/O on it.
|
||||||
|
* If the handle doesn't exist we call the register routine to build it.
|
||||||
|
* if it does exist we change the functions associated with it, and
|
||||||
|
* repoke the fd code to make it happy. Neither the objects nor the
|
||||||
|
* fd are allowed to have changed. */
|
||||||
|
|
||||||
|
isc_result_t omapi_reregister_io_object (omapi_object_t *h,
|
||||||
|
int (*readfd) (omapi_object_t *),
|
||||||
|
int (*writefd) (omapi_object_t *),
|
||||||
|
isc_result_t (*reader)
|
||||||
|
(omapi_object_t *),
|
||||||
|
isc_result_t (*writer)
|
||||||
|
(omapi_object_t *),
|
||||||
|
isc_result_t (*reaper)
|
||||||
|
(omapi_object_t *))
|
||||||
|
{
|
||||||
|
omapi_io_object_t *obj;
|
||||||
|
|
||||||
|
if ((!h -> outer) || (h -> outer -> type != omapi_type_io_object)) {
|
||||||
|
/* If we don't have an object or if the type isn't what
|
||||||
|
* we expect do the normal registration (which will overwrite
|
||||||
|
* an incorrect type, that's what we did historically, may
|
||||||
|
* want to change that)
|
||||||
|
*/
|
||||||
|
return (omapi_register_io_object (h, readfd, writefd,
|
||||||
|
reader, writer, reaper));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We have an io object of the correct type, try to update it */
|
||||||
|
/*sar*/
|
||||||
|
/* Should we validate that the fd matches the previous one?
|
||||||
|
* It's suppossed to, that's a requirement, don't bother yet */
|
||||||
|
|
||||||
|
obj = (omapi_io_object_t *)h->outer;
|
||||||
|
|
||||||
|
obj -> readfd = readfd;
|
||||||
|
obj -> writefd = writefd;
|
||||||
|
obj -> reader = reader;
|
||||||
|
obj -> writer = writer;
|
||||||
|
obj -> reaper = reaper;
|
||||||
|
|
||||||
|
return (ISC_R_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
isc_result_t omapi_unregister_io_object (omapi_object_t *h)
|
isc_result_t omapi_unregister_io_object (omapi_object_t *h)
|
||||||
{
|
{
|
||||||
omapi_io_object_t *p, *obj, *last, *ph;
|
omapi_io_object_t *p, *obj, *last, *ph;
|
||||||
|
Reference in New Issue
Block a user