Subject: pkg/23430: pkgsrc/irssi won't DCC send (Protocol not supported)
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <adam@lebsack.com>
List: netbsd-bugs
Date: 11/14/2003 04:07:55
>Number:         23430
>Category:       pkg
>Synopsis:       pkgsrc/irssi won't DCC send (Protocol not supported)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 14 04:08:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Adam Lebsack
>Release:        1.6.1_STABLE
>Organization:
Xtreme Integration
>Environment:
NetBSD becks.XxXxX 1.6.1_STABLE NetBSD 1.6.1_STABLE (SPARCS) #3: Tue Sep 16 09:21:32 MDT 2003     adam@molson:/amd/killians/home/adam/Sandbox/netbsd/kernel/SPARCS sparc
>Description:
When initiating a DCC SEND with irssi, it fails to listen on a socket, reporting error "Protocol not supported".
>How-To-Repeat:
see description
>Fix:
put this patch into pkgsrc/irssi/patches .  I made it by looking at irssi.org's CVS changes (from 7/9/03): patch-af:

--- src/core/network.c.orig     Thu Nov 13 20:17:19 2003
+++ src/core/network.c
@@ -51,6 +51,11 @@
 /* Cygwin need this, don't know others.. */
 /*#define BLOCKING_SOCKETS 1*/

+IPADDR ip4_any = {
+       AF_INET,
+       { INADDR_ANY }
+};
+       
 int net_ip_compare(IPADDR *ip1, IPADDR *ip2)
 {
        if (ip1->family != ip2->family)
--- src/core/network.h.orig     Mon Aug 26 13:45:07 2002
+++ src/core/network.h
@@ -39,6 +39,8 @@

 #define IPADDR_IS_V6(ip) ((ip)->family != AF_INET)

+extern IPADDR ip4_any;
+
 /* returns 1 if IPADDRs are the same */
 int net_ip_compare(IPADDR *ip1, IPADDR *ip2);

--- src/irc/dcc/dcc.c.orig      Wed Nov 13 06:10:02 2002
+++ src/irc/dcc/dcc.c
@@ -208,7 +208,10 @@
        if (first == 0) {
                 /* random port */
                *port = 0;
-               return net_listen(NULL, port);
+               if (IPADDR_IS_V6(ip))
+                       return net_listen(NULL, port);
+               else
+                       return net_listen(&ip4_any, port);
        }

         /* get last port */
@@ -226,7 +229,10 @@

         /* use the first available port */
        for (*port = first; *port <= last; (*port)++) {
-               handle = net_listen(NULL, port);
+               if (IPADDR_IS_V6(ip))
+                       handle = net_listen(NULL, port);
+               else
+                       handle = net_listen(&ip4_any, port);
                if (handle != NULL)
                         return handle;
        }
>Release-Note:
>Audit-Trail:
>Unformatted: