🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #32322

nnrpd actived problems

#32322
From: Jean-Francois Stenuit
Date: Mon, 19 Oct 1998 00:00
101 lines
3845 bytes
This is an old bug for which I found a quite decent solution.

When using actived under certain OS (I noticed it on linux boxes), you
may end up in a situation like this :

actived listen on port 1119 on localhost.
nnrpd opens a connection (ask for a local port) to connect to this port
 and the system allocates 1119 as local port.

It makes a connection from localhost.1119 to localhost.1119 with, on the
same system a non blocking listen on localhost.1119. Not all systems
like this !

The result : error messages like :
create_udp_socket: bind: Address already in use

The solution lies in the following three patches (apply agains 2.1 inn
distribution) :
*** actived.c.orig      Tue Oct  6 18:25:34 1998
--- actived.c   Tue Oct  6 18:33:23 1998
***************
*** 160,166 ****
      ACTIVE = COPY(cpcatpath(innconf->pathdb, _PATH_ACTIVE));
      innconf->activedenable = 0;               /* This is the daemon */
  
!     if ((s = create_udp_socket(innconf->activedport)) < 0) {
        syslog(L_ERROR, "cant createudpsocket %m");
        exit(1);
      }
--- 160,166 ----
      ACTIVE = COPY(cpcatpath(innconf->pathdb, _PATH_ACTIVE));
      innconf->activedenable = 0;               /* This is the daemon */
  
!     if ((s = create_udp_socket(innconf->activedport,0)) < 0) {
        syslog(L_ERROR, "cant createudpsocket %m");
        exit(1);
      }
*** group.c.orig        Tue Oct  6 18:19:15 1998
--- group.c     Tue Oct  6 18:35:29 1998
***************
*** 467,473 ****
      struct timeval timeout;
  
      if (GRPactived < 0) {
!       if ((s = create_udp_socket(0)) < 0) {
            syslog(L_ERROR, "%s actived socket couldnt be created %m",
                                ClientHost);
            return(FALSE);
--- 467,476 ----
      struct timeval timeout;
  
      if (GRPactived < 0) {
!       /* On Linux, the obtained socket can have the same ID (IP+port)
*/
!       /* than the actived server. In that case, any future nnrpd will
*/
!       /* be unable to connect to actived.                            
*/
!       if ((s = create_udp_socket(0,innconf->activedport)) < 0) {
            syslog(L_ERROR, "%s actived socket couldnt be created %m",
                                ClientHost);
            return(FALSE);
*** udp.c.orig  Tue Oct  6 18:25:50 1998
--- udp.c       Tue Oct 13 13:14:47 1998
***************
*** 11,17 ****
  
  
  
! int create_udp_socket(int port)
  {
        int s;
        struct sockaddr_in sin;
--- 11,17 ----
  
  
  
! int create_udp_socket(int port, int portexclude)
  {
        int s;
        struct sockaddr_in sin;
***************
*** 29,34 ****
--- 29,38 ----
        }
        if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
                /* perror("create_udp_socket: bind"); */
+               return(-1);
+       }
+       if (sin.sin_port == htons(portexclude)) {
+               close(s);
                return(-1);
        }
        return(s);

--
Jean-Francois "Jef" Stenuit
Network manager
Belgacom Skynet

Technical Details
Message-ID: <362B0DBE.5FFB@skynet.i8spam.be>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <362B0DBE.5FFB@skynet.i8spam.be>
Subject: nnrpd actived problems
Date: Mon, 19 Oct 1998 00:00:00 +0000
From: Jean-Francois Stenuit <jfs@skynet.i8spam.be>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 402600540
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@skynet.be
X-Trace: news0.skynet.be 908748075 5598 195.238.1.80 (18 Oct 1998 22:01:15 GMT)
Organization: Belgacom-skynet SA/NV
Mime-Version: 1.0
NNTP-Posting-Date: 18 Oct 1998 22:01:15 GMT
Newsgroups: news.software.nntp