fix the timezone in EMM & GTP encoding
This commit is contained in:
parent
b2c6c8f856
commit
8c68560ccd
|
@ -379,14 +379,18 @@ ED3(c_uint8_t ipv4:1;,
|
|||
#define GTP_UE_TIME_ZONE_NO_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME 0
|
||||
#define GTP_UE_TIME_ZONE_1_HOUR_FOR_DAYLIGHT_SAVING_TIME 1
|
||||
#define GTP_UE_TIME_ZONE_2_HOUR_FOR_DAYLIGHT_SAVING_TIME 2
|
||||
/* Time Zone" IE in 3GPP TS 24.008 [5].
|
||||
* This field uses the same format as the Timezone field used in the
|
||||
* TP-Service-Centre-Time-Stamp, which is defined in 3GPP TS 23.040 [90],
|
||||
* and its value shall be set as defined in 3GPP TS 22.042 */
|
||||
typedef struct _gtp_ue_timezone_t {
|
||||
/* Time Zone" IE in 3GPP TS 24.008 [5].
|
||||
* This field uses the same format as the Timezone field used in the
|
||||
* TP-Service-Centre-Time-Stamp, which is defined in 3GPP TS 23.040 [90],
|
||||
* and its value shall be set as defined in 3GPP TS 22.042 */
|
||||
#define GTP_TIME_TO_BCD(x) TIME_TO_BCD(x)
|
||||
ED2(c_uint8_t sign:1;,
|
||||
c_uint8_t gmtoff:7;) /* quarters of an hour */
|
||||
/* The Time Zone indicates the difference, expressed in quarters of an hour,
|
||||
* between the local time and GMT. In the first of the two semi-octets,
|
||||
* the first bit (bit 3 of the seventh octet of
|
||||
* the TP-Service-Centre-Time-Stamp field) represents
|
||||
* the algebraic sign of this difference (0: positive, 1: negative). */
|
||||
c_uint8_t timezone;
|
||||
ED2(c_uint8_t spare:6;,
|
||||
c_uint8_t daylight_saving_time:2;)
|
||||
} __attribute__ ((packed)) gtp_ue_timezone_t;
|
||||
|
|
|
@ -715,8 +715,12 @@ typedef struct _nas_time_zone_and_time_t {
|
|||
c_uint8_t hour;
|
||||
c_uint8_t min;
|
||||
c_uint8_t sec;
|
||||
ED2(c_uint8_t sign:1;,
|
||||
c_uint8_t gmtoff:7;) /* quarters of an hour */
|
||||
/* The Time Zone indicates the difference, expressed in quarters of an hour,
|
||||
* between the local time and GMT. In the first of the two semi-octets,
|
||||
* the first bit (bit 3 of the seventh octet of
|
||||
* the TP-Service-Centre-Time-Stamp field) represents
|
||||
* the algebraic sign of this difference (0: positive, 1: negative). */
|
||||
c_uint8_t timezone;
|
||||
} nas_time_zone_and_time_t;
|
||||
|
||||
/* 9.9.3.31 TMSI status
|
||||
|
|
|
@ -222,12 +222,16 @@ status_t emm_handle_attach_complete(
|
|||
universal_time_and_local_time_zone->min = NAS_TIME_TO_BCD(xt_gmt.tm_min);
|
||||
universal_time_and_local_time_zone->sec = NAS_TIME_TO_BCD(xt_gmt.tm_sec);
|
||||
if (xt_local.tm_gmtoff >= 0)
|
||||
universal_time_and_local_time_zone->sign = 0;
|
||||
{
|
||||
universal_time_and_local_time_zone->timezone =
|
||||
NAS_TIME_TO_BCD(xt_local.tm_gmtoff / 900);
|
||||
}
|
||||
else
|
||||
universal_time_and_local_time_zone->sign = 1;
|
||||
/* quarters of an hour */
|
||||
universal_time_and_local_time_zone->gmtoff =
|
||||
NAS_TIME_TO_BCD(xt_local.tm_gmtoff / 900);
|
||||
{
|
||||
universal_time_and_local_time_zone->timezone =
|
||||
NAS_TIME_TO_BCD((-xt_local.tm_gmtoff) / 900);
|
||||
universal_time_and_local_time_zone->timezone |= 0x08;
|
||||
}
|
||||
|
||||
emm_information->presencemask |=
|
||||
NAS_EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_PRESENT;
|
||||
|
|
|
@ -206,11 +206,15 @@ status_t mme_s11_build_create_session_request(
|
|||
memset(&ue_timezone, 0, sizeof(ue_timezone));
|
||||
time_exp_lt(&time_exp, time_now());
|
||||
if (time_exp.tm_gmtoff >= 0)
|
||||
ue_timezone.sign = 0;
|
||||
{
|
||||
ue_timezone.timezone = GTP_TIME_TO_BCD(time_exp.tm_gmtoff / 900);
|
||||
}
|
||||
else
|
||||
ue_timezone.sign = 1;
|
||||
{
|
||||
ue_timezone.timezone = GTP_TIME_TO_BCD((-time_exp.tm_gmtoff) / 900);
|
||||
ue_timezone.timezone |= 0x08;
|
||||
}
|
||||
/* quarters of an hour */
|
||||
ue_timezone.gmtoff = GTP_TIME_TO_BCD(time_exp.tm_gmtoff / 900);
|
||||
ue_timezone.daylight_saving_time =
|
||||
GTP_UE_TIME_ZONE_NO_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME;
|
||||
req->ue_time_zone.presence = 1;
|
||||
|
@ -427,11 +431,14 @@ status_t mme_s11_build_create_bearer_response(
|
|||
memset(&ue_timezone, 0, sizeof(ue_timezone));
|
||||
time_exp_lt(&time_exp, time_now());
|
||||
if (time_exp.tm_gmtoff >= 0)
|
||||
ue_timezone.sign = 0;
|
||||
{
|
||||
ue_timezone.timezone = GTP_TIME_TO_BCD(time_exp.tm_gmtoff / 900);
|
||||
}
|
||||
else
|
||||
ue_timezone.sign = 1;
|
||||
/* quarters of an hour */
|
||||
ue_timezone.gmtoff = GTP_TIME_TO_BCD(time_exp.tm_gmtoff / 900);
|
||||
{
|
||||
ue_timezone.timezone = GTP_TIME_TO_BCD((-time_exp.tm_gmtoff) / 900);
|
||||
ue_timezone.timezone |= 0x08;
|
||||
}
|
||||
ue_timezone.daylight_saving_time =
|
||||
GTP_UE_TIME_ZONE_NO_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME;
|
||||
rsp->ue_time_zone.presence = 1;
|
||||
|
@ -504,11 +511,14 @@ status_t mme_s11_build_update_bearer_response(
|
|||
memset(&ue_timezone, 0, sizeof(ue_timezone));
|
||||
time_exp_lt(&time_exp, time_now());
|
||||
if (time_exp.tm_gmtoff >= 0)
|
||||
ue_timezone.sign = 0;
|
||||
{
|
||||
ue_timezone.timezone = GTP_TIME_TO_BCD(time_exp.tm_gmtoff / 900);
|
||||
}
|
||||
else
|
||||
ue_timezone.sign = 1;
|
||||
/* quarters of an hour */
|
||||
ue_timezone.gmtoff = GTP_TIME_TO_BCD(time_exp.tm_gmtoff / 900);
|
||||
{
|
||||
ue_timezone.timezone = GTP_TIME_TO_BCD((-time_exp.tm_gmtoff) / 900);
|
||||
ue_timezone.timezone |= 0x08;
|
||||
}
|
||||
ue_timezone.daylight_saving_time =
|
||||
GTP_UE_TIME_ZONE_NO_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME;
|
||||
rsp->ue_time_zone.presence = 1;
|
||||
|
@ -581,11 +591,14 @@ status_t mme_s11_build_delete_bearer_response(
|
|||
memset(&ue_timezone, 0, sizeof(ue_timezone));
|
||||
time_exp_lt(&time_exp, time_now());
|
||||
if (time_exp.tm_gmtoff >= 0)
|
||||
ue_timezone.sign = 0;
|
||||
{
|
||||
ue_timezone.timezone = GTP_TIME_TO_BCD(time_exp.tm_gmtoff / 900);
|
||||
}
|
||||
else
|
||||
ue_timezone.sign = 1;
|
||||
/* quarters of an hour */
|
||||
ue_timezone.gmtoff = GTP_TIME_TO_BCD(time_exp.tm_gmtoff / 900);
|
||||
{
|
||||
ue_timezone.timezone = GTP_TIME_TO_BCD((-time_exp.tm_gmtoff) / 900);
|
||||
ue_timezone.timezone |= 0x08;
|
||||
}
|
||||
ue_timezone.daylight_saving_time =
|
||||
GTP_UE_TIME_ZONE_NO_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME;
|
||||
rsp->ue_time_zone.presence = 1;
|
||||
|
|
|
@ -56,7 +56,8 @@ services:
|
|||
- base
|
||||
environment:
|
||||
- DB_URI=mongodb://mongodb/nextepc
|
||||
- DISPLAY=docker.for.mac.localhost:0
|
||||
- DISPLAY=$DISPLAY
|
||||
# - DISPLAY=docker.for.mac.localhost:0
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
devices:
|
||||
|
@ -67,7 +68,8 @@ services:
|
|||
- home:/home/${USER}
|
||||
- ${HOME}:/mnt
|
||||
- /tmp/.X11-unix:/tmp/.X11-unix
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
# - /etc/localtime:/etc/localtime:ro
|
||||
# - /usr/share/zoneinfo/Europe/Helsinki:/etc/localtime:ro
|
||||
hostname: nextepc-dev
|
||||
user: ${USER}
|
||||
entrypoint: /bin/bash -c "/bin/bash -c \"$${@}\""
|
||||
|
|
|
@ -155,7 +155,7 @@ static void gtp_message_test1(abts_case *tc, void *data)
|
|||
&bearer_qos, bearer_qos_buf, GTP_BEARER_QOS_LEN);
|
||||
|
||||
memset(&ue_timezone, 0, sizeof(ue_timezone));
|
||||
ue_timezone.gmtoff = 0x40;
|
||||
ue_timezone.timezone = 0x40;
|
||||
ue_timezone.daylight_saving_time =
|
||||
GTP_UE_TIME_ZONE_NO_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME;
|
||||
req.ue_time_zone.presence = 1;
|
||||
|
|
Loading…
Reference in New Issue