From d6dbc571cf34d6f01d741f6bc19ec7f701daed31 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 1 Jun 2015 10:47:37 -0400 Subject: [PATCH] restore RTP port exclusion --- daemon/call.h | 3 --- daemon/main.c | 6 +++--- daemon/media_socket.c | 14 ++++++++++++++ daemon/media_socket.h | 1 + 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/daemon/call.h b/daemon/call.h index 7b661b61b..b5df1c0b7 100644 --- a/daemon/call.h +++ b/daemon/call.h @@ -517,9 +517,6 @@ INLINE str *call_str_init_dup(struct call *c, char *s) { str_init(&t, s); return call_str_dup(c, &t); } -INLINE void callmaster_exclude_port(struct callmaster *m, u_int16_t p) { - //bit_array_set(m->ports_used, p); /* XXX fix */ -} INLINE struct packet_stream *packet_stream_sink(struct packet_stream *ps) { struct packet_stream *ret; ret = ps->rtp_sink; diff --git a/daemon/main.c b/daemon/main.c index e953af87e..1689cbb40 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -583,7 +583,7 @@ no_kernel: cu = NULL; if (udp_listen_ep.port) { - // callmaster_exclude_port(ctx->m, udp_listenport); /* XXX fix */ + interfaces_exclude_port(udp_listen_ep.port); cu = control_udp_new(ctx->p, &udp_listen_ep, ctx->m); if (!cu) die("Failed to open UDP control connection port"); @@ -591,7 +591,7 @@ no_kernel: cn = NULL; if (ng_listen_ep.port) { - // callmaster_exclude_port(ctx->m, ng_listenport); /* XXX fix */ + interfaces_exclude_port(ng_listen_ep.port); cn = control_ng_new(ctx->p, &ng_listen_ep, ctx->m); if (!cn) die("Failed to open UDP control connection port"); @@ -599,7 +599,7 @@ no_kernel: cl = NULL; if (tcp_listen_ep.port) { - // callmaster_exclude_port(ctx->m, cli_listenport); /* XXX fix */ + interfaces_exclude_port(cli_listen_ep.port); cl = cli_new(ctx->p, &cli_listen_ep, ctx->m); if (!cl) die("Failed to open UDP CLI connection port"); diff --git a/daemon/media_socket.c b/daemon/media_socket.c index 4ddd153af..9f3c1bf24 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -337,6 +337,20 @@ void interfaces_init(GQueue *interfaces) { } } +void interfaces_exclude_port(unsigned int port) { + GList *vals, *l; + struct intf_spec *spec; + + vals = g_hash_table_get_values(__intf_spec_addr_type_hash); + + for (l = vals; l; l = l->next) { + spec = l->data; + bit_array_set(spec->port_pool.ports_used, port); + } + + g_list_free(vals); +} + struct local_intf *get_interface_address(const struct logical_intf *lif, sockfamily_t *fam) { const GQueue *q; diff --git a/daemon/media_socket.h b/daemon/media_socket.h index e427dc13c..c09897e71 100644 --- a/daemon/media_socket.h +++ b/daemon/media_socket.h @@ -70,6 +70,7 @@ void interfaces_init(GQueue *interfaces); struct logical_intf *get_logical_interface(const str *name, sockfamily_t *fam); struct local_intf *get_interface_address(const struct logical_intf *lif, sockfamily_t *fam); struct local_intf *get_any_interface_address(const struct logical_intf *lif, sockfamily_t *fam); +void interfaces_exclude_port(unsigned int port); //int get_port(socket_t *r, unsigned int port, const struct local_intf *lif, const struct call *c); //void release_port(socket_t *r, const struct local_intf *);