From 072f04fea4bc49fb3dfef1629861aa1ba91f68ec Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Thu, 23 Aug 2018 20:30:39 +0200 Subject: osmo_mcast_sock: make sure SO_REUSEADDR is applied virtphy uses UDP multicast to communicate with its osmo-bts-virtual counterpart. At the momemnt SO_REUSEADDR is not applied for those multicast connections because OSMO_SOCK_F_UDP_REUSEADDR is not set. This makes prevents the proper function of UDP multicast. - Make sure OSMO_SOCK_F_UDP_REUSEADDR is set Change-Id: Ia1014ac5e0522e77178249cdc6398dec2168bffe Depends: libosmocore I1399a428467ca12f1564a14eb8ffb294d4f59874 Related: OS#3497 --- src/host/virt_phy/src/shared/osmo_mcast_sock.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/host/virt_phy/src/shared/osmo_mcast_sock.c') 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 b52e0057..9a713fcf 100644 --- a/src/host/virt_phy/src/shared/osmo_mcast_sock.c +++ b/src/host/virt_phy/src/shared/osmo_mcast_sock.c @@ -17,7 +17,7 @@ int mcast_server_sock_setup(struct osmo_fd *ofd, const char* tx_mcast_group, uint16_t tx_mcast_port, bool loopback) { int rc; - unsigned int flags = OSMO_SOCK_F_CONNECT; + unsigned int flags = OSMO_SOCK_F_CONNECT | OSMO_SOCK_F_UDP_REUSEADDR; if (!loopback) flags |= OSMO_SOCK_F_NO_MCAST_LOOP; @@ -41,6 +41,7 @@ int mcast_client_sock_setup(struct osmo_fd *ofd, const char *mcast_group, uint16 void *osmo_fd_data) { int rc; + unsigned int flags = OSMO_SOCK_F_BIND | OSMO_SOCK_F_NO_MCAST_ALL | OSMO_SOCK_F_UDP_REUSEADDR; ofd->cb = fd_rx_cb; ofd->when = BSC_FD_READ; @@ -48,7 +49,7 @@ int mcast_client_sock_setup(struct osmo_fd *ofd, const char *mcast_group, uint16 /* Create mcast client socket */ rc = osmo_sock_init_ofd(ofd, AF_INET, SOCK_DGRAM, IPPROTO_UDP, - NULL, mcast_port, OSMO_SOCK_F_BIND|OSMO_SOCK_F_NO_MCAST_ALL); + NULL, mcast_port, flags); if (rc < 0) { perror("Could not create mcast client socket"); return rc; -- cgit v1.2.3