pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29638 ) Change subject: osmux: Use setsockopt(IPV6_V6ONLY) on IPv6 socket ...................................................................... osmux: Use setsockopt(IPV6_V6ONLY) on IPv6 socket We for sure don't want to mix stuff and send IPv4 stuff over IPv6, so let's make sure we block that possibility. This helps in avoiding configuration problems where same port allocated by an IPv6 address cannot be used by an IPv4 one. Change-Id: I0b120d016ff32369a8c077b601ec168928c38f0b --- M src/libosmo-mgcp/mgcp_osmux.c 1 file changed, 8 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/38/29638/1 diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c index 3be6d78..889ca76 100644 --- a/src/libosmo-mgcp/mgcp_osmux.c +++ b/src/libosmo-mgcp/mgcp_osmux.c @@ -470,6 +470,7 @@ osmo_sock_get_name2(osmux_fd_v4.fd)); } if (cfg->osmux_addr_v6) { + int one = 1; ret = mgcp_create_bind(cfg->osmux_addr_v6, &osmux_fd_v6, cfg->osmux_port, cfg->endp_dscp, cfg->endp_priority); if (ret < 0) { @@ -478,6 +479,13 @@ return ret; } + ret = setsockopt(osmux_fd_v6.fd, SOL_IPV6, IPV6_V6ONLY, &one, sizeof(one)); + if (ret < 0) { + LOGP(DOSMUX, LOGL_ERROR, "setsockopt(IPV6_V6ONLY, 1) failed on socket %s:%u\n", + cfg->osmux_addr_v6, cfg->osmux_port); + return ret; + } + ret = osmo_fd_register(&osmux_fd_v6); if (ret < 0) { LOGP(DOSMUX, LOGL_ERROR, "Cannot register OSMUX IPv6 socket %s\n", -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29638 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I0b120d016ff32369a8c077b601ec168928c38f0b Gerrit-Change-Number: 29638 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin@sysmocom.de> Gerrit-MessageType: newchange