This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. Change subject: VIRT-PHY: cause BTS to terminate in case of recv()/send() on udp socket returns 0 ...................................................................... VIRT-PHY: cause BTS to terminate in case of recv()/send() on udp socket returns 0 It is important that we reliably terminate the BTS in case any of the VirtPHY multicast sockets dies for whatever reason. Change-Id: I5ae3fdd7cc35fdf235550a3b8362020fdd287c13 --- M src/osmo-bts-virtual/l1_if.c M src/osmo-bts-virtual/scheduler_virtbts.c M src/osmo-bts-virtual/virtual_um.c 3 files changed, 19 insertions(+), 5 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/osmo-bts-virtual/l1_if.c b/src/osmo-bts-virtual/l1_if.c index 36b2748..9212121 100644 --- a/src/osmo-bts-virtual/l1_if.c +++ b/src/osmo-bts-virtual/l1_if.c @@ -66,6 +66,13 @@ static void virt_um_rcv_cb(struct virt_um_inst *vui, struct msgb *msg) { struct phy_link *plink = (struct phy_link *)vui->priv; + struct phy_instance *pinst; + if (!msg) { + pinst = phy_instance_by_num(plink, 0); + bts_shutdown(pinst->trx->bts, "VirtPHY read socket died\n"); + return; + } + struct gsmtap_hdr *gh = msgb_l1(msg); uint32_t fn = ntohl(gh->frame_number); /* frame number of the rcv msg */ uint16_t arfcn = ntohs(gh->arfcn); /* arfcn of the cell we currently camp on */ @@ -77,7 +84,6 @@ uint8_t rsl_chantype; /* rsl chan type (8.58, 9.3.1) */ uint8_t link_id; /* rsl link id tells if this is an ssociated or dedicated link */ uint8_t chan_nr; /* encoded rsl channel type, timeslot and mf subslot */ - struct phy_instance *pinst; struct osmo_phsap_prim l1sap; memset(&l1sap, 0, sizeof(l1sap)); diff --git a/src/osmo-bts-virtual/scheduler_virtbts.c b/src/osmo-bts-virtual/scheduler_virtbts.c index 9b52864..1338ce5 100644 --- a/src/osmo-bts-virtual/scheduler_virtbts.c +++ b/src/osmo-bts-virtual/scheduler_virtbts.c @@ -36,6 +36,7 @@ #include <osmo-bts/phy_link.h> #include <osmo-bts/logging.h> #include <osmo-bts/rsl.h> +#include <osmo-bts/bts.h> #include <osmo-bts/l1sap.h> #include <osmo-bts/amr.h> #include <osmo-bts/scheduler.h> @@ -93,9 +94,13 @@ if (outmsg) { struct phy_instance *pinst = trx_phy_instance(l1t->trx); struct gsmtap_hdr *gh = (struct gsmtap_hdr *)msgb_data(outmsg); + int rc; - if (virt_um_write_msg(pinst->phy_link->u.virt.virt_um, outmsg) == -1) + rc = virt_um_write_msg(pinst->phy_link->u.virt.virt_um, outmsg); + if (rc < 0) LOGP(DL1P, LOGL_ERROR, "%s GSMTAP msg could not send to virtual Um\n", gsmtap_hdr_stringify(gh)); + else if (rc == 0) + bts_shutdown(l1t->trx->bts, "VirtPHY write socket died\n"); else DEBUGP(DL1C, "%s Sending GSMTAP message to virtual Um\n", gsmtap_hdr_stringify(gh)); } else diff --git a/src/osmo-bts-virtual/virtual_um.c b/src/osmo-bts-virtual/virtual_um.c index e6b9615..e8d4252 100644 --- a/src/osmo-bts-virtual/virtual_um.c +++ b/src/osmo-bts-virtual/virtual_um.c @@ -48,11 +48,12 @@ msg->l1h = msgb_data(msg); /* call the l1 callback function for a received msg */ vui->recv_cb(vui, msg); - } else { - /* FIXME: this kind of error handling might be a bit harsh */ + } else if (rc == 0) { vui->recv_cb(vui, NULL); osmo_fd_close(ofd); - } + } else + perror("Read from multicast socket"); + } return 0; @@ -86,6 +87,8 @@ rc = mcast_bidir_sock_tx(vui->mcast_sock, msgb_data(msg), msgb_length(msg)); + if (rc < 0) + perror("Writing to multicast socket"); msgb_free(msg); return rc; -- To view, visit https://gerrit.osmocom.org/3248 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5ae3fdd7cc35fdf235550a3b8362020fdd287c13 Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder