Skip to content

Commit

Permalink
switch: Set pGW/GGSN address from GTP-C
Browse files Browse the repository at this point in the history
Create-Session-Response & Create-PDP-Response are referencing remote
pGW & GGSN allocated during creation. This IP address MUST be used
instead of using L3 ip src. When running topologies with GTP router,
firewall or loadbalancer IP preset in GTP-C are mostly to be
different from ip present in layer3.
  • Loading branch information
acassen committed Jul 11, 2024
1 parent 546a9aa commit 38f5422
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/gtp_switch_hdl_v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,8 @@ gtp1_create_pdp_response_hdl(gtp_server_worker_t *w, struct sockaddr_storage *ad
gtp_sqn_restore(w, teid->peer_teid);

/* Set addr tunnel endpoint */
gtp_teid_update_pgw(teid, addr);
inet_ip4tosockaddr(teid->ipv4, (struct sockaddr_storage *) &teid->pgw_addr);
teid->pgw_addr.sin_port = htons(GTP_C_PORT);
teid->sgw_addr = t->sgw_addr;

/* Test cause code, destroy if <> success.
Expand Down
3 changes: 2 additions & 1 deletion src/gtp_switch_hdl_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,8 @@ gtpc_create_session_response_hdl(gtp_server_worker_t *w, struct sockaddr_storage
gtp_sqn_restore(w, teid->peer_teid);

/* Set addr tunnel endpoint */
teid->pgw_addr = *((struct sockaddr_in *) addr);
inet_ip4tosockaddr(teid->ipv4, (struct sockaddr_storage *) &teid->pgw_addr);
teid->pgw_addr.sin_port = htons(GTP_C_PORT);
teid->sgw_addr = t->sgw_addr;

/* Test cause code, destroy if <> success.
Expand Down

0 comments on commit 38f5422

Please sign in to comment.