slotmap: restructure read_cb()

Change-Id: I7fb457f028f9aabc7b4b53bf036e5eac9d785299
This commit is contained in:
Harald Welte 2019-03-08 16:55:01 +01:00
parent e5c7773c7f
commit 7bfcc65227
1 changed files with 22 additions and 12 deletions

View File

@ -462,21 +462,31 @@ static int sock_read_cb(struct ipa_server_conn *peer, struct msgb *msg)
if (msgb_length(msg) < sizeof(*hh))
goto invalid;
msg->l2h = &hh->data[0];
if (hh->proto != IPAC_PROTO_OSMO)
goto invalid;
switch (hh->proto) {
case IPAC_PROTO_IPACCESS:
rc = ipa_server_conn_ccm(peer, msg);
break;
case IPAC_PROTO_OSMO:
if (!he || msgb_l2len(msg)< sizeof(*he))
goto invalid;
msg->l2h = &he->data[0];
if (he->proto!= IPAC_PROTO_EXT_RSPRO)
goto invalid;
switch (he->proto) {
case IPAC_PROTO_EXT_RSPRO:
pdu = rspro_dec_msg(msg);
if (!pdu)
goto invalid;
rc = handle_rx_rspro(conn, pdu);
ASN_STRUCT_FREE(asn_DEF_RsproPDU, pdu);
break;
default:
goto invalid;
}
break;
default:
goto invalid;
}
return rc;
invalid: