mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
				synced 2025-11-02 21:13:44 +00:00 
			
		
		
		
	mgcp: Indicate where the sending failed
The log message does not help and says where the data is being sent to. This is because we have both a RTP and RTCP port. Remember if we failed with RTCP or RTP and improve the log message. I was searching a case where the port was bound to a local address (e.g. 127.0.0.1) and tried to send the data to a public one (e.g. 8.8.8.8).
This commit is contained in:
		@@ -94,6 +94,7 @@ int mgcp_send_dummy(struct mgcp_endpoint *endp)
 | 
			
		||||
{
 | 
			
		||||
	static char buf[] = { MGCP_DUMMY_LOAD };
 | 
			
		||||
	int rc;
 | 
			
		||||
	int was_rtcp = 0;
 | 
			
		||||
 | 
			
		||||
	rc = mgcp_udp_send(endp->net_end.rtp.fd, &endp->net_end.addr,
 | 
			
		||||
			   endp->net_end.rtp_port, buf, 1);
 | 
			
		||||
@@ -104,6 +105,7 @@ int mgcp_send_dummy(struct mgcp_endpoint *endp)
 | 
			
		||||
	if (endp->tcfg->omit_rtcp)
 | 
			
		||||
		return rc;
 | 
			
		||||
 | 
			
		||||
	was_rtcp = 1;
 | 
			
		||||
	rc = mgcp_udp_send(endp->net_end.rtcp.fd, &endp->net_end.addr,
 | 
			
		||||
			   endp->net_end.rtcp_port, buf, 1);
 | 
			
		||||
 | 
			
		||||
@@ -112,8 +114,10 @@ int mgcp_send_dummy(struct mgcp_endpoint *endp)
 | 
			
		||||
 | 
			
		||||
failed:
 | 
			
		||||
	LOGP(DMGCP, LOGL_ERROR,
 | 
			
		||||
	     "Failed to send dummy packet: %s on: 0x%x to %s\n",
 | 
			
		||||
	     strerror(errno), ENDPOINT_NUMBER(endp), inet_ntoa(endp->net_end.addr));
 | 
			
		||||
		"Failed to send dummy %s packet: %s on: 0x%x to %s:%d\n",
 | 
			
		||||
		was_rtcp ? "RTCP" : "RTP",
 | 
			
		||||
		strerror(errno), ENDPOINT_NUMBER(endp), inet_ntoa(endp->net_end.addr),
 | 
			
		||||
		was_rtcp ? endp->net_end.rtcp_port : endp->net_end.rtp_port);
 | 
			
		||||
 | 
			
		||||
	return -1;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user