mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-11-01 12:33:49 +00:00
nat: Shorten the access-list struct and method names (still way too long)
This commit is contained in:
@@ -204,7 +204,7 @@ struct bsc_nat_statistics {
|
|||||||
} msc;
|
} msc;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct bsc_nat_access_list {
|
struct bsc_nat_acc_lst {
|
||||||
struct llist_head list;
|
struct llist_head list;
|
||||||
|
|
||||||
/* the name of the list */
|
/* the name of the list */
|
||||||
@@ -324,8 +324,8 @@ int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int id);
|
|||||||
|
|
||||||
/* IMSI allow/deny handling */
|
/* IMSI allow/deny handling */
|
||||||
void bsc_parse_reg(void *ctx, regex_t *reg, char **imsi, int argc, const char **argv);
|
void bsc_parse_reg(void *ctx, regex_t *reg, char **imsi, int argc, const char **argv);
|
||||||
struct bsc_nat_access_list *bsc_nat_accs_list_find(struct bsc_nat *nat, const char *name);
|
struct bsc_nat_acc_lst *bsc_nat_acc_lst_find(struct bsc_nat *nat, const char *name);
|
||||||
struct bsc_nat_access_list *bsc_nat_accs_list_get(struct bsc_nat *nat, const char *name);
|
struct bsc_nat_acc_lst *bsc_nat_acc_lst_get(struct bsc_nat *nat, const char *name);
|
||||||
void bsc_nat_accs_list_delete(struct bsc_nat_access_list *lst);
|
void bsc_nat_acc_lst_delete(struct bsc_nat_acc_lst *lst);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -205,11 +205,11 @@ static int auth_imsi(struct bsc_connection *bsc, const char *mi_string)
|
|||||||
* 3.) Reject if the IMSI not allowed at the global level.
|
* 3.) Reject if the IMSI not allowed at the global level.
|
||||||
* 4.) Allow directly if the IMSI is allowed at the global level
|
* 4.) Allow directly if the IMSI is allowed at the global level
|
||||||
*/
|
*/
|
||||||
struct bsc_nat_access_list *nat_lst = NULL;
|
struct bsc_nat_acc_lst *nat_lst = NULL;
|
||||||
struct bsc_nat_access_list *bsc_lst = NULL;
|
struct bsc_nat_acc_lst *bsc_lst = NULL;
|
||||||
|
|
||||||
bsc_lst = bsc_nat_accs_list_find(bsc->nat, bsc->cfg->acc_lst_name);
|
bsc_lst = bsc_nat_acc_lst_find(bsc->nat, bsc->cfg->acc_lst_name);
|
||||||
nat_lst = bsc_nat_accs_list_find(bsc->nat, bsc->nat->acc_lst_name);
|
nat_lst = bsc_nat_acc_lst_find(bsc->nat, bsc->nat->acc_lst_name);
|
||||||
|
|
||||||
|
|
||||||
/* 1. BSC deny */
|
/* 1. BSC deny */
|
||||||
@@ -412,9 +412,9 @@ const char *bsc_con_type_to_string(int type)
|
|||||||
return con_types[type];
|
return con_types[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bsc_nat_access_list *bsc_nat_accs_list_find(struct bsc_nat *nat, const char *name)
|
struct bsc_nat_acc_lst *bsc_nat_acc_lst_find(struct bsc_nat *nat, const char *name)
|
||||||
{
|
{
|
||||||
struct bsc_nat_access_list *lst;
|
struct bsc_nat_acc_lst *lst;
|
||||||
|
|
||||||
if (!name)
|
if (!name)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -426,15 +426,15 @@ struct bsc_nat_access_list *bsc_nat_accs_list_find(struct bsc_nat *nat, const ch
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bsc_nat_access_list *bsc_nat_accs_list_get(struct bsc_nat *nat, const char *name)
|
struct bsc_nat_acc_lst *bsc_nat_acc_lst_get(struct bsc_nat *nat, const char *name)
|
||||||
{
|
{
|
||||||
struct bsc_nat_access_list *lst;
|
struct bsc_nat_acc_lst *lst;
|
||||||
|
|
||||||
lst = bsc_nat_accs_list_find(nat, name);
|
lst = bsc_nat_acc_lst_find(nat, name);
|
||||||
if (lst)
|
if (lst)
|
||||||
return lst;
|
return lst;
|
||||||
|
|
||||||
lst = talloc_zero(nat, struct bsc_nat_access_list);
|
lst = talloc_zero(nat, struct bsc_nat_acc_lst);
|
||||||
if (!lst) {
|
if (!lst) {
|
||||||
LOGP(DNAT, LOGL_ERROR, "Failed to allocate access list");
|
LOGP(DNAT, LOGL_ERROR, "Failed to allocate access list");
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -445,7 +445,7 @@ struct bsc_nat_access_list *bsc_nat_accs_list_get(struct bsc_nat *nat, const cha
|
|||||||
return lst;
|
return lst;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bsc_nat_accs_list_delete(struct bsc_nat_access_list *lst)
|
void bsc_nat_acc_lst_delete(struct bsc_nat_acc_lst *lst)
|
||||||
{
|
{
|
||||||
llist_del(&lst->list);
|
llist_del(&lst->list);
|
||||||
talloc_free(lst);
|
talloc_free(lst);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ static struct cmd_node bsc_node = {
|
|||||||
|
|
||||||
static int config_write_nat(struct vty *vty)
|
static int config_write_nat(struct vty *vty)
|
||||||
{
|
{
|
||||||
struct bsc_nat_access_list *lst;
|
struct bsc_nat_acc_lst *lst;
|
||||||
|
|
||||||
vty_out(vty, "nat%s", VTY_NEWLINE);
|
vty_out(vty, "nat%s", VTY_NEWLINE);
|
||||||
vty_out(vty, " msc ip %s%s", _nat->msc_ip, VTY_NEWLINE);
|
vty_out(vty, " msc ip %s%s", _nat->msc_ip, VTY_NEWLINE);
|
||||||
@@ -386,9 +386,9 @@ DEFUN(cfg_lst_imsi_allow,
|
|||||||
"The name of the access-list\n"
|
"The name of the access-list\n"
|
||||||
"The regexp of allowed IMSIs\n")
|
"The regexp of allowed IMSIs\n")
|
||||||
{
|
{
|
||||||
struct bsc_nat_access_list *acc;
|
struct bsc_nat_acc_lst *acc;
|
||||||
|
|
||||||
acc = bsc_nat_accs_list_get(_nat, argv[0]);
|
acc = bsc_nat_acc_lst_get(_nat, argv[0]);
|
||||||
if (!acc)
|
if (!acc)
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
|
||||||
@@ -403,9 +403,9 @@ DEFUN(cfg_lst_imsi_deny,
|
|||||||
"The name of the access-list\n"
|
"The name of the access-list\n"
|
||||||
"The regexp of to be denied IMSIs\n")
|
"The regexp of to be denied IMSIs\n")
|
||||||
{
|
{
|
||||||
struct bsc_nat_access_list *acc;
|
struct bsc_nat_acc_lst *acc;
|
||||||
|
|
||||||
acc = bsc_nat_accs_list_get(_nat, argv[0]);
|
acc = bsc_nat_acc_lst_get(_nat, argv[0]);
|
||||||
if (!acc)
|
if (!acc)
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
|
||||||
@@ -420,12 +420,12 @@ DEFUN(cfg_lst_no,
|
|||||||
NO_STR "Remove an access-list by name\n"
|
NO_STR "Remove an access-list by name\n"
|
||||||
"The access-list to remove\n")
|
"The access-list to remove\n")
|
||||||
{
|
{
|
||||||
struct bsc_nat_access_list *acc;
|
struct bsc_nat_acc_lst *acc;
|
||||||
acc = bsc_nat_accs_list_find(_nat, argv[0]);
|
acc = bsc_nat_acc_lst_find(_nat, argv[0]);
|
||||||
if (!acc)
|
if (!acc)
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
|
||||||
bsc_nat_accs_list_delete(acc);
|
bsc_nat_acc_lst_delete(acc);
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -640,7 +640,7 @@ static void test_cr_filter()
|
|||||||
int i, res, contype;
|
int i, res, contype;
|
||||||
struct msgb *msg = msgb_alloc(4096, "test_cr_filter");
|
struct msgb *msg = msgb_alloc(4096, "test_cr_filter");
|
||||||
struct bsc_nat_parsed *parsed;
|
struct bsc_nat_parsed *parsed;
|
||||||
struct bsc_nat_access_list *nat_lst, *bsc_lst;
|
struct bsc_nat_acc_lst *nat_lst, *bsc_lst;
|
||||||
|
|
||||||
struct bsc_nat *nat = bsc_nat_alloc();
|
struct bsc_nat *nat = bsc_nat_alloc();
|
||||||
struct bsc_connection *bsc = bsc_connection_alloc(nat);
|
struct bsc_connection *bsc = bsc_connection_alloc(nat);
|
||||||
@@ -652,8 +652,8 @@ static void test_cr_filter()
|
|||||||
msgb_reset(msg);
|
msgb_reset(msg);
|
||||||
copy_to_msg(msg, cr_filter[i].data, cr_filter[i].length);
|
copy_to_msg(msg, cr_filter[i].data, cr_filter[i].length);
|
||||||
|
|
||||||
nat_lst = bsc_nat_accs_list_get(nat, "nat");
|
nat_lst = bsc_nat_acc_lst_get(nat, "nat");
|
||||||
bsc_lst = bsc_nat_accs_list_get(nat, "bsc");
|
bsc_lst = bsc_nat_acc_lst_get(nat, "bsc");
|
||||||
|
|
||||||
bsc_parse_reg(nat_lst, &nat_lst->imsi_deny_re, &nat_lst->imsi_deny,
|
bsc_parse_reg(nat_lst, &nat_lst->imsi_deny_re, &nat_lst->imsi_deny,
|
||||||
cr_filter[i].nat_imsi_deny ? 1 : 0,
|
cr_filter[i].nat_imsi_deny ? 1 : 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user