Ax25d patch

From Tučňák Wiki
Revision as of 10:33, 3 January 2010 by Ok1zia (talk | contribs)
Jump to navigation Jump to search

On OK0NAG, the ax25 after some days crashed. In this article you can find workaround.

Ax25d exited with these lines in /var/log/syslog:

Dec 30 23:49:07 nagano ax25d[680]: AX.25 OK1HMP-0 (ax0) client
Dec 30 23:49:07 nagano ax25d[718]: AX.25 OK1HMP-0 (ax0) client
Dec 30 23:49:07 nagano ax25d[17984]: accept error Software caused connection abort, closing socket on port ax0

I looked into source code and found this code:

               i = TRUE;
               ioctl(paxl->fd, FIONBIO, &i);

               addrlen = sizeof(struct full_sockaddr_ax25);
               new = accept(paxl->fd, (struct sockaddr *)&sockaddr, &addrlen);

               i = FALSE;
               ioctl(paxl->fd, FIONBIO, &i);

               if (new < 0) {
                   if (errno == EWOULDBLOCK)
                       continue;   /* It's gone ??? */

                   if (Logging)
                       syslog(LOG_ERR, "accept error %m, closing socket on port %s", paxl->port);
                   close(paxl->fd);
                   paxl->fd = -1;
                   continue;
               }

Problem is in accept, which returns error. I don't know why. I think If I would ignore it, the deamon can stay in endless loop. I've found (hopefully) better solution - the daemon will not fork. When this error occurs, it exites and will be respawned again. It must be removed from init scripts:

update-rc.d -f ax25d remove

Simplest way to respawn it is init. Add similar line to /etc/inittab:

9:23:respawn:/usr/bin/zax25d -l -n

And tell about change:

telinit q

Check if process is running:

# ps xa|grep ax25
19018 ?        Ss     0:00 /usr/bin/ax25d -l -n

Patched source is here: File:Ax25d-zia.c