From 8a9f12dc2f69bf3a4e861cc9a81b71bdc5f13180 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Tue, 20 Sep 2016 18:18:26 +0200 Subject: mgcp dbg log Change-Id: I56fda48edaa92abfc6e3886cdfce733bb0686f73 --- openbsc/src/libmgcp/mgcp_network.c | 97 ++++++++++++++++++++++++++++++++++--- openbsc/src/libmgcp/mgcp_protocol.c | 9 ++++ 2 files changed, 99 insertions(+), 7 deletions(-) diff --git a/openbsc/src/libmgcp/mgcp_network.c b/openbsc/src/libmgcp/mgcp_network.c index abce6e49d..25ec3c5b6 100644 --- a/openbsc/src/libmgcp/mgcp_network.c +++ b/openbsc/src/libmgcp/mgcp_network.c @@ -588,6 +588,14 @@ int mgcp_send(struct mgcp_endpoint *endp, int dest, int is_rtp, struct mgcp_rtp_state *rtp_state; int tap_idx; + LOGP(DMGCP, LOGL_DEBUG, + "endpoint %x dest %s tcfg->audio_loop %d endp->conn_mode %d (== loopback: %d)\n", + ENDPOINT_NUMBER(endp), + dest == MGCP_DEST_NET? "net" : "bts", + tcfg->audio_loop, + endp->conn_mode, + endp->conn_mode == MGCP_CONN_LOOPBACK); + /* For loop toggle the destination and then dispatch. */ if (tcfg->audio_loop) dest = !dest; @@ -605,10 +613,35 @@ int mgcp_send(struct mgcp_endpoint *endp, int dest, int is_rtp, rtp_state = &endp->net_state; tap_idx = MGCP_TAP_BTS_OUT; } - - if (!rtp_end->output_enabled) + LOGP(DMGCP, LOGL_DEBUG, + "endpoint %x dest %s net_end %s %d %d bts_end %s %d %d rtp_end %s %d %d\n", + ENDPOINT_NUMBER(endp), + dest == MGCP_DEST_NET? "net" : "bts", + + inet_ntoa(endp->net_end.addr), + ntohs(endp->net_end.rtp_port), + ntohs(endp->net_end.rtcp_port), + + inet_ntoa(endp->bts_end.addr), + ntohs(endp->bts_end.rtp_port), + ntohs(endp->bts_end.rtcp_port), + + inet_ntoa(rtp_end->addr), + ntohs(rtp_end->rtp_port), + ntohs(rtp_end->rtcp_port) + ); + + if (!rtp_end->output_enabled) { rtp_end->dropped_packets += 1; - else if (is_rtp) { + LOGP(DMGCP, LOGL_DEBUG, + "endpoint %x output disabled, drop to %s %s %d %d\n", + ENDPOINT_NUMBER(endp), + dest == MGCP_DEST_NET? "net" : "bts", + inet_ntoa(rtp_end->addr), + ntohs(rtp_end->rtp_port), + ntohs(rtp_end->rtcp_port) + ); + } else if (is_rtp) { int cont; int nbytes = 0; int len = rc; @@ -619,6 +652,14 @@ int mgcp_send(struct mgcp_endpoint *endp, int dest, int is_rtp, break; mgcp_patch_and_count(endp, rtp_state, rtp_end, addr, buf, len); + LOGP(DMGCP, LOGL_DEBUG, + "endpoint %x process/send to %s %s %d %d\n", + ENDPOINT_NUMBER(endp), + (dest == MGCP_DEST_NET)? "net" : "bts", + inet_ntoa(rtp_end->addr), + ntohs(rtp_end->rtp_port), + ntohs(rtp_end->rtcp_port) + ); forward_data(rtp_end->rtp.fd, &endp->taps[tap_idx], buf, len); rc = mgcp_udp_send(rtp_end->rtp.fd, @@ -632,6 +673,14 @@ int mgcp_send(struct mgcp_endpoint *endp, int dest, int is_rtp, } while (len > 0); return nbytes; } else if (!tcfg->omit_rtcp) { + LOGP(DMGCP, LOGL_DEBUG, + "endpoint %x send to %s %s %d %d\n", + ENDPOINT_NUMBER(endp), + dest == MGCP_DEST_NET? "net" : "bts", + inet_ntoa(rtp_end->addr), + ntohs(rtp_end->rtp_port), + ntohs(rtp_end->rtcp_port) + ); return mgcp_udp_send(rtp_end->rtcp.fd, &rtp_end->addr, rtp_end->rtcp_port, buf, rc); @@ -676,9 +725,28 @@ static int rtp_data_net(struct osmo_fd *fd, unsigned int what) if (rc <= 0) return -1; + LOGP(DMGCP, LOGL_DEBUG, + "endpoint %x", + ENDPOINT_NUMBER(endp)); + LOGPC(DMGCP, LOGL_DEBUG, + " from net %s %d", + inet_ntoa(addr.sin_addr), + ntohs(addr.sin_port)); + LOGPC(DMGCP, LOGL_DEBUG, + " net_end %s %d %d", + inet_ntoa(endp->net_end.addr), + ntohs(endp->net_end.rtp_port), + ntohs(endp->net_end.rtcp_port)); + LOGPC(DMGCP, LOGL_DEBUG, + " bts_end %s %d %d\n", + inet_ntoa(endp->bts_end.addr), + ntohs(endp->bts_end.rtp_port), + ntohs(endp->bts_end.rtcp_port) + ); + if (memcmp(&addr.sin_addr, &endp->net_end.addr, sizeof(addr.sin_addr)) != 0) { LOGP(DMGCP, LOGL_ERROR, - "Endpoint 0x%x data from wrong address %s vs. ", + "rtp_data_net: Endpoint 0x%x data from wrong address %s vs. ", ENDPOINT_NUMBER(endp), inet_ntoa(addr.sin_addr)); LOGPC(DMGCP, LOGL_ERROR, "%s\n", inet_ntoa(endp->net_end.addr)); @@ -691,7 +759,7 @@ static int rtp_data_net(struct osmo_fd *fd, unsigned int what) if (endp->net_end.rtp_port != addr.sin_port && endp->net_end.rtcp_port != addr.sin_port) { LOGP(DMGCP, LOGL_ERROR, - "Data from wrong source port %d on 0x%x\n", + "rtp_data_net: Data from wrong source port %d on 0x%x\n", ntohs(addr.sin_port), ENDPOINT_NUMBER(endp)); return -1; } @@ -701,6 +769,12 @@ static int rtp_data_net(struct osmo_fd *fd, unsigned int what) break; } + LOGP(DMGCP, LOGL_DEBUG, + "rtp_data_net: Endpoint %x data from %s %d\n", + ENDPOINT_NUMBER(endp), + inet_ntoa(addr.sin_addr), + ntohs(addr.sin_port)); + /* throw away the dummy message */ if (rc == 1 && buf[0] == MGCP_DUMMY_LOAD) { LOGP(DMGCP, LOGL_NOTICE, "Filtered dummy from network on 0x%x\n", @@ -780,7 +854,7 @@ static int rtp_data_bts(struct osmo_fd *fd, unsigned int what) if (memcmp(&endp->bts_end.addr, &addr.sin_addr, sizeof(addr.sin_addr)) != 0) { LOGP(DMGCP, LOGL_ERROR, - "Data from wrong bts %s on 0x%x\n", + "rtp_data_bts: Data from wrong bts %s on 0x%x\n", inet_ntoa(addr.sin_addr), ENDPOINT_NUMBER(endp)); return -1; } @@ -788,11 +862,17 @@ static int rtp_data_bts(struct osmo_fd *fd, unsigned int what) if (endp->bts_end.rtp_port != addr.sin_port && endp->bts_end.rtcp_port != addr.sin_port) { LOGP(DMGCP, LOGL_ERROR, - "Data from wrong bts source port %d on 0x%x\n", + "rtp_data_bts: ata from wrong bts source port %d on 0x%x\n", ntohs(addr.sin_port), ENDPOINT_NUMBER(endp)); return -1; } + LOGP(DMGCP, LOGL_DEBUG, + "rtp_data_bts: Endpoint %x data from %s %d\n", + ENDPOINT_NUMBER(endp), + inet_ntoa(addr.sin_addr), + ntohs(addr.sin_port)); + /* throw away the dummy message */ if (rc == 1 && buf[0] == MGCP_DUMMY_LOAD) { LOGP(DMGCP, LOGL_NOTICE, "Filtered dummy from bts on 0x%x\n", @@ -808,6 +888,9 @@ static int rtp_data_bts(struct osmo_fd *fd, unsigned int what) switch (endp->type) { case MGCP_RTP_DEFAULT: + LOGP(DMGCP, LOGL_DEBUG, + "rtp_data_bts: Endpoint %x MGCP_RTP_DEFAULT\n", + ENDPOINT_NUMBER(endp)); return mgcp_send(endp, MGCP_DEST_NET, proto == MGCP_PROTO_RTP, &addr, buf, rc); case MGCP_RTP_TRANSCODED: diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c index 2e728cb75..2100f81a6 100644 --- a/openbsc/src/libmgcp/mgcp_protocol.c +++ b/openbsc/src/libmgcp/mgcp_protocol.c @@ -546,6 +546,11 @@ static int parse_conn_mode(const char *msg, struct mgcp_endpoint *endp) endp->bts_end.output_enabled = endp->conn_mode & MGCP_CONN_RECV_ONLY ? 1 : 0; + LOGP(DMGCP, LOGL_DEBUG, "endpoint %x connection mode '%s' %d output_enabled net %d bts %d\n", + ENDPOINT_NUMBER(endp), + msg, endp->conn_mode, endp->net_end.output_enabled, + endp->bts_end.output_enabled); + return ret; } @@ -971,6 +976,8 @@ static struct msgb *handle_modify_con(struct mgcp_parse_data *p) break; case MGCP_POLICY_DEFER: /* stop processing */ + LOGP(DMGCP, LOGL_DEBUG, "endp %x MDCX defer\n", + ENDPOINT_NUMBER(endp)); return NULL; break; case MGCP_POLICY_CONT: @@ -1002,6 +1009,8 @@ error3: out_silent: + LOGP(DMGCP, LOGL_DEBUG, "endp %x Modify endpoint: silent exit\n", + ENDPOINT_NUMBER(endp)); return NULL; } -- cgit v1.2.3