[PATCH] osmocom-bb[master]: VIRT-PHY: Fixed error causing send msgs to be received on sa...

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
Wed Jul 12 21:20:47 UTC 2017


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

VIRT-PHY: Fixed error causing send msgs to be received on same sock.

This could be disabled setting socket option IP_MULTICAST_ALL = 0.

Change-Id: Ia2838c4cd39bfac04c014b4c8512466b301d8875
---
M src/host/virt_phy/src/shared/osmo_mcast_sock.c
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/07/3207/1

diff --git a/src/host/virt_phy/src/shared/osmo_mcast_sock.c b/src/host/virt_phy/src/shared/osmo_mcast_sock.c
index acc6bcb..ff81063 100644
--- a/src/host/virt_phy/src/shared/osmo_mcast_sock.c
+++ b/src/host/virt_phy/src/shared/osmo_mcast_sock.c
@@ -52,7 +52,7 @@
 	                struct mcast_client_sock);
 	struct sockaddr_in *rx_sock_conf = talloc_zero(NULL,
 	                struct sockaddr_in);
-	int rc, reuseaddr = 1, loopback = 1;
+	int rc, reuseaddr = 1, loopback = 1, all = 0;
 
 	client_sock->osmo_fd = talloc_zero(ctx, struct osmo_fd);
 	client_sock->mcast_group = talloc_zero(ctx, struct ip_mreq);
@@ -107,6 +107,14 @@
 		return NULL;
 	}
 
+	// this option will set the delivery option so that only packages are received
+	// from sockets we are bound to via IP_ADD_MEMBERSHIP
+	if (setsockopt(client_sock->osmo_fd->fd, IPPROTO_IP,
+	IP_MULTICAST_ALL, &all, sizeof(all)) < 0) {
+		perror("Failed to modify delivery policy to explicitly joined.\n");
+		return NULL;
+	}
+
 	// configure and register the osmocom filedescriptor
 	client_sock->osmo_fd->cb = fd_rx_cb;
 	client_sock->osmo_fd->when = BSC_FD_READ;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2838c4cd39bfac04c014b4c8512466b301d8875
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: BastusIII <sebastian.stumpf87 at googlemail.com>



More information about the gerrit-log mailing list