aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-23 00:23:03 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-04-23 00:23:03 +0800
commit52ae9a461b10abeb0e2041dc3fb900465ecb2da3 (patch)
treed7104e4ecaaab664a35e10c43744cccd2454c55f
parent5bd9493257ee3a43d36c0be5f23ac05a2459694b (diff)
nat: When having a proper close down, or a short read close the connection
For now close the connection when having a short read. This might be due a network issue (loss of segment) or similiar. As we are not handling these issues well, let us close the connection.
-rw-r--r--openbsc/src/nat/bsc_nat.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c
index 6b29d16a3..d5ed7515b 100644
--- a/openbsc/src/nat/bsc_nat.c
+++ b/openbsc/src/nat/bsc_nat.c
@@ -383,13 +383,12 @@ static int ipaccess_msc_read_cb(struct bsc_fd *bfd)
struct ipaccess_head *hh;
if (!msg) {
- if (error == 0) {
+ if (error == 0)
LOGP(DNAT, LOGL_FATAL, "The connection the MSC was lost, exiting\n");
- bsc_msc_lost(msc_con);
- return -1;
- }
+ else
+ LOGP(DNAT, LOGL_ERROR, "Failed to parse ip access message: %d\n", error);
- LOGP(DNAT, LOGL_ERROR, "Failed to parse ip access message: %d\n", error);
+ bsc_msc_lost(msc_con);
return -1;
}
@@ -600,12 +599,12 @@ static int ipaccess_bsc_read_cb(struct bsc_fd *bfd)
struct msgb *msg = ipaccess_read_msg(bfd, &error);
if (!msg) {
- if (error == 0) {
+ if (error == 0)
LOGP(DNAT, LOGL_ERROR, "The connection to the BSC was lost. Cleaning it\n");
- remove_bsc_connection(bsc);
- } else {
+ else
LOGP(DNAT, LOGL_ERROR, "Failed to parse ip access message: %d\n", error);
- }
+
+ remove_bsc_connection(bsc);
return -1;
}