From e6df0e47e73b832292187d2446dedf6fc3d7d991 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Tue, 29 May 2018 14:03:06 +0200 Subject: [PATCH] mgcp_network: do not log destination invalid ip/port as error It is legal to create connection without setting the destination ip and port (this usually done later through MDCX). However, if some other connection tries to deliver an RTP packet through a a half open connection, then the fact that no destination ip is set is logged as error even if it is a pretty normal situation. - Check if destination ip and port are set to zero. If yes, we assume that the destination connection details are intentionally not set yet. Only when one value is set and the other one not, we log an error. Otherweise we log a message to debug. Change-Id: If96e5a60b8ab92259d3bddaa143121893bb6c525 Related OS#3104 --- src/libosmo-mgcp/mgcp_network.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c index 41443825c..2da37b4a9 100644 --- a/src/libosmo-mgcp/mgcp_network.c +++ b/src/libosmo-mgcp/mgcp_network.c @@ -867,6 +867,15 @@ static int check_rtp_destin(struct mgcp_conn_rtp *conn) struct mgcp_endpoint *endp; endp = conn->conn->endp; + /* Note: it is legal to create a connection but never setting a port + * and IP-address for outgoing data. */ + if (strcmp(inet_ntoa(conn->end.addr), "0.0.0.0") == 0 && conn->end.rtp_port == 0) { + LOGP(DRTP, LOGL_DEBUG, + "endpoint:0x%x destination IP-address and rtp port is (not yet) known\n", + ENDPOINT_NUMBER(endp)); + return -1; + } + if (strcmp(inet_ntoa(conn->end.addr), "0.0.0.0") == 0) { LOGP(DRTP, LOGL_ERROR, "endpoint:0x%x destination IP-address is invalid\n",