pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/29586 )
Change subject: socket: Introduce API osmo_sockaddr_is_any
......................................................................
socket: Introduce API osmo_sockaddr_is_any
Change-Id: I2810a889fc14052d0e0be6a2b500ad4e5088ffa9
---
M TODO-RELEASE
M include/osmocom/core/socket.h
M src/socket.c
3 files changed, 22 insertions(+), 0 deletions(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 8ccfa49..436d417 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,3 +7,4 @@
# If any interfaces have been added since the last public release: c:r:a + 1.
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
+libosmocore new API osmo_sockaddr_is_any()
\ No newline at end of file
diff --git a/include/osmocom/core/socket.h b/include/osmocom/core/socket.h
index 79de6c5..06db5d0 100644
--- a/include/osmocom/core/socket.h
+++ b/include/osmocom/core/socket.h
@@ -31,6 +31,7 @@
};
int osmo_sockaddr_is_local(struct sockaddr *addr, unsigned int addrlen);
+int osmo_sockaddr_is_any(const struct osmo_sockaddr *addr);
unsigned int osmo_sockaddr_to_str_and_uint(char *addr, unsigned int addr_len, uint16_t *port,
const struct sockaddr *sa);
diff --git a/src/socket.c b/src/socket.c
index 4605db4..3d945e7 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -1175,6 +1175,26 @@
return 0;
}
+/*! Determine if the given address is an ANY address ("0.0.0.0", "::"). Port is not checked.
+ * \param[in] addr Socket Address
+ * \param[in] addrlen Length of socket address in bytes
+ * \returns 1 if address is ANY, 0 otherwise. -1 is address family not supported/detected.
+ */
+int osmo_sockaddr_is_any(const struct osmo_sockaddr *addr)
+{
+ switch (addr->u.sa.sa_family) {
+ case AF_INET6: {
+ struct in6_addr ip6_any = IN6ADDR_ANY_INIT;
+ return memcmp(&addr->u.sin6.sin6_addr,
+ &ip6_any, sizeof(ip6_any)) == 0;
+ }
+ case AF_INET:
+ return addr->u.sin.sin_addr.s_addr == INADDR_ANY;
+ default:
+ return -1;
+ }
+}
+
/*! Convert sockaddr_in to IP address as char string and port as uint16_t.
* \param[out] addr String buffer to write IP address to, or NULL.
* \param[out] addr_len Size of \a addr.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/29586
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I2810a889fc14052d0e0be6a2b500ad4e5088ffa9
Gerrit-Change-Number: 29586
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: neels, fixeria.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/29551 )
Change subject: vty: 'hopping arfcn add': succeed if adding arfcn already in set
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> > This is really an orthogonal discussion and it's up to the user/customer to decide how do they wan […]
We don't end up having duplicated entries. The same info is stored irrespective of how many times you add the arfcn, and show running-config will only show one.
Whether one wants to clear and re-apply all fields in the set is really another topic.
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/29551
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ia4e70d20d48a28c46a21dd10358577e5c798744c
Gerrit-Change-Number: 29551
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 04 Oct 2022 14:33:53 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: pespin.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29587 )
Change subject: Use new libosmocore API osmo_sockaddr_is_any()
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29587
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Ib2ba708bdc834359de8a7cce302e2dc1f8c64954
Gerrit-Change-Number: 29587
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: Tue, 04 Oct 2022 14:31:36 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: osmith.
Hello osmith, Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/29586
to look at the new patch set (#3).
Change subject: socket: Introduce API osmo_sockaddr_is_any
......................................................................
socket: Introduce API osmo_sockaddr_is_any
Change-Id: I2810a889fc14052d0e0be6a2b500ad4e5088ffa9
---
M TODO-RELEASE
M include/osmocom/core/socket.h
M src/socket.c
3 files changed, 22 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/86/29586/3
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/29586
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I2810a889fc14052d0e0be6a2b500ad4e5088ffa9
Gerrit-Change-Number: 29586
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: pespin.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/29585 )
Change subject: socket.h: Reorder sockaddr APIs to have them all together
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/29585
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Iab2ee2854be8027ee5978e06a83248b530a39bf7
Gerrit-Change-Number: 29585
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 04 Oct 2022 14:29:59 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment