diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-06-15 18:51:49 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-06-15 20:24:18 +0800 |
commit | c14e09bb2d32d80a3cd2df74546d46ddda410c9b (patch) | |
tree | aeba03a88a8b0cab196f7941429e527bad68a375 /openbsc | |
parent | aad82ce7ea342e7824cea1afa9ef523582a97001 (diff) |
nat: Store the creation time of a sccp connection.
Generate it when creating the connection but also when
reusing an existing connection.
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/include/openbsc/bsc_nat.h | 3 | ||||
-rw-r--r-- | openbsc/src/nat/bsc_sccp.c | 3 | ||||
-rw-r--r-- | openbsc/tests/bsc-nat/Makefile.am | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h index 4be7e3a67..61df38930 100644 --- a/openbsc/include/openbsc/bsc_nat.h +++ b/openbsc/include/openbsc/bsc_nat.h @@ -120,6 +120,9 @@ struct sccp_connections { int crcx; int msc_timeslot; int bsc_timeslot; + + /* timeout handling */ + struct timespec creation_time; }; /** diff --git a/openbsc/src/nat/bsc_sccp.c b/openbsc/src/nat/bsc_sccp.c index 344953167..59e19bc28 100644 --- a/openbsc/src/nat/bsc_sccp.c +++ b/openbsc/src/nat/bsc_sccp.c @@ -28,6 +28,7 @@ #include <osmocore/talloc.h> #include <string.h> +#include <time.h> static int equal(struct sccp_source_reference *ref1, struct sccp_source_reference *ref2) { @@ -101,6 +102,7 @@ int create_sccp_src_ref(struct bsc_connection *bsc, struct msgb *msg, struct bsc talloc_free(conn); return -1; } else { + clock_gettime(CLOCK_MONOTONIC, &conn->creation_time); bsc_mgcp_dlcx(conn); return 0; } @@ -114,6 +116,7 @@ int create_sccp_src_ref(struct bsc_connection *bsc, struct msgb *msg, struct bsc } conn->bsc = bsc; + clock_gettime(CLOCK_MONOTONIC, &conn->creation_time); conn->real_ref = *parsed->src_local_ref; if (assign_src_local_reference(&conn->patched_ref, bsc->nat) != 0) { LOGP(DNAT, LOGL_ERROR, "Failed to assign a ref.\n"); diff --git a/openbsc/tests/bsc-nat/Makefile.am b/openbsc/tests/bsc-nat/Makefile.am index 05682630f..57615302a 100644 --- a/openbsc/tests/bsc-nat/Makefile.am +++ b/openbsc/tests/bsc-nat/Makefile.am @@ -13,4 +13,4 @@ bsc_nat_test_SOURCES = bsc_nat_test.c \ $(top_srcdir)/src/mgcp/mgcp_protocol.c \ $(top_srcdir)/src/mgcp/mgcp_network.c \ $(top_srcdir)/src/bssap.c -bsc_nat_test_LDADD = $(top_builddir)/src/libbsc.a $(top_builddir)/src/libsccp.a $(LIBOSMOCORE_LIBS) +bsc_nat_test_LDADD = $(top_builddir)/src/libbsc.a $(top_builddir)/src/libsccp.a $(LIBOSMOCORE_LIBS) -lrt |