Skip to content

Commit

Permalink
switch: fix missing recovery IE update
Browse files Browse the repository at this point in the history
Recovery IE originated from GTP-Guard in proxy mode MUST use local GTP-Guard restart_counter.
  • Loading branch information
acassen committed Jul 26, 2024
1 parent 703cfcf commit b64e9a1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/gtp_switch_hdl_v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ gtp1_create_pdp_response_hdl(gtp_server_worker_t *w, struct sockaddr_storage *ad
return NULL;
}

/* Recovery xlat */
gtp1_session_xlat_recovery(w);

/* SQN masq */
gtp_sqn_restore(w, t);

Expand Down Expand Up @@ -548,6 +551,9 @@ gtp1_update_pdp_response_hdl(gtp_server_worker_t *w, struct sockaddr_storage *ad
return NULL;
}

/* Recovery xlat */
gtp1_session_xlat_recovery(w);

/* SQN masq */
gtp_sqn_restore(w, teid->peer_teid);

Expand Down Expand Up @@ -631,6 +637,9 @@ gtp1_delete_pdp_request_hdl(gtp_server_worker_t *w, struct sockaddr_storage *add
/* Set GGSN TEID */
h->teid = teid->id;

/* Recovery xlat */
gtp1_session_xlat_recovery(w);

/* Update SQN */
gtp_sqn_update(w, teid);
gtp_vsqn_alloc(w, teid, false);
Expand Down Expand Up @@ -672,6 +681,9 @@ gtp1_delete_pdp_response_hdl(gtp_server_worker_t *w, struct sockaddr_storage *ad
return NULL;
}

/* Recovery xlat */
gtp1_session_xlat_recovery(w);

/* SQN masq */
gtp_sqn_restore(w, teid);

Expand All @@ -684,6 +696,9 @@ gtp1_delete_pdp_response_hdl(gtp_server_worker_t *w, struct sockaddr_storage *ad
/* Restore TEID at SGSN */
h->teid = teid->id;

/* Recovery xlat */
gtp1_session_xlat_recovery(w);

/* SQN masq */
gtp_sqn_restore(w, teid->peer_teid);

Expand Down
15 changes: 15 additions & 0 deletions src/gtp_switch_hdl_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ gtpc_create_session_response_hdl(gtp_server_worker_t *w, struct sockaddr_storage
gtp_ie_imsi_rewrite(t->session->apn, cp);
}

/* Recovery xlat */
gtpc_session_xlat_recovery(w);

/* SQN masq */
gtp_sqn_restore(w, t);

Expand Down Expand Up @@ -538,6 +541,9 @@ gtpc_delete_session_response_hdl(gtp_server_worker_t *w, struct sockaddr_storage
gtp_ie_imsi_rewrite(teid->session->apn, cp);
}

/* Recovery xlat */
gtpc_session_xlat_recovery(w);

/* SQN masq */
gtp_sqn_restore(w, teid->peer_teid);

Expand All @@ -556,6 +562,9 @@ gtpc_delete_session_response_hdl(gtp_server_worker_t *w, struct sockaddr_storage
/* Set sGW TEID */
h->teid = teid->id;

/* Recovery xlat */
gtpc_session_xlat_recovery(w);

/* SQN masq */
gtp_sqn_restore(w, teid->peer_teid);

Expand Down Expand Up @@ -682,6 +691,9 @@ gtpc_modify_bearer_response_hdl(gtp_server_worker_t *w, struct sockaddr_storage
gtp_ie_imsi_rewrite(teid->session->apn, cp);
}

/* Recovery xlat */
gtpc_session_xlat_recovery(w);

/* SQN masq */
gtp_sqn_restore(w, teid->peer_teid);

Expand Down Expand Up @@ -767,6 +779,9 @@ gtpc_delete_bearer_request_hdl(gtp_server_worker_t *w, struct sockaddr_storage *
gtp_ie_imsi_rewrite(teid->session->apn, cp);
}

/* Recovery xlat */
gtpc_session_xlat_recovery(w);

/* Update SQN */
gtp_sqn_update(w, teid);
gtp_vsqn_alloc(w, teid, false);
Expand Down

0 comments on commit b64e9a1

Please sign in to comment.