Get rid of separate rtp_port field

Let's use the port part of the struct mgcp_rtp_end->addr field instead
of keeping it separate. This makes it easier passing around and
using/checking the RTP remote address + port, and avoids confusion
having to check stuff outside of the address, with its port part
potentially unset.

Change-Id: I294eb5d85fae79bf62d36eb9e818426e187d442c
diff --git a/src/libosmo-mgcp/mgcp_iuup.c b/src/libosmo-mgcp/mgcp_iuup.c
index 48e4ce7..90021f3 100644
--- a/src/libosmo-mgcp/mgcp_iuup.c
+++ b/src/libosmo-mgcp/mgcp_iuup.c
@@ -489,7 +489,7 @@
 			 "rtp_port:%u rtcp_port:%u\n",
 			 dest_name,
 			 osmo_sockaddr_ntop(&rtp_end->addr.u.sa, ipbuf),
-			 ntohs(rtp_end->rtp_port), ntohs(rtp_end->rtcp_port)
+			 osmo_sockaddr_port(&rtp_end->addr.u.sa), ntohs(rtp_end->rtcp_port)
 			);
 		return 0;
 	}
@@ -505,14 +505,13 @@
 	LOGPENDP(endp, DRTP, LOGL_DEBUG,
 		 "process/send IuUP to %s %s rtp_port:%u rtcp_port:%u\n",
 		 dest_name, osmo_sockaddr_ntop(&rtp_end->addr.u.sa, ipbuf),
-		 ntohs(rtp_end->rtp_port), ntohs(rtp_end->rtcp_port));
+		 osmo_sockaddr_port(&rtp_end->addr.u.sa), ntohs(rtp_end->rtcp_port));
 
 	/* Forward a copy of the RTP data to a debug ip/port */
 	forward_data_tap(rtp_end->rtp.fd, &conn_src->tap_out,
 		     msg);
 
-	len = mgcp_udp_send(rtp_end->rtp.fd, &rtp_end->addr, rtp_end->rtp_port,
-			    (char *)hdr, buflen);
+	len = mgcp_udp_send(rtp_end->rtp.fd, &rtp_end->addr, (char *)hdr, buflen);
 
 	if (len <= 0)
 		return len;
@@ -617,9 +616,8 @@
 		force_output_enabled = true;
 		/* Fill in the peer address so that we can send Init-ACK back: */
 		prev_rem_addr = conn_rtp_src->end.addr;
-		prev_rem_rtp_port = conn_rtp_src->end.rtp_port;
+		prev_rem_rtp_port = osmo_sockaddr_port(&conn_rtp_src->end.addr.u.sa);
 		conn_rtp_src->end.addr = *mc->from_addr;
-		conn_rtp_src->end.rtp_port = htons(osmo_sockaddr_port(&mc->from_addr->u.sa));
 	}
 
 	rc = _conn_iuup_rtp_pl_up(conn_rtp_src, msg);
@@ -627,7 +625,7 @@
 	if (force_output_enabled) {
 		conn_rtp_src->end.output_enabled = prev_output_enabled;
 		conn_rtp_src->end.addr = prev_rem_addr;
-		conn_rtp_src->end.rtp_port = prev_rem_rtp_port;
+		osmo_sockaddr_set_port(&conn_rtp_src->end.addr.u.sa, prev_rem_rtp_port);
 	}
 
 	return rc;