slotmap: restructure read_cb()

Change-Id: I7fb457f028f9aabc7b4b53bf036e5eac9d785299
changes/97/13497/1
Harald Welte 4 years ago
parent e5c7773c7f
commit 7bfcc65227
  1. 38
      src/server/rspro_server.c

@ -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;
if (!he || msgb_l2len(msg)< sizeof(*he))
goto invalid;
msg->l2h = &he->data[0];
if (he->proto!= IPAC_PROTO_EXT_RSPRO)
goto invalid;
pdu = rspro_dec_msg(msg);
if (!pdu)
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];
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;
rc = handle_rx_rspro(conn, pdu);
ASN_STRUCT_FREE(asn_DEF_RsproPDU, pdu);
}
return rc;
invalid:

Loading…
Cancel
Save