aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-08-31 20:09:26 +0200
committerlaforge <laforge@osmocom.org>2020-09-07 12:53:54 +0000
commit16ca3faf849620cccea813d868eea5379faa5903 (patch)
tree1d9ecff64f42d445beaf4099e21f207a4b3a3c3d
parentcc6d35d788d0164b3cff1c7536ee9121d95aa8b8 (diff)
Fix creating MGCP proxy socket if MGW listens on an IPv6 address
If for instance "mgw remote-ip ::1" is configured, the MGCP IPA proxy socket towards the MGW will use ::1 as the destination address, but it was being created as AF_INET. Let's use AF_UNSPEC instead and let osmo_sock_init2 decide the best socket type to create. Moreover, change the default local address from "0.0.0.0" to NULL to also let osmo_sock_init2 pick an IPv6 address if necessary. Change-Id: Ide88c7358a38702ef11c84145518794e75870ef8
-rw-r--r--src/osmo-bsc/osmo_bsc_msc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/osmo-bsc/osmo_bsc_msc.c b/src/osmo-bsc/osmo_bsc_msc.c
index b1bb24530..26d2bc8d2 100644
--- a/src/osmo-bsc/osmo_bsc_msc.c
+++ b/src/osmo-bsc/osmo_bsc_msc.c
@@ -164,7 +164,7 @@ int osmo_bsc_msc_init(struct bsc_msc_data *msc)
else
mgw_port = MGCP_CLIENT_REMOTE_PORT_DEFAULT;
- rc = osmo_sock_init2_ofd(&msc->mgcp_ipa.ofd, AF_INET, SOCK_DGRAM, IPPROTO_UDP,
+ rc = osmo_sock_init2_ofd(&msc->mgcp_ipa.ofd, AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP,
msc->mgcp_ipa.local_addr, msc->mgcp_ipa.local_port,
net->mgw.conf->remote_addr, mgw_port,
OSMO_SOCK_F_BIND | OSMO_SOCK_F_CONNECT);
@@ -256,7 +256,7 @@ struct bsc_msc_data *osmo_msc_data_alloc(struct gsm_network *net, int nr)
msc_data->audio_support[4]->hr = 1;
osmo_fd_setup(&msc_data->mgcp_ipa.ofd, -1, OSMO_FD_READ, &bsc_sccplite_mgcp_proxy_cb, msc_data, 0);
- msc_data->mgcp_ipa.local_addr = talloc_strdup(msc_data, "0.0.0.0");
+ msc_data->mgcp_ipa.local_addr = NULL; /* = INADDR(6)_ANY */
msc_data->mgcp_ipa.local_port = 0; /* dynamic */
msc_data->nri_ranges = osmo_nri_ranges_alloc(msc_data);