Hi Harald,
For the most part, you need to see the UNION definitions in src/mme/mme_context.h as below.
348 union {
349 struct {
350 ED3(uint8_t spare;,
351 uint16_t overflow;,
352 uint8_t sqn;)
353 } __attribute__ ((packed));
354 uint32_t i32;
355 } ul_count;
Therefore, increasing SQN will also increase ul_count.i32.
Let me add the comments in src/mme/nas_security.c
/* If SQN exeeds 1 bytes and turn in once again,
Overflow is increased */
197 if (mme_ue->ul_count.sqn > h->sequence_number)
198 mme_ue->ul_count.overflow++;
/* Always set SQN from UE's SQN as below */
199 mme_ue->ul_count.sqn = h->sequence_number;
Let me know if I have misunderstood anything.
Thanks a lot!
Best Regards,
Sukchan