From c652913674ecc30f8d234878a17baa623cbacf99 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sun, 5 Apr 2015 21:03:49 +0200 Subject: filter: Move the con_type into the filter_state --- openbsc/src/osmo-bsc_nat/bsc_nat.c | 12 ++++++------ openbsc/src/osmo-bsc_nat/bsc_nat_filter.c | 2 +- openbsc/src/osmo-bsc_nat/bsc_nat_utils.c | 30 +++++++++++++++--------------- openbsc/src/osmo-bsc_nat/bsc_nat_vty.c | 2 +- openbsc/src/osmo-bsc_nat/bsc_ussd.c | 2 +- 5 files changed, 24 insertions(+), 24 deletions(-) (limited to 'openbsc/src/osmo-bsc_nat') diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c index 3ec43b15f..4357485ff 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c @@ -442,7 +442,7 @@ static void bsc_send_con_release(struct bsc_connection *bsc, con->msc_con = NULL; /* 2. release the BSC side */ - if (con->con_type == NAT_CON_TYPE_LU) { + if (con->filter_state.con_type == FLT_CON_TYPE_LU) { struct msgb *payload, *udt; payload = gsm48_create_loc_upd_rej(cause->lu_reject_cause); @@ -470,7 +470,7 @@ static void bsc_send_con_release(struct bsc_connection *bsc, return; } - con->con_type = NAT_CON_TYPE_LOCAL_REJECT; + con->filter_state.con_type = FLT_CON_TYPE_LOCAL_REJECT; bsc_write(bsc, rlsd, IPAC_PROTO_SCCP); } @@ -481,9 +481,9 @@ static void bsc_send_con_refuse(struct bsc_connection *bsc, struct msgb *payload; struct msgb *refuse; - if (con_type == NAT_CON_TYPE_LU) + if (con_type == FLT_CON_TYPE_LU) payload = gsm48_create_loc_upd_rej(cause->lu_reject_cause); - else if (con_type == NAT_CON_TYPE_CM_SERV_REQ || con_type == NAT_CON_TYPE_SSA) + else if (con_type == FLT_CON_TYPE_CM_SERV_REQ || con_type == FLT_CON_TYPE_SSA) payload = gsm48_create_mm_serv_rej(cause->cm_reject_cause); else { LOGP(DNAT, LOGL_ERROR, "Unknown connection type: %d\n", con_type); @@ -504,7 +504,7 @@ static void bsc_send_con_refuse(struct bsc_connection *bsc, goto send_refuse; /* declare it local and assign a unique remote_ref */ - con->con_type = NAT_CON_TYPE_LOCAL_REJECT; + con->filter_state.con_type = FLT_CON_TYPE_LOCAL_REJECT; con->con_local = NAT_CON_END_LOCAL; con->has_remote_ref = 1; con->remote_ref = con->patched_ref; @@ -1072,7 +1072,7 @@ static int forward_sccp_to_msc(struct bsc_connection *bsc, struct msgb *msg) con = patch_sccp_src_ref_to_msc(msg, parsed, bsc); con->msc_con = bsc->nat->msc_con; con_msc = con->msc_con; - con->con_type = con_type; + con->filter_state.con_type = con_type; con->filter_state.imsi_checked = filter; bsc_nat_extract_lac(bsc, con, parsed, msg); if (imsi) diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_filter.c b/openbsc/src/osmo-bsc_nat/bsc_nat_filter.c index 6883d6692..393aea3ce 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_filter.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_filter.c @@ -41,7 +41,7 @@ int bsc_nat_filter_sccp_cr(struct bsc_connection *bsc, struct msgb *msg, int hdr48_len; int len; - *con_type = NAT_CON_TYPE_NONE; + *con_type = FLT_CON_TYPE_NONE; cause->cm_reject_cause = GSM48_REJECT_PLMN_NOT_ALLOWED; cause->lu_reject_cause = GSM48_REJECT_PLMN_NOT_ALLOWED; *imsi = NULL; diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c index 89212087c..d95227dca 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c @@ -403,13 +403,13 @@ struct gsm48_hdr *bsc_unpack_dtap(struct bsc_nat_parsed *parsed, } static const char *con_types [] = { - [NAT_CON_TYPE_NONE] = "n/a", - [NAT_CON_TYPE_LU] = "Location Update", - [NAT_CON_TYPE_CM_SERV_REQ] = "CM Serv Req", - [NAT_CON_TYPE_PAG_RESP] = "Paging Response", - [NAT_CON_TYPE_SSA] = "Supplementar Service Activation", - [NAT_CON_TYPE_LOCAL_REJECT] = "Local Reject", - [NAT_CON_TYPE_OTHER] = "Other", + [FLT_CON_TYPE_NONE] = "n/a", + [FLT_CON_TYPE_LU] = "Location Update", + [FLT_CON_TYPE_CM_SERV_REQ] = "CM Serv Req", + [FLT_CON_TYPE_PAG_RESP] = "Paging Response", + [FLT_CON_TYPE_SSA] = "Supplementar Service Activation", + [FLT_CON_TYPE_LOCAL_REJECT] = "Local Reject", + [FLT_CON_TYPE_OTHER] = "Other", }; const char *bsc_con_type_to_string(int type) @@ -423,18 +423,18 @@ int bsc_nat_msc_is_connected(struct bsc_nat *nat) } static const int con_to_ctr[] = { - [NAT_CON_TYPE_NONE] = -1, - [NAT_CON_TYPE_LU] = BCFG_CTR_CON_TYPE_LU, - [NAT_CON_TYPE_CM_SERV_REQ] = BCFG_CTR_CON_CMSERV_RQ, - [NAT_CON_TYPE_PAG_RESP] = BCFG_CTR_CON_PAG_RESP, - [NAT_CON_TYPE_SSA] = BCFG_CTR_CON_SSA, - [NAT_CON_TYPE_LOCAL_REJECT] = -1, - [NAT_CON_TYPE_OTHER] = BCFG_CTR_CON_OTHER, + [FLT_CON_TYPE_NONE] = -1, + [FLT_CON_TYPE_LU] = BCFG_CTR_CON_TYPE_LU, + [FLT_CON_TYPE_CM_SERV_REQ] = BCFG_CTR_CON_CMSERV_RQ, + [FLT_CON_TYPE_PAG_RESP] = BCFG_CTR_CON_PAG_RESP, + [FLT_CON_TYPE_SSA] = BCFG_CTR_CON_SSA, + [FLT_CON_TYPE_LOCAL_REJECT] = -1, + [FLT_CON_TYPE_OTHER] = BCFG_CTR_CON_OTHER, }; int bsc_conn_type_to_ctr(struct nat_sccp_connection *conn) { - return con_to_ctr[conn->con_type]; + return con_to_ctr[conn->filter_state.con_type]; } int bsc_write_cb(struct osmo_fd *bfd, struct msgb *msg) diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c index 596ecaee4..821e5226a 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c @@ -189,7 +189,7 @@ DEFUN(show_sccp, show_sccp_cmd, "show sccp connections", con->has_remote_ref, sccp_src_ref_to_int(&con->remote_ref), con->msc_endp, con->bsc_endp, - bsc_con_type_to_string(con->con_type), + bsc_con_type_to_string(con->filter_state.con_type), VTY_NEWLINE); } diff --git a/openbsc/src/osmo-bsc_nat/bsc_ussd.c b/openbsc/src/osmo-bsc_nat/bsc_ussd.c index 224189608..108241421 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_ussd.c +++ b/openbsc/src/osmo-bsc_nat/bsc_ussd.c @@ -382,7 +382,7 @@ int bsc_ussd_check(struct nat_sccp_connection *con, struct bsc_nat_parsed *parse * decode if the connection was created for USSD, we do have a USSD access * list, a query, a IMSI and such... */ - if (con->con_type != NAT_CON_TYPE_SSA) + if (con->filter_state.con_type != FLT_CON_TYPE_SSA) return 0; if (!con->filter_state.imsi) -- cgit v1.2.3