osmo_epdg: utils: add prefix epdg_ to all functions

Otherwise get_imsi() will clash in osmo_epdg_ue().
This commit is contained in:
Alexander Couzens 2024-02-18 17:51:16 +01:00
parent b222dccc1b
commit 9b427b7341
7 changed files with 23 additions and 23 deletions

View File

@ -141,7 +141,7 @@ static struct msgb *encode_to_msgb(struct osmo_gsup_message *gsup_msg)
return NULL; return NULL;
} }
msg = chunk_to_msgb(&msg_chunk); msg = epdg_chunk_to_msgb(&msg_chunk);
if (!msg) if (!msg)
{ {
goto free_msg; goto free_msg;

View File

@ -200,7 +200,7 @@ static void ipa_pdu_base_send_id_resp(private_osmo_epdg_ipa_client_t *this, stru
return; return;
} }
resp = chunk_to_msgb(&resp_pdu); resp = epdg_chunk_to_msgb(&resp_pdu);
/* remove the ipaccess header so we can use msg_pull on the message */ /* remove the ipaccess header so we can use msg_pull on the message */
msgb_pull(req, sizeof(struct ipaccess_head)); msgb_pull(req, sizeof(struct ipaccess_head));
@ -325,7 +325,7 @@ CALLBACK(on_stream_read, bool,
/* TODO: -ENOMEM; */ /* TODO: -ENOMEM; */
return FALSE; return FALSE;
} }
req = chunk_to_msgb(&req_chunk); req = epdg_chunk_to_msgb(&req_chunk);
memcpy(msgb_put(req, sizeof(head)), &head, sizeof(head)); memcpy(msgb_put(req, sizeof(head)), &head, sizeof(head));
/* TODO: either wait here with a timeout or don't care on this stream read */ /* TODO: either wait here with a timeout or don't care on this stream read */
if (!stream->read_all(stream, msgb_put(req, len), len)) if (!stream->read_all(stream, msgb_put(req, len), len))

View File

