aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-bsc_nat/bsc_nat_filter.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-12-17 14:35:03 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-01-07 15:02:34 +0100
commitbdf764a0255ebef0593b5c39a5118278d1a17d50 (patch)
tree2d50cd15795fe5b0bf81078c12efa85d1137b610 /openbsc/src/osmo-bsc_nat/bsc_nat_filter.c
parentadc2e8737235fd5f1655ba1a319d3aab76f16d91 (diff)
nat: Allow the filter to select the reject cause
In preparation for another kind of black-list allow the filter code to decide how the connection should be rejected. Introduce a new struct that will carry the reject causes for certain operations.
Diffstat (limited to 'openbsc/src/osmo-bsc_nat/bsc_nat_filter.c')
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat_filter.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_filter.c b/openbsc/src/osmo-bsc_nat/bsc_nat_filter.c
index 42cfb9e74..15afb9a4a 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_filter.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_filter.c
@@ -2,8 +2,8 @@
* Access filtering
*/
/*
- * (C) 2010-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
- * (C) 2010-2011 by On-Waves
+ * (C) 2010-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2010-2012 by On-Waves
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -223,8 +223,8 @@ static int _dt_check_id_resp(struct bsc_connection *bsc,
/* Filter out CR data... */
int bsc_nat_filter_sccp_cr(struct bsc_connection *bsc, struct msgb *msg,
- struct bsc_nat_parsed *parsed, int *con_type,
- char **imsi)
+ struct bsc_nat_parsed *parsed, int *con_type,
+ char **imsi, struct bsc_nat_reject_cause *cause)
{
struct tlv_parsed tp;
struct gsm48_hdr *hdr48;
@@ -233,6 +233,8 @@ int bsc_nat_filter_sccp_cr(struct bsc_connection *bsc, struct msgb *msg,
uint8_t msg_type, proto;
*con_type = NAT_CON_TYPE_NONE;
+ cause->cm_reject_cause = GSM48_REJECT_PLMN_NOT_ALLOWED;
+ cause->lu_reject_cause = GSM48_REJECT_PLMN_NOT_ALLOWED;
*imsi = NULL;
if (parsed->gsm_type != BSS_MAP_MSG_COMPLETE_LAYER_3) {
@@ -292,12 +294,16 @@ int bsc_nat_filter_sccp_cr(struct bsc_connection *bsc, struct msgb *msg,
}
int bsc_nat_filter_dt(struct bsc_connection *bsc, struct msgb *msg,
- struct sccp_connections *con, struct bsc_nat_parsed *parsed)
+ struct sccp_connections *con, struct bsc_nat_parsed *parsed,
+ struct bsc_nat_reject_cause *cause)
{
uint32_t len;
uint8_t msg_type, proto;
struct gsm48_hdr *hdr48;
+ cause->cm_reject_cause = GSM48_REJECT_PLMN_NOT_ALLOWED;
+ cause->lu_reject_cause = GSM48_REJECT_PLMN_NOT_ALLOWED;
+
if (con->imsi_checked)
return 0;