Fail on invalid IP addresses passed to IPACC MDCX
IPACC protocol supports only IPv4 addresses, so make sure if an IPv6 address (or whatever malformed address) is caught is not sent without noticing. Prior to this patch, faulty addresses would be sent over the wire as 255.255.255.255 (-1 returned from inet_addr()). Change-Id: Iee84e8b40cdede1cacd8e8a9e26dda0d85383ec8
This commit is contained in:
parent
783960f4d9
commit
75b3cba5fc
|
@ -330,6 +330,7 @@ static void lchan_rtp_fsm_wait_ipacc_mdcx_ack_onenter(struct osmo_fsm_inst *fi,
|
|||
int rc;
|
||||
struct gsm_lchan *lchan = lchan_rtp_fi_lchan(fi);
|
||||
const struct mgcp_conn_peer *mgw_rtp;
|
||||
struct in_addr sin;
|
||||
|
||||
if (lchan->release.requested) {
|
||||
lchan_rtp_fail("Release requested while activating");
|
||||
|
@ -344,8 +345,13 @@ static void lchan_rtp_fsm_wait_ipacc_mdcx_ack_onenter(struct osmo_fsm_inst *fi,
|
|||
return;
|
||||
}
|
||||
|
||||
/* Other RTP settings were already setup in lchan_rtp_fsm_wait_ipacc_crcx_ack_onenter() */
|
||||
lchan->abis_ip.connect_ip = ntohl(inet_addr(mgw_rtp->addr));
|
||||
/* Other RTP settings were already set up in lchan_rtp_fsm_wait_ipacc_crcx_ack_onenter() */
|
||||
if (inet_pton(AF_INET, mgw_rtp->addr, &sin) != 1) {
|
||||
/* Only IPv4 addresses are supported in IPACC */
|
||||
lchan_rtp_fail("Invalid remote IPv4 address %s", mgw_rtp->addr);
|
||||
return;
|
||||
}
|
||||
lchan->abis_ip.connect_ip = ntohl(sin.s_addr);
|
||||
lchan->abis_ip.connect_port = mgw_rtp->port;
|
||||
|
||||
/* send-recv */
|
||||
|
|
Loading…
Reference in New Issue