Linux HAM/Amateur Radio development
 help / color / mirror / Atom feed
From: 9a4gl@9a0tcp.ampr.org (Tihomir Heidelberg)
To: linux-hams@vger.kernel.org
Subject: libax25 axio_flush bug hangs node and fix
Date: Tue, 15 Oct 02 11:52:11 CEST	[thread overview]
Message-ID: <13346@9A0TCP> (raw)

Hi

I noticed that my awznode (a variant of linux node) hangs and 
use maximum CPU when user starts any external command and 
incoming AX.25 connection get broken.

After tracing found something strange in libax25-0.0.10 in 
ax25io.c.

In function static int flush_obuf(ax25io *p)
it returns -1 if write to output file descriptor failed
if ((ret = write(p->ofd, p->obuf, p->optr < p->paclen ? p->optr : p->paclen)) < 0)
return -1

but, in axio_flush(ax25io *p)
we have following loop:
while (p->optr) {
                FD_ZERO(&fdset);
                FD_SET(p->ofd, &fdset);   
                if (select(p->ofd+1, NULL, &fdset, NULL, NULL)<0)
                        return -1;
		flushed+=flush_obuf(p);
                flushed+=j;
}
it is obvious that this loop will never end if above mentioned write
failed. After breaking this loop if flush_obuf returns -1 my awnnode
does not hangs.

Can maintainer of libax25 fix this in next release ?

73 de Tihomir Heidelberg, 9a4gl@9a0tcp.ampr.org

             reply	other threads:[~2002-10-15  9:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-15  9:52 Tihomir Heidelberg [this message]
2002-10-15 18:22 ` libax25 axio_flush bug hangs node and fix Paul Lewis
2002-10-15 19:58   ` Tihomir Heidelberg
2002-10-16  3:21 ` Craig Small
2002-10-16 12:56   ` Tomi Manninen OH2BNS
2002-10-17  7:46     ` Kjell Jarl
2002-10-17 13:41       ` Tomi Manninen
2002-10-17 18:41         ` Kjell Jarl
2002-10-17 19:17           ` Jeroen Vreeken

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=13346@9A0TCP \
    --to=9a4gl@9a0tcp.ampr.org \
    --cc=linux-hams@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox