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/.
Harald Welte gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/3241
socket: Add new OSMO_SOCK_F_NO_MCAST_ALL option
Using this option at socket creation, the caller can request disabling
the IP_MULTICAST_ALL socket option.
Change-Id: I5ab5de45c0b64ceb3636ea98245a23defa24ffd4
---
M include/osmocom/core/socket.h
M src/socket.c
2 files changed, 10 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/41/3241/1
diff --git a/include/osmocom/core/socket.h b/include/osmocom/core/socket.h
index 695e1d7..ebfcab3 100644
--- a/include/osmocom/core/socket.h
+++ b/include/osmocom/core/socket.h
@@ -22,6 +22,8 @@
#define OSMO_SOCK_F_NONBLOCK (1 << 2)
/*! disable multiast loop (IP_MULTICAST_LOOP) */
#define OSMO_SOCK_F_NO_MCAST_LOOP (1 << 3)
+/*! disable receiving all multiast even for non-subscribed groups */
+#define OSMO_SOCK_F_NO_MCAST_ALL (1 << 4)
int osmo_sock_init(uint16_t family, uint16_t type, uint8_t proto,
const char *host, uint16_t port, unsigned int flags);
diff --git a/src/socket.c b/src/socket.c
index 0b8c22d..871873b 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -132,6 +132,14 @@
}
}
+ if (flags & OSMO_SOCK_F_NO_MCAST_ALL) {
+ rc = osmo_sock_mcast_all_set(fd, false);
+ if (rc < 0) {
+ LOGP(DLGLOBAL, LOGL_ERROR, "unable to disable receive of all multicast: %s\n",
+ strerror(errno));
+ return rc;
+ }
+ }
return 0;
}
--
To view, visit https://gerrit.osmocom.org/3241
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ab5de45c0b64ceb3636ea98245a23defa24ffd4
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>