🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
1 messages
1 total messages Started by Jean-Francois Stenuit Mon, 19 Oct 1998 00:00
nnrpd actived problems
#32322
Author: 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

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads