summaryrefslogtreecommitdiffstats
path: root/openbsc/src/nat/bsc_nat.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-10-21 12:12:57 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-10-27 10:40:44 +0200
commita914daf174e9d1a78bdccb1d5bd8b69ec8ff2280 (patch)
treeeb55e9100cd4c241d11e5d3ded22913b927a3341 /openbsc/src/nat/bsc_nat.c
parent76424392e08fcea56e665295830a9fdcc6dba5b5 (diff)
nat: Add hook for rewriting a setup message
Create a new function, hand the data to this function, take back a possible modified msgb and invalidate parsed at this point.
Diffstat (limited to 'openbsc/src/nat/bsc_nat.c')
-rw-r--r--openbsc/src/nat/bsc_nat.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c
index daabf0976..dcacfb9ab 100644
--- a/openbsc/src/nat/bsc_nat.c
+++ b/openbsc/src/nat/bsc_nat.c
@@ -858,6 +858,15 @@ static int forward_sccp_to_msc(struct bsc_connection *bsc, struct msgb *msg)
/* hand data to a side channel */
if (bsc_check_ussd(con, parsed, msg) == 1)
con->con_local = 2;
+
+ /*
+ * Optionally rewrite setup message. This can
+ * replace the msg and the parsed structure becomes
+ * invalid.
+ */
+ msg = bsc_nat_rewrite_setup(bsc->nat, msg, parsed);
+ talloc_free(parsed);
+ parsed = NULL;
}
con_bsc = con->bsc;
@@ -913,7 +922,8 @@ static int forward_sccp_to_msc(struct bsc_connection *bsc, struct msgb *msg)
/* send the non-filtered but maybe modified msg */
queue_for_msc(con_msc, msg);
- talloc_free(parsed);
+ if (parsed)
+ talloc_free(parsed);
return 0;
exit: