aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-06-03 01:44:05 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-03 01:44:05 +0800
commit8b4898360a718432c0c7e8ad61403ad2652191e1 (patch)
treeb8d32a93a9be7b70fbeb6638c87e9730f43db1d0
parent6e495eee4b320041ea23a02ec3946deec8a51533 (diff)
[nat] Implement the removal of an access-list.
-rw-r--r--openbsc/include/openbsc/bsc_nat.h1
-rw-r--r--openbsc/src/nat/bsc_nat_utils.c6
-rw-r--r--openbsc/src/nat/bsc_nat_vty.c17
3 files changed, 24 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index 5d28e4c9..3b950e1d 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -326,5 +326,6 @@ int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int id);
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_access_list *bsc_nat_accs_list_get(struct bsc_nat *nat, const char *name);
+void bsc_nat_accs_list_delete(struct bsc_nat_access_list *lst);
#endif
diff --git a/openbsc/src/nat/bsc_nat_utils.c b/openbsc/src/nat/bsc_nat_utils.c
index eeb3198e..9e7370f4 100644
--- a/openbsc/src/nat/bsc_nat_utils.c
+++ b/openbsc/src/nat/bsc_nat_utils.c
@@ -444,3 +444,9 @@ struct bsc_nat_access_list *bsc_nat_accs_list_get(struct bsc_nat *nat, const cha
llist_add(&lst->list, &nat->access_lists);
return lst;
}
+
+void bsc_nat_accs_list_delete(struct bsc_nat_access_list *lst)
+{
+ llist_del(&lst->list);
+ talloc_free(lst);
+}
diff --git a/openbsc/src/nat/bsc_nat_vty.c b/openbsc/src/nat/bsc_nat_vty.c
index e888dcc6..3f2d7ac5 100644
--- a/openbsc/src/nat/bsc_nat_vty.c
+++ b/openbsc/src/nat/bsc_nat_vty.c
@@ -413,6 +413,22 @@ DEFUN(cfg_lst_imsi_deny,
return CMD_SUCCESS;
}
+/* naming to follow Zebra... */
+DEFUN(cfg_lst_no,
+ cfg_lst_no_cmd,
+ "no access-list NAME",
+ NO_STR "Remove an access-list by name\n"
+ "The access-list to remove\n")
+{
+ struct bsc_nat_access_list *acc;
+ acc = bsc_nat_accs_list_find(_nat, argv[0]);
+ if (!acc)
+ return CMD_WARNING;
+
+ bsc_nat_accs_list_delete(acc);
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_bsc_acc_lst_name,
cfg_bsc_acc_lst_name_cmd,
"access-list-name NAME",
@@ -507,6 +523,7 @@ int bsc_nat_vty_init(struct bsc_nat *nat)
/* access-list */
install_element(NAT_NODE, &cfg_lst_imsi_allow_cmd);
install_element(NAT_NODE, &cfg_lst_imsi_deny_cmd);
+ install_element(NAT_NODE, &cfg_lst_no_cmd);
/* BSC subgroups */
install_element(NAT_NODE, &cfg_bsc_cmd);