From: Cathryn Mataga <cathryn@junglevision.com>
To: linux-hams@vger.kernel.org
Cc: bernard.pidoux@upmic.fr
Subject: [PATCH] xfbbd: Fix issue with xfbbd and AX25 radio connections
Date: Sat, 13 Nov 2010 22:58:39 -0800 [thread overview]
Message-ID: <4CDF889F.8090709@junglevision.com> (raw)
In-Reply-To: <4CDF8714.70503@junglevision.com>
[-- Attachment #1: Type: text/plain, Size: 857 bytes --]
Patch versus version xfbbd version r11
Same patch file, Except I changed the email subject.
1. SOCK_MAXCHAN (drv_sock.c) now set to (MAXVOIES) This was set to 50, which was less than MAXVOIES, and the code was
accessing data off the end of this table. This was causing strange problems. After I made this change the gateway
function started working again. If anyone was having trouble with xfbbd and RF radio connections, this change may
possibly fix their problem.
2. Several minor changes designed to eliminate "Bad file descriptor" error messages. These occurred at the time
of housekeeping due to a minor bug. The messages actually turned out to be harmless, as far as I can tell.
3. Only use the signal handler for signals that have functionality in the code. This is a simplification
to prevent bugs. Other signals are set to SIG_IGN.
[-- Attachment #2: diff.patch --]
[-- Type: text/plain, Size: 2189 bytes --]
diff -ruN fbbsrc.704r11/src/drv_sock.c fbbsrc.704r11cathryn/src/drv_sock.c
--- fbbsrc.704r11/src/drv_sock.c 2010-06-22 13:03:01.000000000 -0700
+++ fbbsrc.704r11cathryn/src/drv_sock.c 2010-11-13 22:43:56.284120401 -0800
@@ -74,7 +74,8 @@
#define RETR_EVENT 3
#define BUSY_EVENT 4
-#define SOCK_MAXCAN 50
+#define SOCK_MAXCAN (MAXVOIES) /* was 50 -- this was causing bad problems.
+ This table was being accessed beyond the array */
#define CAN_AX25 0
#define CAN_NETROM 1
@@ -104,7 +105,7 @@
}
scan_t;
-scan_t scan[SOCK_MAXCAN];
+scan_t scan[SOCK_MAXCAN] = {{0}}; /* I think this is necessary (Though not 100% sure. */
static int last_can = 1;
static int msocket = -1;
@@ -692,8 +693,11 @@
static int stop_cnx (int port)
{
- close(p_port[port].fd);
- p_port[port].fd = 0;
+ if (p_port[port].fd) /* Prevent closing of 0 */
+ {
+ close(p_port[port].fd);
+ p_port[port].fd = 0;
+ }
return 1;
}
diff -ruN fbbsrc.704r11/src/drv_tcp.c fbbsrc.704r11cathryn/src/drv_tcp.c
--- fbbsrc.704r11/src/drv_tcp.c 2009-11-27 08:50:44.000000000 -0800
+++ fbbsrc.704r11cathryn/src/drv_tcp.c 2010-11-13 16:55:53.363119445 -0800
@@ -950,8 +950,11 @@
static int stop_cnx (int port)
{
- close(p_port[port].fd);
- p_port[port].fd = 0;
+ if (p_port[port].fd) /* Prevent closing of 0 */
+ {
+ close(p_port[port].fd);
+ p_port[port].fd = 0;
+ }
return 1;
}
@@ -1439,7 +1442,7 @@
fd_set tcp_excep;
struct timeval to;
- if (can->sock == -1)
+ if (can->sock <= 0) /* Was -1. Sock=0 during housekeeping. Cause of select errors */
return (0);
if ((can->timeout) && (can->timeout < time (NULL)))
diff -ruN fbbsrc.704r11/src/xfbbd.c fbbsrc.704r11cathryn/src/xfbbd.c
--- fbbsrc.704r11/src/xfbbd.c 2009-11-27 08:50:44.000000000 -0800
+++ fbbsrc.704r11cathryn/src/xfbbd.c 2010-11-13 17:10:40.879123108 -0800
@@ -195,7 +195,10 @@
{
if (i == SIGBUS || i == SIGSEGV || i == SIGALRM)
continue;
- signal (i, sig_fct);
+ else if (i == SIGHUP || i == SIGTERM || i == SIGBUS || i == SIGSEGV)
+ signal (i, sig_fct); /* Use sig_fct only for signals that do something */
+ else
+ signal (i, SIG_IGN); /* Otherwise ignore */
}
for (ng = 1; ng < ac; ng++)
next prev parent reply other threads:[~2010-11-14 6:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-27 12:33 [PATCH 4/11] drivers/net/hamradio: Eliminate a NULL pointer dereference Julia Lawall
2010-05-27 23:29 ` David Miller
2010-11-09 19:09 ` xfbbd oddness Cathryn Mataga
2010-11-10 2:54 ` Cathryn Mataga
2010-11-12 21:23 ` Cathryn Mataga
2010-11-14 6:52 ` Cathryn Mataga
2010-11-14 6:58 ` Cathryn Mataga [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-11-14 18:58 [PATCH] xfbbd: Fix issue with xfbbd and AX25 radio connections Bernard Pidoux
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=4CDF889F.8090709@junglevision.com \
--to=cathryn@junglevision.com \
--cc=bernard.pidoux@upmic.fr \
--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