[PATCH] libosmocore[master]: socket: export osmo_sockaddr_equal() as library function

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Sun Oct 23 20:30:43 UTC 2016


Review at  https://gerrit.osmocom.org/1148

socket: export osmo_sockaddr_equal() as library function

Change-Id: I174fe1b894e5da0fefed81f95546c24776233421
---
M include/osmocom/core/socket.h
M src/socket.c
2 files changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/48/1148/1

diff --git a/include/osmocom/core/socket.h b/include/osmocom/core/socket.h
index 6ef0912..43d21c5 100644
--- a/include/osmocom/core/socket.h
+++ b/include/osmocom/core/socket.h
@@ -38,4 +38,7 @@
 int osmo_sock_unix_init_ofd(struct osmo_fd *ofd, uint16_t type, uint8_t proto,
 			    const char *socket_path, unsigned int flags);
 
+int osmo_sockaddr_equal(const struct sockaddr *a,
+			  const struct sockaddr *b, unsigned int len);
+
 /*! @} */
diff --git a/src/socket.c b/src/socket.c
index 19c513a..9efc62e 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -252,7 +252,7 @@
 	return osmo_sock_init(ss->sa_family, type, proto, host, port, flags);
 }
 
-static int sockaddr_equal(const struct sockaddr *a,
+int osmo_sockaddr_equal(const struct sockaddr *a,
 			  const struct sockaddr *b, unsigned int len)
 {
 	struct sockaddr_in *sin_a, *sin_b;
@@ -297,7 +297,7 @@
 	for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
 		if (!ifa->ifa_addr)
 			continue;
-		if (sockaddr_equal(ifa->ifa_addr, addr, addrlen))
+		if (osmo_sockaddr_equal(ifa->ifa_addr, addr, addrlen))
 			return 1;
 	}
 

-- 
To view, visit https://gerrit.osmocom.org/1148
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I174fe1b894e5da0fefed81f95546c24776233421
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>



More information about the gerrit-log mailing list