aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-11-09 01:45:53 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-11-09 01:46:35 +0100
commit36a183fd7875e1d632669089ecdbd3b261ca915e (patch)
tree4930cc08e09fd782a92d6b959fbccbe39e98c329
parent9294c40f14b41bbaf21253123ebc1e0e90f93250 (diff)
client: Tolerate an invalid pcap_handle
When not running as root the opening might fail and then we would crash when sending the link information. Do not crash. This could have crashed before the re-factoring but due the async connect it seems more likely we hit it now. Change-Id: I26a10c401a9a8998acc50a4bd4432d2ac7fceaeb
-rw-r--r--src/osmo_client_network.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/osmo_client_network.c b/src/osmo_client_network.c
index 4ecb1ca..2667809 100644
--- a/src/osmo_client_network.c
+++ b/src/osmo_client_network.c
@@ -193,6 +193,12 @@ void osmo_client_send_link(struct osmo_pcap_client_conn *conn)
struct osmo_pcap_data *om_hdr;
struct msgb *msg;
+ if (!conn->client->handle) {
+ LOGP(DCLIENT, LOGL_ERROR,
+ "No pcap_handle not sending link info to conn=%s\n", conn->name);
+ return;
+ }
+
msg = msgb_alloc(9000 + sizeof(*om_hdr) + sizeof(*hdr), "link-data");
if (!msg) {
LOGP(DCLIENT, LOGL_ERROR, "Failed to allocate data.\n");