osmo-bts-virtual: Fix "virtual-um net-device NETDEV"
The VTY option to bind the virtual Um multicast to a specific network interface has existed ever since osmo-bts-virtual was first merged to the repo. However, embarrassingly, until today it never did anything, i.e. the code to actually perform the bind was missing. Depends: libosmocore.git Ib52d22710020b56965aefcef09bde8247ace4a9c Change-Id: I303f2e616d2d32b5a8005c3dcf0f5fad19ad3445 Related: OS#2966
This commit is contained in:
parent
5914d76d5c
commit
e36fbca15f
|
@ -204,7 +204,7 @@ int bts_model_phy_link_open(struct phy_link *plink)
|
|||
|
||||
plink->u.virt.virt_um = virt_um_init(plink, plink->u.virt.ms_mcast_group, plink->u.virt.ms_mcast_port,
|
||||
plink->u.virt.bts_mcast_group, plink->u.virt.bts_mcast_port,
|
||||
plink->u.virt.ttl, virt_um_rcv_cb);
|
||||
plink->u.virt.ttl, plink->u.virt.mcast_dev, virt_um_rcv_cb);
|
||||
if (!plink->u.virt.virt_um) {
|
||||
phy_link_state_set(plink, PHY_LINK_SHUTDOWN);
|
||||
return -1;
|
||||
|
|
|
@ -62,7 +62,7 @@ static int virt_um_fd_cb(struct osmo_fd *ofd, unsigned int what)
|
|||
}
|
||||
|
||||
struct virt_um_inst *virt_um_init(void *ctx, char *tx_mcast_group, uint16_t tx_mcast_port,
|
||||
char *rx_mcast_group, uint16_t rx_mcast_port, int ttl,
|
||||
char *rx_mcast_group, uint16_t rx_mcast_port, int ttl, const char *dev_name,
|
||||
void (*recv_cb)(struct virt_um_inst *vui, struct msgb *msg))
|
||||
{
|
||||
struct virt_um_inst *vui = talloc_zero(ctx, struct virt_um_inst);
|
||||
|
@ -82,14 +82,29 @@ struct virt_um_inst *virt_um_init(void *ctx, char *tx_mcast_group, uint16_t tx_m
|
|||
rc = osmo_sock_mcast_ttl_set(vui->mcast_sock->tx_ofd.fd, ttl);
|
||||
if (rc < 0) {
|
||||
perror("Cannot set TTL of Virtual Um transmit socket");
|
||||
mcast_bidir_sock_close(vui->mcast_sock);
|
||||
talloc_free(vui);
|
||||
return NULL;
|
||||
goto out_close;
|
||||
}
|
||||
}
|
||||
|
||||
if (dev_name) {
|
||||
rc = osmo_sock_mcast_iface_set(vui->mcast_sock->tx_ofd.fd, dev_name);
|
||||
if (rc < 0) {
|
||||
perror("Cannot bind multicast tx to given device");
|
||||
goto out_close;
|
||||
}
|
||||
rc = osmo_sock_mcast_iface_set(vui->mcast_sock->rx_ofd.fd, dev_name);
|
||||
if (rc < 0) {
|
||||
perror("Cannot bind multicast rx to given device");
|
||||
goto out_close;
|
||||
}
|
||||
}
|
||||
|
||||
return vui;
|
||||
|
||||
out_close:
|
||||
mcast_bidir_sock_close(vui->mcast_sock);
|
||||
talloc_free(vui);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void virt_um_destroy(struct virt_um_inst *vui)
|
||||
|
|
|
@ -23,7 +23,7 @@ struct virt_um_inst {
|
|||
|
||||
struct virt_um_inst *virt_um_init(
|
||||
void *ctx, char *tx_mcast_group, uint16_t tx_mcast_port,
|
||||
char *rx_mcast_group, uint16_t rx_mcast_port, int ttl,
|
||||
char *rx_mcast_group, uint16_t rx_mcast_port, int ttl, const char *dev_name,
|
||||
void (*recv_cb)(struct virt_um_inst *vui, struct msgb *msg));
|
||||
|
||||
void virt_um_destroy(struct virt_um_inst *vui);
|
||||
|
|
Loading…
Reference in New Issue