Browse Source

iuup: Fix IPTIs_present not set to 0 if no IPTIs received

Related: SYS#5969
Change-Id: I503dc509ad8619f13cd83ae03261a2297e2b9fc7
changes/98/28198/1
Pau Espin 3 months ago
parent
commit
6d6d22ea34
  1. 1
      src/gsm/iuup.c
  2. 113
      tests/iuup/iuup_test.c
  3. 4
      tests/iuup/iuup_test.ok

1
src/gsm/iuup.c

@ -593,6 +593,7 @@ static bool iuup_rx_initialization(struct osmo_iuup_instance *iui, struct osmo_i
buf++;
itail = (struct iuup_ctrl_init_tail *)buf;
} else {
iui->config.IPTIs_present = false;
itail = (struct iuup_ctrl_init_tail *)ihdr_rfci;
}
if (itail->data_pdu_type > 1) {

113
tests/iuup/iuup_test.c

@ -528,6 +528,118 @@ void test_passive_init(void)
osmo_iuup_instance_free(iui);
}
static int _decode_passive_init_2_rfci_no_iptis_user_prim_cb(struct osmo_prim_hdr *oph, void *ctx)
{
struct osmo_iuup_rnl_prim *irp = (struct osmo_iuup_rnl_prim *)oph;
printf("%s(): Initialization decoded fine!\n", __func__);
OSMO_ASSERT(OSMO_PRIM_HDR(&irp->oph) == OSMO_PRIM(OSMO_IUUP_RNL_STATUS, PRIM_OP_INDICATION));
OSMO_ASSERT(irp->u.status.procedure == IUUP_PROC_INIT);
OSMO_ASSERT(irp->u.status.u.initialization.num_rfci == 2);
OSMO_ASSERT(irp->u.status.u.initialization.num_subflows == 3);
OSMO_ASSERT(irp->u.status.u.initialization.data_pdu_type == 0);
OSMO_ASSERT(irp->u.status.u.initialization.IPTIs_present == false);
msgb_free(oph->msg);
return 0;
}
static int _decode_passive_init_2_rfci_no_iptis_transport_prim_cb(struct osmo_prim_hdr *oph, void *ctx)
{
struct osmo_iuup_tnl_prim *itp = (struct osmo_iuup_tnl_prim *)oph;
struct msgb *msg;
struct iuup_pdutype14_hdr *hdr;
printf("%s()\n", __func__);
msg = oph->msg;
OSMO_ASSERT(OSMO_PRIM_HDR(&itp->oph) == OSMO_PRIM(OSMO_IUUP_TNL_UNITDATA, PRIM_OP_REQUEST));
printf("Transport: DL len=%u: %s\n", msgb_l2len(msg),
osmo_hexdump((const unsigned char *) msgb_l2(msg), msgb_l2len(msg)));
hdr = msgb_l2(msg);
OSMO_ASSERT(hdr->pdu_type == IUUP_PDU_T_CONTROL);
OSMO_ASSERT(hdr->ack_nack == IUUP_AN_ACK);
msgb_free(msg);
return 0;
}
void test_decode_passive_init_2_rfci_no_iptis(void)
{
/* Here we check the passive INIT code path, aka receiving INIT and returning INIT_ACK/NACK */
struct osmo_iuup_instance *iui;
struct osmo_iuup_rnl_prim *rnp;
struct osmo_iuup_tnl_prim *tnp;
struct iuup_pdutype14_hdr *hdr14;
int rc;
/* Frame 46, "Initialization", SYS#5969 call4_Iu_Iuh.pcap
1110 .... = PDU Type: Control Procedure (14)
.... 00.. = Ack/Nack: Procedure (0)
.... ..00 = Frame Number: 0
0000 .... = Mode Version: 0x0
.... 0000 = Procedure: Initialization (0)
1101 11.. = Header CRC: 0x37 [correct]
.... ..01 1011 0100 = Payload CRC: 0x1b4
000. .... = Spare: 0x0
...0 .... = TI: IPTIs not present (0)
.... 011. = Subflows: 3
.... ...0 = Chain Indicator: this frame is the last frame for the procedure (0)
RFCI 1 Initialization
0... .... = RFCI 0 LRI: Not last RFCI (0x0)
.0.. .... = RFCI 0 LI: one octet used (0x0)
..00 0001 = RFCI 0: 1
RFCI 0 Flow 0 Len: 81
RFCI 0 Flow 1 Len: 103
RFCI 0 Flow 2 Len: 60
RFCI 6 Initialization
1... .... = RFCI 1 LRI: Last RFCI in current frame (0x1)
.0.. .... = RFCI 1 LI: one octet used (0x0)
..00 0110 = RFCI 1: 6
RFCI 1 Flow 0 Len: 39
RFCI 1 Flow 1 Len: 0
RFCI 1 Flow 2 Len: 0
Iu UP Mode Versions Supported: 0x0001
0... .... .... .... = Version 16: not supported (0x0)
.0.. .... .... .... = Version 15: not supported (0x0)
..0. .... .... .... = Version 14: not supported (0x0)
...0 .... .... .... = Version 13: not supported (0x0)
.... 0... .... .... = Version 12: not supported (0x0)
.... .0.. .... .... = Version 11: not supported (0x0)
.... ..0. .... .... = Version 10: not supported (0x0)
.... ...0 .... .... = Version 9: not supported (0x0)
.... .... 0... .... = Version 8: not supported (0x0)
.... .... .0.. .... = Version 7: not supported (0x0)
.... .... ..0. .... = Version 6: not supported (0x0)
.... .... ...0 .... = Version 5: not supported (0x0)
.... .... .... 0... = Version 4: not supported (0x0)
.... .... .... .0.. = Version 3: not supported (0x0)
.... .... .... ..0. = Version 2: not supported (0x0)
.... .... .... ...1 = Version 1: supported (0x1)
0000 .... = RFCI Data Pdu Type: PDU type 0 (0x0)
*/
const uint8_t iuup_init[] = {
0xe0, 0x00, 0xdd, 0xb4, 0x06, 0x01, 0x51, 0x67, 0x3c, 0x86, 0x27,
0x00, 0x00, 0x00, 0x01, 0x00
};
iui = osmo_iuup_instance_alloc(iuup_test_ctx, __func__);
OSMO_ASSERT(iui);
osmo_iuup_instance_set_user_prim_cb(iui, _decode_passive_init_2_rfci_no_iptis_user_prim_cb, NULL);
osmo_iuup_instance_set_transport_prim_cb(iui, _decode_passive_init_2_rfci_no_iptis_transport_prim_cb, NULL);
clock_override_set(0, 0);
/* Tx CONFIG.req */
rnp = osmo_iuup_rnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_RNL_CONFIG, PRIM_OP_REQUEST, IUUP_MSGB_SIZE);
rnp->u.config = def_configure_req;
rnp->u.config.active = false;
OSMO_ASSERT((rc = osmo_iuup_rnl_prim_down(iui, rnp)) == 0);
/* Send Init: */
tnp = osmo_iuup_tnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_TNL_UNITDATA, PRIM_OP_INDICATION, IUUP_MSGB_SIZE);
tnp->oph.msg->l2h = msgb_put(tnp->oph.msg, sizeof(iuup_init));
hdr14 = (struct iuup_pdutype14_hdr *)msgb_l2(tnp->oph.msg);
memcpy(hdr14, iuup_init, sizeof(iuup_init));
OSMO_ASSERT((rc = osmo_iuup_tnl_prim_up(iui, tnp)) == 0);
osmo_iuup_instance_free(iui);
}
int main(int argc, char **argv)
{
iuup_test_ctx = talloc_named_const(NULL, 0, "iuup_test");
@ -546,6 +658,7 @@ int main(int argc, char **argv)
test_init_nack_retrans();
test_init_ack();
test_passive_init();
test_decode_passive_init_2_rfci_no_iptis();
printf("OK.\n");
}

4
tests/iuup/iuup_test.ok

@ -43,4 +43,8 @@ _passive_init_user_prim_cb()
User: UL len=31: 08 55 6d 94 4c 71 a1 a0 81 e7 ea d2 04 24 44 80 00 0e cd 82 b8 11 18 00 00 97 c4 79 4e 77 40
_passive_init_transport_prim_cb()
Transport: DL len=35: 01 00 e3 ff 08 55 6d 94 4c 71 a1 a0 81 e7 ea d2 04 24 44 80 00 0e cd 82 b8 11 18 00 00 97 c4 79 4e 77 40
sys={0.000000}, clock_override_set
_decode_passive_init_2_rfci_no_iptis_user_prim_cb(): Initialization decoded fine!
_decode_passive_init_2_rfci_no_iptis_transport_prim_cb()
Transport: DL len=4: e4 00 24 00
OK.

Loading…
Cancel
Save