Attention is currently required from: fixeria, msuraev.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/29087 )
Change subject: SIGTRAN: add function to check connection existence
......................................................................
Patch Set 8: Code-Review-1
(2 comments)
Patchset:
PS8:
the added function and the changed VTY behavior have to be two separate patches
File examples/sccp_test_vty.c:
https://gerrit.osmocom.org/c/libosmo-sccp/+/29087/comment/59fb8c4d_6b3379bb
PS8, Line 44: int conn_id = atoi(argv[0]), ret;
please declare 'int ret;' on a separate line.
we usually call it rc. (ret only when it gets returned, rc for functions we are calling)
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/29087
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Iffedf55b4c292ee6b2f97bcdeef6dc13c050ce01
Gerrit-Change-Number: 29087
Gerrit-PatchSet: 8
Gerrit-Owner: msuraev <msuraev(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: msuraev <msuraev(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 17 Aug 2022 01:09:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: laforge, fixeria, msuraev.
Hello Jenkins Builder, laforge, fixeria, msuraev,
I'd like you to do a code review. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/29122
to review the following change.
Change subject: Revert "Add function to guess AF_UNSPEC address"
......................................................................
Revert "Add function to guess AF_UNSPEC address"
This reverts commit a4063efa7deb6632c228037c47effca22ad0f781.
Reason for revert: It is not possible to guess the IP address
family from uninitialized memory. This function simply glorifies
random noise into an IPv6 address. It makes no sense to have it.
Change-Id: Ifadd614604cf9d0c2ed1a405493c1c3fcb37ae23
---
M include/osmocom/core/sockaddr_str.h
M src/sockaddr_str.c
2 files changed, 2 insertions(+), 35 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/22/29122/1
diff --git a/include/osmocom/core/sockaddr_str.h b/include/osmocom/core/sockaddr_str.h
index a46ad59..f474fa0 100644
--- a/include/osmocom/core/sockaddr_str.h
+++ b/include/osmocom/core/sockaddr_str.h
@@ -41,7 +41,6 @@
*/
int osmo_ip_str_type(const char *ip);
-unsigned osmo_sockaddr_guess_unspec(const struct sockaddr *src);
struct osmo_sockaddr_str {
/*! AF_INET for IPv4 address, or AF_INET6 for IPv6 address. */
diff --git a/src/sockaddr_str.c b/src/sockaddr_str.c
index 70927a7..9f1e897 100644
--- a/src/sockaddr_str.c
+++ b/src/sockaddr_str.c
@@ -184,38 +184,6 @@
return AF_UNSPEC;
}
-/*! Guess whether struct sockaddr with AF_UNSPEC family has valid IPv4 or IPv6 address.
- * The IPv6 is tried first to take into account "IPv4 mapped addresses".
- * \param[in] src Generic struct sockaddr pointer.
- * \return AF_INET or AF_INET6, AF_UNSPEC or original sa_family which are unsigned type according to <sys/socket.h>.
- */
-unsigned osmo_sockaddr_guess_unspec(const struct sockaddr *src)
-{
- int rc;
- struct osmo_sockaddr_str sa;
- struct osmo_sockaddr_str *tmp = &sa;
- const struct sockaddr_in6 *src6 = (const struct sockaddr_in6 *)src;
- const struct sockaddr_in *src4 = (const struct sockaddr_in *)src;
-
- if (!src)
- return AF_UNSPEC;
-
- if (src->sa_family != AF_UNSPEC)
- return src->sa_family;
-
- /* IPv6? */
- rc = osmo_sockaddr_str_from_in6_addr(tmp, &src6->sin6_addr, osmo_ntohs(src6->sin6_port));
- if (rc == 0 && osmo_ip_str_type(tmp->ip) == AF_INET6)
- return AF_INET6;
-
- /* IPv4? */
- rc = osmo_sockaddr_str_from_in_addr(tmp, &src4->sin_addr, osmo_ntohs(src4->sin_port));
- if (rc == 0 && osmo_ip_str_type(tmp->ip) == AF_INET)
- return AF_INET;
-
- return AF_UNSPEC;
-}
-
/*! Safely copy the given ip string to sockaddr_str, classify to AF_INET or AF_INET6.
* Data will be written to sockaddr_str even if an error is returned.
* \param[out] sockaddr_str The instance to copy to.
@@ -349,7 +317,7 @@
return -ENOSPC;
if (!src)
return -EINVAL;
- if (src->sin_family != AF_INET && osmo_sockaddr_guess_unspec((const struct sockaddr *)src) != AF_INET)
+ if (src->sin_family != AF_INET)
return -EINVAL;
return osmo_sockaddr_str_from_in_addr(sockaddr_str, &src->sin_addr, osmo_ntohs(src->sin_port));
}
@@ -365,7 +333,7 @@
return -ENOSPC;
if (!src)
return -EINVAL;
- if (src->sin6_family != AF_INET6 && osmo_sockaddr_guess_unspec((const struct sockaddr *)src) != AF_INET6)
+ if (src->sin6_family != AF_INET6)
return -EINVAL;
return osmo_sockaddr_str_from_in6_addr(sockaddr_str, &src->sin6_addr, osmo_ntohs(src->sin6_port));
}
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/29122
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ifadd614604cf9d0c2ed1a405493c1c3fcb37ae23
Gerrit-Change-Number: 29122
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: msuraev <msuraev(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: msuraev.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/28994 )
Change subject: Add function to guess AF_UNSPEC address
......................................................................
Patch Set 5:
(1 comment)
Patchset:
PS5:
I'm sorry that I am late for code review here.
As Pau has explained, this function has a flaw in principles, and it makes no sense to have it.
I would welcome if we could revert this commit before the next release.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/28994
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I1c90c56ce832f53b65e0d18d3cea94621c02a69a
Gerrit-Change-Number: 28994
Gerrit-PatchSet: 5
Gerrit-Owner: msuraev <msuraev(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de>
Gerrit-CC: neels <nhofmeyr(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: msuraev <msuraev(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 17 Aug 2022 00:55:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: pespin, msuraev, dexter.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/28995 )
Change subject: Make osmo_sockaddr_str_from_sockaddr() less picky
......................................................................
Patch Set 8: Code-Review-2
(1 comment)
Patchset:
PS8:
AF_UNSPEC is not valid and should return an error rc. Do not turn uninitialized memory into an IPv6 address representation!
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/28995
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I36f20701663c3c7eae7fedc6551da44800b325bf
Gerrit-Change-Number: 28995
Gerrit-PatchSet: 8
Gerrit-Owner: msuraev <msuraev(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: dexter <pmaier(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: msuraev <msuraev(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 17 Aug 2022 00:52:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: msuraev.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/28993 )
Change subject: Use osmo_sockaddr_strs_to_str() for multiaddr helper
......................................................................
Patch Set 8: Code-Review-1
(3 comments)
Patchset:
PS8:
the code added in https://gerrit.osmocom.org/c/libosmocore/+/28992 should move to this function, as indicated below
File src/socket.c:
https://gerrit.osmocom.org/c/libosmocore/+/28993/comment/dda0b532_5a697daa
PS8, Line 208: * buf_len >= 2: (hostA|hostB|...|...)
(this doc is wrong)
https://gerrit.osmocom.org/c/libosmocore/+/28993/comment/16eeb34d_42c05fa7
PS8, Line 211: {
if you use an implementation like this here, we don't need to add osmo_sockaddr_strs_to_str() at all and save a lot of dynamic allocations:
struct osmo_strbuf sb = { ... };
if (i != 1)
OSMO_STRBUF_PRINTF(sb, "(");
for (...) {
struct osmo_sockaddr_str ss;
if (i)
OSMO_STRBUF_PRINTF(sb, "|");
osmo_sockaddr_str_from_str2(&ss, hosts[i]);
OSMO_STRBUF_PRINTF(sb, OSMO_SOCKADDR_STR_FMT, OSMO_SOCKADDR_STR_FMT_ARGS(&ss));
}
if (i != 1)
OSMO_STRBUF_PRINTF(sb, ")");
return sb.chars_needed;
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/28993
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Icef53fe4b6e51563d97a1bc48001d67679b3b6e9
Gerrit-Change-Number: 28993
Gerrit-PatchSet: 8
Gerrit-Owner: msuraev <msuraev(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: msuraev <msuraev(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 17 Aug 2022 00:48:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment