2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-05 00:55:24 +00:00

netmgr: add isc_nm_routeconnect()

isc_nm_routeconnect() opens a route/netlink socket, then calls a
connect callback, much like isc_nm_udpconnect(), with a handle that
can then be monitored for network changes.

Internally the socket is treated as a UDP socket, since route/netlink
sockets follow the datagram contract.
This commit is contained in:
Evan Hunt
2021-10-02 14:52:46 -07:00
parent a9e35ea936
commit 8c51a32e5c
4 changed files with 270 additions and 8 deletions

View File

@@ -240,6 +240,8 @@ typedef enum isc__netievent_type {
netievent_udpread,
netievent_udpcancel,
netievent_routeconnect,
netievent_tcpconnect,
netievent_tcpclose,
netievent_tcpsend,
@@ -967,6 +969,8 @@ struct isc_nmsocket {
atomic_bool active;
atomic_bool destroying;
bool route_sock;
/*%
* Socket is closed if it's not active and all the possible
* callbacks were fired, there are no active handles, etc.
@@ -1351,6 +1355,12 @@ isc__nm_async_udpclose(isc__networker_t *worker, isc__netievent_t *ev0);
* Callback handlers for asynchronous UDP events (listen, stoplisten, send).
*/
void
isc__nm_async_routeconnect(isc__networker_t *worker, isc__netievent_t *ev0);
/*%<
* Callback handler for route socket events.
*/
void
isc__nm_tcp_send(isc_nmhandle_t *handle, const isc_region_t *region,
isc_nm_cb_t cb, void *cbarg);
@@ -1880,6 +1890,8 @@ NETIEVENT_SOCKET_TYPE(tcpstartread);
NETIEVENT_SOCKET_REQ_TYPE(tlssend);
NETIEVENT_SOCKET_REQ_TYPE(udpconnect);
NETIEVENT_SOCKET_REQ_TYPE(routeconnect);
NETIEVENT_SOCKET_REQ_RESULT_TYPE(connectcb);
NETIEVENT_SOCKET_REQ_RESULT_TYPE(readcb);
NETIEVENT_SOCKET_REQ_RESULT_TYPE(sendcb);
@@ -1946,6 +1958,8 @@ NETIEVENT_SOCKET_REQ_DECL(tcpsend);
NETIEVENT_SOCKET_REQ_DECL(tlssend);
NETIEVENT_SOCKET_REQ_DECL(udpconnect);
NETIEVENT_SOCKET_REQ_DECL(routeconnect);
NETIEVENT_SOCKET_REQ_RESULT_DECL(connectcb);
NETIEVENT_SOCKET_REQ_RESULT_DECL(readcb);
NETIEVENT_SOCKET_REQ_RESULT_DECL(sendcb);