aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-virtual
diff options
context:
space:
mode:
authorSebastian Stumpf <sebastian.stumpf87@googlemail.com>2017-02-27 15:13:06 +0100
committerSebastian Stumpf <sebastian.stumpf87@googlemail.com>2017-02-27 15:13:06 +0100
commitba69eb9f36e8143c10bd62c81d13917783d72ff6 (patch)
tree7aee1dd08c1479c6315f2095b67a2bcd6670a300 /src/osmo-bts-virtual
parent3c270ce25b6ad5434ca37402fc46308230de4c06 (diff)
VIRT-PHY: Fixed error causing send msgs to be received on same sock.
This could be disabled setting socket option IP_MULTICAST_ALL = 0.
Diffstat (limited to 'src/osmo-bts-virtual')
-rw-r--r--src/osmo-bts-virtual/shared/osmo_mcast_sock.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/osmo-bts-virtual/shared/osmo_mcast_sock.c b/src/osmo-bts-virtual/shared/osmo_mcast_sock.c
index acc6bcb1..ff81063a 100644
--- a/src/osmo-bts-virtual/shared/osmo_mcast_sock.c
+++ b/src/osmo-bts-virtual/shared/osmo_mcast_sock.c
@@ -52,7 +52,7 @@ struct mcast_client_sock *mcast_client_sock_setup(
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 @@ struct mcast_client_sock *mcast_client_sock_setup(
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;