osmo_ss7: Fix segfault when routing MTP-TRANSFER.req to ASP without sctp connection

Change-Id: I142a11b09672864b54b927b8334b1975c8cd6022
This commit is contained in:
Harald Welte 2017-04-07 19:21:35 +02:00
parent 07903bb2ad
commit 9aee15c23d
1 changed files with 13 additions and 2 deletions

View File

@ -1376,10 +1376,21 @@ int osmo_ss7_asp_send(struct osmo_ss7_asp *asp, struct msgb *msg)
OSMO_ASSERT(0);
}
if (asp->cfg.is_server)
if (asp->cfg.is_server) {
if (!asp->server) {
LOGPASP(asp, DLSS7, LOGL_ERROR, "Cannot transmit, no asp->server\n");
/* FIXME: what to do here? delete the route? send DUNA? */
return -EIO;
}
osmo_stream_srv_send(asp->server, msg);
else
} else {
if (!asp->client) {
LOGPASP(asp, DLSS7, LOGL_ERROR, "Cannot transmit, no asp->client\n");
/* FIXME: what to do here? delete the route? send DUNA? */
return -EIO;
}
osmo_stream_cli_send(asp->client, msg);
}
return 0;
}