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
This commit is contained in:
parent
c7c0a22b9a
commit
072f04fea4
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue