pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29621 )
Change subject: Clean up local var pointers in mgcp_get_local_addr()
......................................................................
Clean up local var pointers in mgcp_get_local_addr()
Change-Id: I12f1d38b70f97426318e948cd80f9efc2592d54b
---
M src/libosmo-mgcp/mgcp_network.c
1 file changed, 15 insertions(+), 16 deletions(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index 41e6ffc..781bb44 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -89,13 +89,12 @@
* IP-Addresses are used as fallback. */
int mgcp_get_local_addr(char *addr, struct mgcp_conn_rtp *conn)
{
-
- struct mgcp_endpoint *endp;
+ const struct mgcp_endpoint *endp = conn->conn->endp;
+ const struct mgcp_config *cfg = endp->trunk->cfg;
char ipbuf[INET6_ADDRSTRLEN];
int rc;
- endp = conn->conn->endp;
bool rem_addr_set = osmo_sockaddr_is_any(&conn->end.addr) == 0;
- char *bind_addr;
+ const char *bind_addr;
/* Osmux: No smart IP addresses allocation is supported yet. Simply
* return the one set in VTY config: */
@@ -103,19 +102,19 @@
if (rem_addr_set) {
/* Match IP version with what was requested from remote: */
bind_addr = conn->end.addr.u.sa.sa_family == AF_INET6 ?
- conn->conn->endp->trunk->cfg->osmux_addr_v6 :
- conn->conn->endp->trunk->cfg->osmux_addr_v4;
+ cfg->osmux_addr_v6 :
+ cfg->osmux_addr_v4;
} else {
/* Choose any of the bind addresses, preferring v6 over v4 if available: */
- bind_addr = conn->conn->endp->trunk->cfg->osmux_addr_v6;
+ bind_addr = cfg->osmux_addr_v6;
if (!bind_addr)
- bind_addr = conn->conn->endp->trunk->cfg->osmux_addr_v4;
+ bind_addr = cfg->osmux_addr_v4;
}
if (!bind_addr) {
LOGPCONN(conn->conn, DOSMUX, LOGL_ERROR,
"Unable to locate local Osmux address, check your configuration! v4=%u v6=%u remote_known=%s\n",
- !!conn->conn->endp->trunk->cfg->osmux_addr_v4,
- !!conn->conn->endp->trunk->cfg->osmux_addr_v6,
+ !!cfg->osmux_addr_v4,
+ !!cfg->osmux_addr_v6,
rem_addr_set ? osmo_sockaddr_ntop(&conn->end.addr.u.sa, ipbuf) : "no");
return -1;
}
@@ -127,7 +126,7 @@
}
/* Try probing the local IP-Address */
- if (endp->trunk->cfg->net_ports.bind_addr_probe && rem_addr_set) {
+ if (cfg->net_ports.bind_addr_probe && rem_addr_set) {
rc = osmo_sock_local_ip(addr, osmo_sockaddr_ntop(&conn->end.addr.u.sa, ipbuf));
if (rc < 0)
LOGPCONN(conn->conn, DRTP, LOGL_ERROR,
@@ -145,13 +144,13 @@
/* Check there is a bind IP for the RTP traffic configured,
* if so, use that IP-Address */
bind_addr = conn->end.addr.u.sa.sa_family == AF_INET6 ?
- endp->trunk->cfg->net_ports.bind_addr_v6 :
- endp->trunk->cfg->net_ports.bind_addr_v4;
+ cfg->net_ports.bind_addr_v6 :
+ cfg->net_ports.bind_addr_v4;
} else {
/* Choose any of the bind addresses, preferring v6 over v4 */
- bind_addr = endp->trunk->cfg->net_ports.bind_addr_v6;
+ bind_addr = cfg->net_ports.bind_addr_v6;
if (!strlen(bind_addr))
- bind_addr = endp->trunk->cfg->net_ports.bind_addr_v4;
+ bind_addr = cfg->net_ports.bind_addr_v4;
}
if (strlen(bind_addr)) {
LOGPCONN(conn->conn, DRTP, LOGL_DEBUG,
@@ -161,7 +160,7 @@
/* No specific bind IP is configured for the RTP traffic, so
* assume the IP where we listen for incoming MGCP messages
* as bind IP */
- bind_addr = endp->trunk->cfg->source_addr;
+ bind_addr = cfg->source_addr;
LOGPCONN(conn->conn, DRTP, LOGL_DEBUG,
"using mgcp bind ip as local rtp bind ip: %s\n", bind_addr);
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29621
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I12f1d38b70f97426318e948cd80f9efc2592d54b
Gerrit-Change-Number: 29621
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29621 )
Change subject: Clean up local var pointers in mgcp_get_local_addr()
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29621
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I12f1d38b70f97426318e948cd80f9efc2592d54b
Gerrit-Change-Number: 29621
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 05 Oct 2022 08:45:34 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: pespin.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29621 )
Change subject: Clean up local var pointers in mgcp_get_local_addr()
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29621
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I12f1d38b70f97426318e948cd80f9efc2592d54b
Gerrit-Change-Number: 29621
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 05 Oct 2022 08:41:13 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: fixeria.
Hello Jenkins Builder, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-mgw/+/29614
to look at the new patch set (#3).
Change subject: Add Osmux IPv6 support
......................................................................
Add Osmux IPv6 support
A new osmux bind-ip-v6 VTY command is added, similar to what's already
available for RTP. This way the user can decide whether to support IPv4,
IPv6 or both types of IP versions.
Both IP sockets are by default disabled, and must be explicitly enabled
by setting the bind-ip in the VTY configuration.
Change-Id: I446cd7da217e9f4a74995d7784ae55dcc60a29b7
---
M include/osmocom/mgcp/mgcp.h
M include/osmocom/mgcp/mgcp_network.h
M src/libosmo-mgcp/mgcp_network.c
M src/libosmo-mgcp/mgcp_osmux.c
M src/libosmo-mgcp/mgcp_protocol.c
M src/libosmo-mgcp/mgcp_vty.c
6 files changed, 99 insertions(+), 42 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/14/29614/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29614
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I446cd7da217e9f4a74995d7784ae55dcc60a29b7
Gerrit-Change-Number: 29614
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: fixeria.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29614 )
Change subject: Add Osmux IPv6 support
......................................................................
Patch Set 2:
(1 comment)
File src/libosmo-mgcp/mgcp_network.c:
https://gerrit.osmocom.org/c/osmo-mgw/+/29614/comment/4e955986_11f79b35
PS2, Line 102: if (mgcp_conn_rtp_is_osmux(conn)) {
> Having a scoped const pointer: […]
I'll submit that as a followup patch.
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29614
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I446cd7da217e9f4a74995d7784ae55dcc60a29b7
Gerrit-Change-Number: 29614
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 05 Oct 2022 08:32:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: comment