#ifdef WITH_COA_TUNNEL
int proxy_tls_send_reply(rad_listen_t *listener, REQUEST *request);
int dual_tls_send_coa_request(rad_listen_t *listener, REQUEST *request);
+void listen_coa_add(rad_listen_t *listener, char const *key);
+void listen_coa_delete(rad_listen_t *listener);
+rad_listen_t *listen_coa_find(REQUEST *request, char const *key);
#endif
#endif
this->proxy_encode = master_listen[RAD_LISTEN_PROXY].encode;
this->proxy_decode = master_listen[RAD_LISTEN_PROXY].decode;
-// listener_store_byaddr(this, &sock->other_ipaddr);
-
/*
* Automatically create a home server for this
* client. There MAY be one already one for that
return NULL;
}
+
+#ifdef WITH_COA_TUNNEL
+/*
+ * Adds a listener to the hash of listeners, based on key.
+ */
+void listen_coa_add(rad_listen_t *this, char const *key)
+{
+ rad_assert(this->send_coa);
+ rad_assert(this->parent);
+
+ /*
+ * We can use "this" as a context, because it's created
+ * in the NULL context, so it's thread-safe.
+ */
+ this->key = talloc_strdup(this, key);
+
+ /*
+ * Do more things here.
+ */
+}
+
+/*
+ * Delete a listener from the hash of listeners.
+ *
+ * Note that all requests using this MUST be removed from the
+ * listener, and MUST NOT point to the listener any more.
+ */
+void listen_coa_delete(rad_listen_t *this)
+{
+ rad_assert(this->send_coa);
+ rad_assert(this->parent);
+
+
+ /*
+ * Do more things here.
+ */
+}
+
+/*
+ * Find an active listener by key.
+ */
+rad_listen_t *listen_coa_find(UNUSED REQUEST *request, UNUSED char const *key)
+{
+ /*
+ * Do more things here.
+ */
+ return NULL;
+}
+#endif
RDEBUG3("proxy: Trying to allocate ID (%d/2)", tries);
success = fr_packet_list_id_alloc(proxy_list,
- request->home_server->proto,
- &request->proxy, &proxy_listener);
+ request->home_server->proto,
+ &request->proxy, &proxy_listener);
if (success) break;
if (tries > 0) continue; /* try opening new socket only once */
*/
if (this->send_coa && this->parent) {
PTHREAD_MUTEX_LOCK(&proxy_mutex);
- if(!fr_packet_list_socket_add(proxy_list, this->fd,
- sock->proto,
- &sock->other_ipaddr, sock->other_port,
- this)) {
- ERROR("Failed adding proxy socket");
+ if (!fr_packet_list_socket_add(proxy_list, this->fd,
+ sock->proto,
+ &sock->other_ipaddr, sock->other_port,
+ this)) {
+ ERROR("Failed adding coa proxy socket");
fr_exit_now(1);
}
PTHREAD_MUTEX_UNLOCK(&proxy_mutex);
* to stop using it. And then remove it from the
* list of outgoing sockets.
*/
- if (this->type == RAD_LISTEN_PROXY) {
+ if ((this->type == RAD_LISTEN_PROXY)
+#ifdef WITH_COA_TUNNEL
+ || (this->send_coa && this->parent)
+#endif
+ ) {
home_server_t *home;
home = sock->home;
* EOL all requests using this socket.
*/
rbtree_walk(pl, RBTREE_DELETE_ORDER, eol_listener, this);
+
+#ifdef WITH_COA_TUNNEL
+ /*
+ * Delete the listener from the set of
+ * listeners by key. This is done early,
+ * so that it won't be used while the
+ * cleanup timers are being run.
+ */
+ if (this->key) {
+ listen_coa_delete(this);
+ }
+#endif
}
/*
vp = fr_pair_find_by_num(request->config, PW_TCP_SESSION_KEY, 0, TAG_ANY);
if (vp) {
RDEBUG("Adding send CoA listener with key %s", vp->vp_strvalue);
-// listener_store_bykey(request->listener, vp->vp_strvalue);
+ listen_coa_add(request->listener, vp->vp_strvalue);
}
}
#endif