osmo_mcast_sock: make sure SO_REUSEADDR is applied
osmo-bts-virtual uses UDP multicast to communicate with its virtphy 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: I7f27758b7aa786c8dbae669cbcde10baab8e4845 Depends: libosmocore I1399a428467ca12f1564a14eb8ffb294d4f59874 Related: OS#3497
This commit is contained in:
parent
0b2893f6fc
commit
0e11bea2a7
|
@ -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)
|
uint16_t tx_mcast_port, bool loopback)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
unsigned int flags = OSMO_SOCK_F_CONNECT;
|
unsigned int flags = OSMO_SOCK_F_CONNECT | OSMO_SOCK_F_UDP_REUSEADDR;
|
||||||
|
|
||||||
if (!loopback)
|
if (!loopback)
|
||||||
flags |= OSMO_SOCK_F_NO_MCAST_LOOP;
|
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)
|
void *osmo_fd_data)
|
||||||
{
|
{
|
||||||
int rc;
|
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->cb = fd_rx_cb;
|
||||||
ofd->when = BSC_FD_READ;
|
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 */
|
/* Create mcast client socket */
|
||||||
rc = osmo_sock_init_ofd(ofd, AF_INET, SOCK_DGRAM, IPPROTO_UDP,
|
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) {
|
if (rc < 0) {
|
||||||
perror("Could not create mcast client socket");
|
perror("Could not create mcast client socket");
|
||||||
return rc;
|
return rc;
|
||||||
|
|
Loading…
Reference in New Issue