From 32b610a198d65d9e9bc2debddaa348dc231d1759 Mon Sep 17 00:00:00 2001 From: Thomas Osterried Date: Sun, 15 Sep 2013 16:16:41 +0200 Subject: Fix accidental termination of ax25ipd. ax25ipd sometimes terminated ("normaly") when the remote site (or a router on the way) sent an icmp unreachable. That's a problem with a positive error list (where every unknown error is interpreted as major problem); this makes the code unstable whenever new errno's are implemented in newer kernels.. Signed-off-by: Thomas Osterried --- ax25ipd/io.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ax25ipd/io.c b/ax25ipd/io.c index 4277612..a293d69 100644 --- a/ax25ipd/io.c +++ b/ax25ipd/io.c @@ -620,6 +620,16 @@ int io_error( fprintf (stderr, "message was %d bytes long.\n", bufsize); return 0; } + if (errno == ENETDOWN || errno == ENETRESET || + errno == ENETUNREACH || errno == EHOSTDOWN || + errno == EHOSTUNREACH || errno == ENONET || + errno == EPERM) { + /* host closed his axip receiver or dropped the line */ + perror("error after sending on to axip partner. ignoring."); + LOGL4("error after sending on to axip partner: %s; ignoring!\n", strerror(errno)); + + return 0; + } if (errno == ENOBUFS) { /* congestion; sleep + retry */ LOGL4("send congestion on raw ip, sleeping and retrying!\n"); usleep(100000); @@ -638,6 +648,16 @@ int io_error( fprintf(stderr, "message was %d bytes long.\n", bufsize); return 0; } + if (errno == ENETDOWN || errno == ENETRESET || + errno == ENETUNREACH || errno == EHOSTDOWN || + errno == EHOSTUNREACH || errno == ENONET || + errno == EPERM) { + /* host closed his axudp receiver or dropped the line */ + perror("error after sending to axudp partner. ignoring."); + LOGL4("error after sending to axudp partner: %s; ignoring!\n", strerror(errno)); + + return 0; + } if (errno == ENOBUFS) { /* congestion; sleep + retry */ LOGL4("send congestion on udp, sleeping and retrying!\n"); usleep(100000); -- cgit v1.2.3