[PATCH 04/11] ipaccess: more robust error handle in receival path

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

pablo at gnumonks.org pablo at gnumonks.org
Wed Aug 22 15:04:46 UTC 2012


From: Pablo Neira Ayuso <pablo at gnumonks.org>

If we hit any error in the receival path of the ipaccess input
driver, then better spot an error containing the reason and close
the socket to start over.
---
 src/input/ipaccess.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 44a5a59..31b8f04 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -387,9 +387,13 @@ static int handle_ts1_read(struct osmo_fd *bfd)
 	int ret = 0, error;
 
 	error = ipa_msg_recv(bfd->fd, &msg);
-	if (error < 0)
+	if (error < 0) {
+		if (ipaccess_drop(bfd) >= 0) {
+			LOGP(DLINP, LOGL_NOTICE, "Sign link problems, "
+			"closing socket. Reason: %s\n", strerror(errno));
+		}
 		return error;
-	else if (error == 0) {
+	} else if (error == 0) {
 		if (ipaccess_drop(bfd) >= 0) {
 			LOGP(DLINP, LOGL_NOTICE, "Sign link vanished, "
 						"dead socket\n");
-- 
1.7.10.4





More information about the OpenBSC mailing list