Subject: pkg/32197: pkgsrc/www/http_load source ip problem
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <pavalos@theshell.com>
List: pkgsrc-bugs
Date: 11/30/2005 10:07:00
>Number:         32197
>Category:       pkg
>Synopsis:       pkgsrc/www/http_load source ip problem
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 30 10:07:00 +0000 2005
>Originator:     Peter Avalos
>Release:        DragonFly
>Organization:
>Environment:
DragonFly box.theshell.com 1.3.7-DEVELOPMENT DragonFly 1.3.7-DEVELOPMENT #3: Tue Nov 29 13:59:03 MST 2005     root@box.theshell.com:/usr/obj/usr/src/sys/BOX  i386

>Description:
http_load's -sip option does not work, because it does not use the Internet family when it tries to bind to the source address.
>How-To-Repeat:
Try using the -sip option with http_load.
>Fix:
I'm using the web ineterface, so I'm not sure if this is going to be munged or not...

Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/www/http_load/distinfo,v
retrieving revision 1.5
diff -u -r1.5 distinfo
--- distinfo    24 Feb 2005 14:08:32 -0000      1.5
+++ distinfo    30 Nov 2005 09:57:02 -0000
@@ -4,4 +4,4 @@
 RMD160 (http_load-04jan2002.tar.gz) = dc0986091b1f1819100c24503a58a57978deba38
 Size (http_load-04jan2002.tar.gz) = 16710 bytes
 SHA1 (patch-aa) = a5303abf65e48825607d47d6d519c24b28a42718
-SHA1 (patch-ab) = b10f08ce3f09d8518415f4735aad2ca8bd53de3b
+SHA1 (patch-ab) = 62ffbfd2553eb53db7d1d48cbc2cc01dd051a300
Index: patches/patch-ab
===================================================================
RCS file: /cvsroot/pkgsrc/www/http_load/patches/patch-ab,v
retrieving revision 1.1
diff -u -r1.1 patch-ab
--- patches/patch-ab    4 Aug 2004 12:21:02 -0000       1.1
+++ patches/patch-ab    30 Nov 2005 09:57:02 -0000
@@ -1,8 +1,8 @@
-$NetBSD: patch-ab,v 1.1 2004/08/04 12:21:02 cube Exp $
+$NetBSD$

---- http_load.c.orig   2002-01-04 22:20:46.000000000 +0100
-+++ http_load.c
-@@ -655,11 +655,11 @@ lookup_address( int url_num )
+--- http_load.c.orig   2002-01-04 14:20:46.000000000 -0700
++++ http_load.c        2005-11-30 02:47:36.000000000 -0700
+@@ -655,11 +655,11 @@
      (void) memset( &hints, 0, sizeof(hints) );
      hints.ai_family = PF_UNSPEC;
      hints.ai_socktype = SOCK_STREAM;
@@ -17,7 +17,7 @@
            gai_strerror( gaierr ) );
        exit( 1 );
        }
-@@ -689,7 +689,7 @@ lookup_address( int url_num )
+@@ -689,7 +689,7 @@
            {
            (void) fprintf(
                stderr, "%s - sockaddr too small (%lu < %lu)\n",
@@ -26,7 +26,7 @@
                (unsigned long) sizeof(urls[url_num].sa),
                (unsigned long) aiv4->ai_addrlen );
            exit( 1 );
-@@ -708,7 +708,7 @@ lookup_address( int url_num )
+@@ -708,7 +708,7 @@
            {
            (void) fprintf(
                stderr, "%s - sockaddr too small (%lu < %lu)\n",
@@ -35,7 +35,7 @@
                (unsigned long) sizeof(urls[url_num].sa),
                (unsigned long) aiv6->ai_addrlen );
            exit( 1 );
-@@ -724,15 +724,15 @@ lookup_address( int url_num )
+@@ -724,15 +724,15 @@

      (void) fprintf(
        stderr, "%s: no valid address found for host %s\n", argv0,
@@ -54,3 +54,14 @@
        exit( 1 );
        }
      urls[url_num].sock_family = urls[url_num].sa.sin_family = he->h_addrtype;
+@@ -779,6 +779,10 @@
+       /* Add to table. */
+       sips[num_sips].str = strdup_check( line );
+       (void) memset( (void*) &sips[num_sips].sa, 0, sizeof(sips[num_sips].sa) );
++
++      /* Initialize for Internet family */
++      sips[num_sips].sa.sin_family = AF_INET;
++
+       if ( ! inet_aton( sips[num_sips].str, &sips[num_sips].sa.sin_addr ) )
+           {
+           (void) fprintf(