• IPv6 Patch

    From Tommi Koivula@2:221/360 to All on Thu Dec 5 09:46:01 2019
    =============================================================================
    * Forwarded by Tommi Koivula (2:221/360)
    * Area : UTF-8 (Fidonet - !!!)
    * From : Konstantin Kuzov, 2:5019/40.1 (Monday March 13 2017 13:19)
    * To : Kees van Eeten
    * Subj : Poetry for who can read it. ============================================================================= Greetings, Kees!

    With that done the next challenge is to get the reverse route
    going, as well as making smapinntpd IPv6 aware.

    Dunno if we need to go to IPV6 echo... But porting to ipv6 is pretty trivial: =====================================================================
    diff -urN ganjanntpd-1.9/main.c ganjanntpd-1.9-ipv6/main.c
    -+- ganjanntpd-1.9/main.c 2017-02-27 23:41:23.000000000 +0300
    +++ ganjanntpd-1.9-ipv6/main.c 2017-03-13 12:59:42.872717283 +0300
    @@ -223,16 +223,6 @@

    cfg_logfile=argv[++c];
    }
    - else if(stricmp(arg,"-ip")==0 || stricmp(arg,"-ipaddress")==0)
    - {
    - if(c+1 == argc)
    - {
    - printf("Missing argument for %s%s\n",argv[c],src);
    - return(FALSE);
    - }
    -
    - cfg_ipaddr=argv[++c];
    - }
    else if(stricmp(arg,"-config")==0)
    {
    if(filename)
    @@ -359,7 +349,6 @@
    fprintf(fp,"users \"%s\"\n",cfg_usersfile);
    fprintf(fp,"xlat \"%s\"\n",cfg_xlatfile);
    fprintf(fp,"hostname \"%s\"\n",cfg_hostname);
    - fprintf(fp,"ipaddress \"%s\"\n",cfg_ipaddr);
    fprintf(fp,"logfile \"%s\"\n",cfg_logfile);
    fprintf(fp,"%snoecholog\n",cfg_noecholog ? "" : "#");
    fprintf(fp,"%sdebug\n",cfg_debug ? "" : "#");
    @@ -401,7 +390,7 @@
    {
    SOCKET sock;
    int error,res;
    - struct sockaddr_in local;
    + struct sockaddr_in6 local;
    fd_set fds;
    struct timeval tv;
    FILE *fp;
    @@ -501,7 +490,7 @@
    exit(10);
    }

    - sock = socket(PF_INET,SOCK_STREAM,IPPROTO_TCP);
    + sock = socket(PF_INET6,SOCK_STREAM,IPPROTO_TCP);

    if(sock == INVALID_SOCKET)
    {
    @@ -518,9 +507,8 @@

    memset(&local, 0, sizeof(local) );

    - local.sin_family = AF_INET;
    - local.sin_addr.s_addr = (cfg_ipaddr && strcmp(cfg_ipaddr,"0.0.0.0") != 0) ?
    inet_addr(cfg_ipaddr) : INADDR_ANY;
    - local.sin_port = htons(cfg_port);
    + local.sin6_family = AF_INET6;
    + local.sin6_port = htons(cfg_port);

    error = bind(sock,(struct sockaddr *)&local,sizeof(local));

    @@ -550,7 +538,7 @@
    exit(10);
    }

    - os_logwrite(SERVER_NAME " " SERVER_VERSION " is running on %s:%d",cfg_ipaddr,cfg_port);
    + os_logwrite(SERVER_NAME " " SERVER_VERSION " is running on port %d",cfg_port);

    if(cfg_debug)
    os_logwrite("Compiled " __DATE__ " " __TIME__);
    diff -urN ganjanntpd-1.9/nntpserv.c ganjanntpd-1.9-ipv6/nntpserv.c
    -+- ganjanntpd-1.9/nntpserv.c 2017-03-10 09:54:41.000000000 +0300
    +++ ganjanntpd-1.9-ipv6/nntpserv.c 2017-03-13 13:01:18.239794707 +0300
    @@ -15,7 +15,6 @@

    uchar *cfg_allowfile = CFG_ALLOWFILE;
    uchar *cfg_groupsfile = CFG_GROUPSFILE;
    -uchar *cfg_ipaddr = CFG_IPADDR;
    uchar *cfg_logfile = CFG_HOSTNAME;
    uchar *cfg_usersfile = CFG_USERSFILE;
    uchar *cfg_xlatfile = CFG_XLATFILE;
    @@ -3093,8 +3092,8 @@
    struct var var;

    struct hostent *hostent;
    - struct sockaddr_in fromsa;
    - int fromsa_len = sizeof(struct sockaddr_in);
    + struct sockaddr_in6 fromsa;
    + int fromsa_len = sizeof(struct sockaddr_in6);

    os_getexclusive();
    server_openconnections++;
    @@ -3156,16 +3155,16 @@
    return;
    }

    - sprintf(var.clientid,"%s:%u",inet_ntoa(fromsa.sin_addr),ntohs(fromsa.sin_port));
    + inet_ntop(AF_INET6, &fromsa.sin6_addr, lookup, sizeof(lookup));

    - mystrncpy(lookup,inet_ntoa(fromsa.sin_addr),200);
    + snprintf(var.clientid,200,"%s:%u",lookup,ntohs(fromsa.sin6_port));

    - if((hostent=gethostbyaddr((char *)&fromsa.sin_addr,sizeof(fromsa.sin_addr),AF_INET)))
    + if((hostent=gethostbyaddr((char *)&fromsa.sin6_addr,sizeof(fromsa.sin6_addr),AF_INET6)))
    mystrncpy(lookup,hostent->h_name,200);

    os_logwrite("(%s) Connection established to %s",var.clientid,lookup);

    - if(!checkallow(&var,inet_ntoa(fromsa.sin_addr)))
    + if(!checkallow(&var,lookup))
    {
    socksendtext(&var,"502 Access denied." CRLF);
    os_logwrite("(%s) Access denied (not in allow list)",var.clientid);
    diff -urN ganjanntpd-1.9/nntpserv.h ganjanntpd-1.9-ipv6/nntpserv.h
    -+- ganjanntpd-1.9/nntpserv.h 2017-02-27 23:15:13.000000000 +0300
    +++ ganjanntpd-1.9-ipv6/nntpserv.h 2017-03-13 12:59:11.824692072 +0300
    @@ -108,7 +108,6 @@
    #define CFG_LOGFILE LOG_BASEPATH "ganjanntpd.log"

    #define CFG_HOSTNAME "GaNJaNNTPd!not-for-mail"
    -#define CFG_IPADDR "0.0.0.0"

    #define CFG_DEF_FLOWED TRUE
    #define CFG_DEF_SHOWTO TRUE
    @@ -118,7 +117,6 @@
    extern uchar *cfg_allowfile;
    extern uchar *cfg_groupsfile;
    extern uchar *cfg_hostname;
    -extern uchar *cfg_ipaddr;
    extern uchar *cfg_logfile;
    extern uchar *cfg_usersfile;
    extern uchar *cfg_xlatfile; =====================================================================

    And make sure sysctl net.ipv6.bindv6only=0 for ipv4 to work as well.

    -+- Claws Mail 3.14.0 (GTK+ 2.24.30; x86_64-pc-linux-gnu)
    + Origin: Via 2:5019/40 NNTP (GaNJaNET STaTi0N, Smolensk) (2:5019/40.1) =============================================================================

    'Tommi

    ---
    * Origin: 2001:470:1f15:cb0:f1d0:2:221:360 (2:221/360)
  • From Fabio Bizzi@2:335/364.1 to Tommi Koivula on Thu Dec 5 09:48:58 2019
    Hello Tommi!

    05 Dec 19 09:46, you wrote to All:

    ====================================================================== ======= * Forwarded by Tommi Koivula (2:221/360) * Area : UTF-8
    (Fidonet - !!!) * From : Konstantin Kuzov, 2:5019/40.1 (Monday March
    13 2017 13:19) * To : Kees van Eeten * Subj : Poetry for who can
    read it. ====================================================================== ======= Greetings, Kees!

    Many thanks! :)
    I'll try it as soon as I can.

    Ciao!
    Fabio

    --- GoldED+/LNX 1.1.5-b20180707
    * Origin: ]\/[imac Rebirth Boss Point (2:335/364.1)
  • From Fabio Bizzi@2:335/364.1 to Tommy Koivoula on Thu Dec 5 10:27:32 2019
    Hello Tommy!

    05 Dec 19 09:48, I wrote to Tommi Koivula:

    Many thanks! :)
    I'll try it as soon as I can.

    My jamnntpd-1.3 sources differ from the ones the patch would be applied.
    I'll try to see if with a manual editing I can apply the relevant changes.

    Ciao!
    Fabio

    --- GoldED+/LNX 1.1.5-b20180707
    * Origin: ]\/[imac Rebirth Boss Point (2:335/364.1)
  • From Oli@2:280/464.47 to Fabio Bizzi on Thu Dec 5 10:53:26 2019
    On Thu, 5 Dec 2019 10:27:32 +0100
    "Fabio Bizzi -> Tommy Koivoula" <1@364.335.2> wrote:

    Hello Tommy!

    05 Dec 19 09:48, I wrote to Tommi Koivula:

    Many thanks! :)
    I'll try it as soon as I can.

    My jamnntpd-1.3 sources differ from the ones the patch would be
    applied. I'll try to see if with a manual editing I can apply the
    relevant changes.

    It shouldn't be too hard, there are only a few changes. Most of the lines in the patch deal with cfg_ipaddr which can be ignored, because it's not in Jamnntpd 1.3.

    If you are successful, it would be cool if you could share the diff and maybe we could get it into the jamnntpd repo.

    ---
    * Origin: (2:280/464.47)
  • From Fabio Bizzi@2:335/364.1 to Tommi Koivula on Thu Dec 5 10:52:32 2019
    Hello Tommi!

    05 Dec 19 10:27, I wrote to Tommy Koivoula:

    05 Dec 19 09:48, I wrote to Tommi Koivula:

    Many thanks! :)
    I'll try it as soon as I can.

    My jamnntpd-1.3 sources differ from the ones the patch would be
    applied. I'll try to see if with a manual editing I can apply the
    relevant changes.

    I've applyied the differences, the server starts and the client connect to the server in ipv6 without problems but no message is retrived by the client. :(

    I think that I've to ask you the kindness to provide me the full source package. :)

    Thank you.

    Ciao!
    Fabio

    --- GoldED+/LNX 1.1.5-b20180707
    * Origin: ]\/[imac Rebirth Boss Point (2:335/364.1)
  • From Tommi Koivula@2:221/0 to Fabio Bizzi on Thu Dec 5 14:07:04 2019
    On 05.12.2019 10:52, Fabio Bizzi - Tommi Koivula wrote:

    I've applyied the differences, the server starts and the client
    connect to the server in ipv6 without problems but no message is
    retrived by the client. :(

    I think that I've to ask you the kindness to provide me the full
    source package. :)
    I'll check my changes compared to 1.3 and then decide if it can be published.

    'Tommi

    ---
    * Origin: nntp://rpi.rbb.bbs.fi (2:221/0)