@ -55,7 +55,7 @@ METHOD(osmo_epdg_db_t, create_subscriber, osmo_epdg_ue_t *,
char imsi[16] = {0}; char imsi[16] = {0};
uint32_t unique = ike_sa->get_unique_id(ike_sa); uint32_t unique = ike_sa->get_unique_id(ike_sa);
if (get_imsi_ike(ike_sa, imsi, sizeof(imsi) - 1)) if (epdg_get_imsi_ike(ike_sa, imsi, sizeof(imsi) - 1))
{ {
return NULL; return NULL;
} }
@ -102,7 +102,7 @@ METHOD(osmo_epdg_db_t, get_subscriber_ike, osmo_epdg_ue_t *,
{ {
char imsi[16] = {0}; char imsi[16] = {0};
if (get_imsi_ike(ike_sa, imsi, sizeof(imsi))) if (epdg_get_imsi_ike(ike_sa, imsi, sizeof(imsi)))
{ {
return NULL; return NULL;
} }

View File

@ -56,7 +56,7 @@ METHOD(listener_t, eap_authorize, bool,
DBG1(DBG_NET, "epdg: authorize: no id given. Failing."); DBG1(DBG_NET, "epdg: authorize: no id given. Failing.");
goto err; goto err;
} }
if (get_imsi(id, imsi, sizeof(imsi) - 1)) if (epdg_get_imsi(id, imsi, sizeof(imsi) - 1))
{ {
DBG1(DBG_NET, "epdg: authorize: Can't find IMSI in EAP identity."); DBG1(DBG_NET, "epdg: authorize: Can't find IMSI in EAP identity.");
goto err; goto err;
@ -133,7 +133,7 @@ METHOD(listener_t, authorize, bool,
goto err; goto err;
} }
if (get_imsi(imsi_id, imsi, sizeof(imsi) - 1)) if (epdg_get_imsi(imsi_id, imsi, sizeof(imsi) - 1))
{ {
DBG1(DBG_NET, "epdg: authorize: Can't find IMSI in EAP identity."); DBG1(DBG_NET, "epdg: authorize: Can't find IMSI in EAP identity.");
goto err; goto err;
@ -221,7 +221,7 @@ METHOD(listener_t, ike_updown, bool,
private_osmo_epdg_listener_t *this, ike_sa_t *ike_sa, bool up) private_osmo_epdg_listener_t *this, ike_sa_t *ike_sa, bool up)
{ {
char imsi[16] = {0}; char imsi[16] = {0};
if (get_imsi_ike(ike_sa, imsi, sizeof(imsi))) if (epdg_get_imsi_ike(ike_sa, imsi, sizeof(imsi)))
{ {
DBG1(DBG_NET, "epdg_listener: updown: imsi UNKNOWN: IKE_SA went %s", up ? "up" : "down"); DBG1(DBG_NET, "epdg_listener: updown: imsi UNKNOWN: IKE_SA went %s", up ? "up" : "down");
return TRUE; return TRUE;

View File

@ -81,7 +81,7 @@ METHOD(simaka_provider_t, get_quintuplet, bool,
char imsi[17] = {0}; char imsi[17] = {0};
ike_sa_t *ike_sa; ike_sa_t *ike_sa;
if (get_imsi(id, imsi, sizeof(imsi) - 1)) if (epdg_get_imsi(id, imsi, sizeof(imsi) - 1))
{ {
DBG1(DBG_NET, "epdg: get_quintuplet: Can't find IMSI in EAP identity."); DBG1(DBG_NET, "epdg: get_quintuplet: Can't find IMSI in EAP identity.");
return FALSE; return FALSE;
@ -94,7 +94,7 @@ METHOD(simaka_provider_t, get_quintuplet, bool,
return FALSE; return FALSE;
} }
if (get_apn(ike_sa, apn, APN_MAXLEN)) if (epdg_get_apn(ike_sa, apn, APN_MAXLEN))
{ {
DBG1(DBG_NET, "epdg: get_quintuplet: Can't get APN."); DBG1(DBG_NET, "epdg: get_quintuplet: Can't get APN.");
return FALSE; return FALSE;

View File

@ -26,7 +26,7 @@
#include "osmo_epdg_utils.h" #include "osmo_epdg_utils.h"
struct msgb *chunk_to_msgb(chunk_t *chunk) struct msgb *epdg_chunk_to_msgb(chunk_t *chunk)
{ {
struct msgb *msg; struct msgb *msg;
if (chunk->len < sizeof(*msg)) if (chunk->len < sizeof(*msg))
@ -44,7 +44,7 @@ struct msgb *chunk_to_msgb(chunk_t *chunk)
return msg; return msg;
} }
int get_imsi_ike(ike_sa_t *ike_sa, char *imsi, size_t imsi_len) int epdg_get_imsi_ike(ike_sa_t *ike_sa, char *imsi, size_t imsi_len)
{ {
identification_t *imsi_id = ike_sa->get_other_id(ike_sa); identification_t *imsi_id = ike_sa->get_other_id(ike_sa);
if (!imsi_id) if (!imsi_id)
@ -52,10 +52,10 @@ int get_imsi_ike(ike_sa_t *ike_sa, char *imsi, size_t imsi_len)
return -1; return -1;
} }
return get_imsi(imsi_id, imsi, imsi_len); return epdg_get_imsi(imsi_id, imsi, imsi_len);
} }
int get_imsi(identification_t *id, char *imsi, size_t imsi_len) int epdg_get_imsi(identification_t *id, char *imsi, size_t imsi_len)
{ {
chunk_t nai = id->get_encoding(id); chunk_t nai = id->get_encoding(id);
/* TODO: maybe use regex? */ /* TODO: maybe use regex? */
@ -77,7 +77,7 @@ int get_imsi(identification_t *id, char *imsi, size_t imsi_len)
return 0; return 0;
} }
int validate_imsi(const char *imsi) int epdg_validate_imsi(const char *imsi)
{ {
if (!imsi) if (!imsi)
return 1; return 1;
@ -96,7 +96,7 @@ int validate_imsi(const char *imsi)
return 0; return 0;
} }
int validate_apn(const char *apn) int epdg_validate_apn(const char *apn)
{ {
/* don't support empty apn */ /* don't support empty apn */
if (!apn) if (!apn)
@ -108,7 +108,7 @@ int validate_apn(const char *apn)
return 0; return 0;
} }
int get_apn(ike_sa_t *sa, char *apn, size_t apn_len) int epdg_get_apn(ike_sa_t *sa, char *apn, size_t apn_len)
{ {
identification_t* apn_id; identification_t* apn_id;
chunk_t apn_chunk; chunk_t apn_chunk;

View File

@ -26,12 +26,12 @@
#define IPA_ALLOC_SIZE 1200 #define IPA_ALLOC_SIZE 1200
struct msgb *chunk_to_msgb(chunk_t *chunk); struct msgb *epdg_chunk_to_msgb(chunk_t *chunk);
int get_imsi(identification_t *id, char *imsi, size_t imsi_len); int epdg_get_imsi(identification_t *id, char *imsi, size_t imsi_len);
int get_imsi_ike(ike_sa_t *ike_sa, char *imsi, size_t imsi_len); int epdg_get_imsi_ike(ike_sa_t *ike_sa, char *imsi, size_t imsi_len);
int validate_imsi(const char *imsi); int epdg_validate_imsi(const char *imsi);
int get_apn(ike_sa_t *sa, char *apn, size_t apn_len); int epdg_get_apn(ike_sa_t *sa, char *apn, size_t apn_len);
int validate_apn(const char *apn); int epdg_validate_apn(const char *apn);
#endif /* OSMO_EPDG_UTILS_H_ */ #endif /* OSMO_EPDG_UTILS_H_ */