Package: mbmon
Version: 2.05-2

When 'mbmon' is started in TCP server mode, it does not set the
SO_REUSEADDR option on the socket. This makes it impossible to restart
the server until TIME_WAIT has expired if the previous incarnation has
handled any connections.

# mbmon -P 11000
# nc localhost 11000
Temp.= 29.0, 31.6,  0.0; Rot.= 4470,    0,    0
Vcore = 1.70, 1.70; Volt. = 3.47, 5.13, 11.31, -12.13, -5.02
# ps -ef | grep -i mbmon
root      2340     1  0 21:12 ?        00:00:00 mbmon -P 11000
# kill -TERM 2340
# # mbmon -P 11000 
bind: Address already in use
#

Patch:
----------------------------------------------------------------------
diff -Naur xmbmon-2.05.old/mbmon.c xmbmon-2.05/mbmon.c
--- xmbmon-2.05.old/mbmon.c     2004-08-13 07:23:32.000000000 +0000
+++ xmbmon-2.05/mbmon.c 2005-06-05 01:47:13.000000000 +0000
@@ -304,6 +304,7 @@
        int sh_flag = 0;
        int integer_flag = 0;
        int tagval_flag = 0 ;
+       int true = 1;
 
 #ifdef LOGGING
        int nfd = 0;
@@ -455,6 +456,11 @@
                        perror("socket");
                        exit (1);
                }
+
+               if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *) &true, 
sizeof(true)) == -1) {
+                       perror("setsockopt");
+               }
+
                server.sin_family = AF_INET;
                server.sin_port = htons (port);
                server.sin_addr.s_addr = INADDR_ANY;
----------------------------------------------------------------------

-- 
))))/  Patrick (L.) Bernier         GPG DSA key fingerprint:     /(
)))/   [EMAIL PROTECTED], [EMAIL PROTECTED]    CB65 9634 BAB0 0122 86B1    /((
))/    http://www.TZoNE.ORG/~pat/   5AD5 9970 4BDA 66DC 1B23   /(((
)/     "Words have meaning, and names have power." -- Lorien  /((((


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to