diff options
Diffstat (limited to 'src/channel')
-rw-r--r-- | src/channel/abis/ipa_stream_client.c | 10 | ||||
-rw-r--r-- | src/channel/abis/ipa_stream_server.c | 9 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/channel/abis/ipa_stream_client.c b/src/channel/abis/ipa_stream_client.c index e6565c4..5745e2a 100644 --- a/src/channel/abis/ipa_stream_client.c +++ b/src/channel/abis/ipa_stream_client.c @@ -288,7 +288,6 @@ static int read_cb(struct osmo_stream_cli *conn, int type) { int ret; struct msgb *msg; - struct osmo_fd *ofd = osmo_stream_cli_get_ofd(conn); struct osmo_chan *chan = osmo_stream_cli_get_data(conn); struct chan_abis_ipa_cli *s; struct ipa_head *hh; @@ -300,8 +299,7 @@ static int read_cb(struct osmo_stream_cli *conn, int type) LOGP(DLINP, LOGL_ERROR, "cannot allocate message\n"); return 0; } - /* XXX replace with generic stream reader */ - ret = osmo_ipa_msg_recv(ofd->fd, msg); + ret = osmo_stream_cli_recv(conn, msg); if (ret < 0) { LOGP(DLINP, LOGL_ERROR, "cannot receive message\n"); msgb_free(msg); @@ -314,6 +312,12 @@ static int read_cb(struct osmo_stream_cli *conn, int type) return 0; } + if (osmo_ipa_process_msg(msg) < 0) { + LOGP(DLINP, LOGL_ERROR, "Bad IPA message\n"); + msgb_free(msg); + return -EIO; + } + hh = (struct ipa_head *) msg->data; if (hh->proto == IPAC_PROTO_IPACCESS) { abis_ipa_cli_rcvmsg(chan, conn, msg, type); diff --git a/src/channel/abis/ipa_stream_server.c b/src/channel/abis/ipa_stream_server.c index a47b0f6..21a82f8 100644 --- a/src/channel/abis/ipa_stream_server.c +++ b/src/channel/abis/ipa_stream_server.c @@ -341,7 +341,6 @@ static int read_cb(struct osmo_stream_srv *conn, int type) { int ret; struct msgb *msg; - struct osmo_fd *ofd = osmo_stream_srv_get_ofd(conn); struct osmo_ipa_unit *unit = osmo_stream_srv_get_data(conn); struct chan_abis_ipa_srv_conn *inst; struct ipa_head *hh; @@ -353,7 +352,7 @@ static int read_cb(struct osmo_stream_srv *conn, int type) LOGP(DLINP, LOGL_ERROR, "cannot allocate message\n"); return 0; } - ret = osmo_ipa_msg_recv(ofd->fd, msg); + ret = osmo_stream_srv_recv(conn, msg); if (ret < 0) { LOGP(DLINP, LOGL_ERROR, "cannot receive message\n"); msgb_free(msg); @@ -369,7 +368,11 @@ static int read_cb(struct osmo_stream_srv *conn, int type) return 0; } - /* XXX: missing IPA message validation */ + ret = osmo_ipa_process_msg(msg); + if (ret < 0) { + LOGP(DLINP, LOGL_ERROR, "invalid IPA message\n"); + msgb_free(msg); + } hh = (struct ipa_head *) msg->data; if (hh->proto == IPAC_PROTO_IPACCESS) { |