From tspivey@pcdesk.net  Thu Apr 26 17:34:45 2007
Return-Path: <tspivey@pcdesk.net>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 6713916A401
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 26 Apr 2007 17:34:45 +0000 (UTC)
	(envelope-from tspivey@pcdesk.net)
Received: from pcdesk.net (ns.pcdesk.net [65.100.173.137])
	by mx1.freebsd.org (Postfix) with ESMTP id 40B5B13C46E
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 26 Apr 2007 17:34:45 +0000 (UTC)
	(envelope-from tspivey@pcdesk.net)
Received: from localhost ([::ffff:192.94.73.4])
  (AUTH: LOGIN tspivey@pcdesk.net)
  by pcdesk.net with esmtp; Thu, 26 Apr 2007 10:52:47 -0600
  id 0043A690.4630D8E0.00003BDF
Message-Id: <20070426173445.40B5B13C46E@mx1.freebsd.org>
Date: Thu, 26 Apr 2007 17:34:45 +0000 (UTC)
From: Tyler Spivey <tspivey@pcdesk.net>
Reply-To: tspivey@pcdesk.net
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: bootparamd is not 64-bit clean
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         112163
>Category:       bin
>Synopsis:       [patch] bootparamd(8) is not 64-bit clean
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    rink
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 26 17:40:05 GMT 2007
>Closed-Date:    Mon Feb 11 14:29:05 UTC 2008
>Last-Modified:  Mon Feb 11 14:29:05 UTC 2008
>Originator:     Tyler Spivey
>Release:        FreeBSD 6.2-RELEASE sparc64
>Organization:
N/A
>Environment:
System: FreeBSD fajrero 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 23:30:59 UTC 2007 root@s-dallas.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC sparc64


	
>Description:
Bootparamd is not 64-bit clean, and not in an obvious way. It
will just misteriously fail.
>How-To-Repeat:
Run bootparamd, and send a request to it,
e.g. with a Solaris jumpstart client.
>Fix:

Here is a small patch. The changes will print as they change.
save this to a file, and run (from
the top-level bootparamd directory): ed <file

patch:
e bootparamd/bootparamd.c
31s/unsigned long/uint32_t
51s/long/uint32_t
84s/4)/sizeof(uint32_t))
w
e bootparamd/main.c
35s/unsigned long/uint32_t
w
e callbootd/callbootd.c
82s/long/uint32_t
w


>Release-Note:
>Audit-Trail:

From: Tyler Spivey <tspivey@pcdesk.net>
To: bug-followup@freebsd.org
Cc:  
Subject: bin/112163
Date: Thu, 10 May 2007 01:36:03 -0700

 diff -ur bootparamd-orig/bootparamd/bootparamd.c bootparamd/bootparamd/bootparamd.c
 --- bootparamd-orig/bootparamd/bootparamd.c	Thu May 10 01:31:56 2007
 +++ bootparamd/bootparamd/bootparamd.c	Thu May 10 01:32:23 2007
 @@ -28,7 +28,7 @@
  #include <sys/types.h>
  #include <sys/socket.h>
  extern int debug, dolog;
 -extern unsigned long route_addr;
 +extern uint32_t route_addr;
  extern char *bootpfile;
  
  #define MAXLEN 800
 @@ -48,7 +48,7 @@
  bp_whoami_arg *whoami;
  struct svc_req *req;
  {
 -  long haddr;
 +  uint32_t haddr;
    static bp_whoami_res res;
    if (debug)
      fprintf(stderr,"whoami got question for %d.%d.%d.%d\n",
 @@ -81,7 +81,7 @@
  
      if (  res.router_address.address_type != IP_ADDR_TYPE ) {
        res.router_address.address_type = IP_ADDR_TYPE;
 -      bcopy( &route_addr, &res.router_address.bp_address_u.ip_addr, 4);
 +      bcopy( &route_addr, &res.router_address.bp_address_u.ip_addr, sizeof(uint32_t));
      }
      if (debug) fprintf(stderr,
  		       "Returning %s   %s    %d.%d.%d.%d\n",
 diff -ur bootparamd-orig/bootparamd/main.c bootparamd/bootparamd/main.c
 --- bootparamd-orig/bootparamd/main.c	Thu May 10 01:31:56 2007
 +++ bootparamd/bootparamd/main.c	Thu May 10 01:32:23 2007
 @@ -32,7 +32,7 @@
  
  int debug = 0;
  int dolog = 0;
 -unsigned long route_addr = -1;
 +uint32_t route_addr = -1;
  struct sockaddr_in my_addr;
  char *bootpfile = "/etc/bootparams";
  
 diff -ur bootparamd-orig/callbootd/callbootd.c bootparamd/callbootd/callbootd.c
 --- bootparamd-orig/callbootd/callbootd.c	Thu May 10 01:31:56 2007
 +++ bootparamd/callbootd/callbootd.c	Thu May 10 01:32:23 2007
 @@ -79,7 +79,7 @@
    bp_getfile_res *getfile_res, stat_getfile_res;
  
  
 -  long the_inet_addr;
 +  uint32_t the_inet_addr;
    CLIENT *clnt;
    enum clnt_stat clnt_stat;
  

From: Tyler Spivey <tspivey@pcdesk.net>
To: bug-followup@freebsd.org
Cc:  
Subject: bin/112163
Date: Fri, 11 May 2007 15:08:23 -0700

 diff -ur bootparamd-orig/bootparamd/bootparamd.c bootparamd/bootparamd/bootparamd.c
 --- bootparamd-orig/bootparamd/bootparamd.c	Thu May 10 01:31:56 2007
 +++ bootparamd/bootparamd/bootparamd.c	Fri May 11 14:57:10 2007
 @@ -28,7 +28,7 @@
  #include <sys/types.h>
  #include <sys/socket.h>
  extern int debug, dolog;
 -extern unsigned long route_addr;
 +extern in_addr_t route_addr;
  extern char *bootpfile;
  
  #define MAXLEN 800
 @@ -48,7 +48,7 @@
  bp_whoami_arg *whoami;
  struct svc_req *req;
  {
 -  long haddr;
 +  in_addr_t haddr;
    static bp_whoami_res res;
    if (debug)
      fprintf(stderr,"whoami got question for %d.%d.%d.%d\n",
 @@ -81,7 +81,7 @@
  
      if (  res.router_address.address_type != IP_ADDR_TYPE ) {
        res.router_address.address_type = IP_ADDR_TYPE;
 -      bcopy( &route_addr, &res.router_address.bp_address_u.ip_addr, 4);
 +      bcopy( &route_addr, &res.router_address.bp_address_u.ip_addr, sizeof(in_addr_t));
      }
      if (debug) fprintf(stderr,
  		       "Returning %s   %s    %d.%d.%d.%d\n",
 Only in bootparamd/bootparamd: bootparamd.o
 Only in bootparamd/bootparamd: bootparams.5.gz
 diff -ur bootparamd-orig/bootparamd/main.c bootparamd/bootparamd/main.c
 --- bootparamd-orig/bootparamd/main.c	Thu May 10 01:31:56 2007
 +++ bootparamd/bootparamd/main.c	Fri May 11 14:57:10 2007
 @@ -32,7 +32,7 @@
  
  int debug = 0;
  int dolog = 0;
 -unsigned long route_addr = -1;
 +in_addr_t route_addr = -1;
  struct sockaddr_in my_addr;
  char *bootpfile = "/etc/bootparams";
  
 Only in bootparamd/bootparamd: main.o
 diff -ur bootparamd-orig/callbootd/callbootd.c bootparamd/callbootd/callbootd.c
 --- bootparamd-orig/callbootd/callbootd.c	Thu May 10 01:31:56 2007
 +++ bootparamd/callbootd/callbootd.c	Fri May 11 14:57:10 2007
 @@ -79,7 +79,7 @@
    bp_getfile_res *getfile_res, stat_getfile_res;
  
  
 -  long the_inet_addr;
 +  in_addr_t the_inet_addr;
    CLIENT *clnt;
    enum clnt_stat clnt_stat;
  
Responsible-Changed-From-To: freebsd-bugs->rink 
Responsible-Changed-By: rink 
Responsible-Changed-When: Fri Jan 25 15:36:45 UTC 2008 
Responsible-Changed-Why:  
I've run into this issue myself - will test this patch and hopefully 
commit. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=112163 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/112163: commit references a PR
Date: Wed, 30 Jan 2008 13:48:49 +0000 (UTC)

 rink        2008-01-30 13:48:38 UTC
 
   FreeBSD src repository
 
   Modified files:
     usr.sbin/bootparamd/bootparamd bootparamd.c main.c 
   Log:
   Fix bootparamd on 64 bit platforms - at least amd64 was broken due to the
   code believing long == 64 bits and using it to store/compare IPv4 addresses.
   
   PR:             bin/112163
   Submitted by:   Tyler Spivey <tspivey@pcdesk.net>
   Reviewed by:    imp
   Approved by:    imp (mentor)
   MFC after:      1 week
   
   Revision  Changes    Path
   1.14      +3 -3      src/usr.sbin/bootparamd/bootparamd/bootparamd.c
   1.12      +1 -1      src/usr.sbin/bootparamd/bootparamd/main.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/112163: commit references a PR
Date: Thu,  7 Feb 2008 07:31:22 +0000 (UTC)

 rink        2008-02-07 07:31:16 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_7)
     usr.sbin/bootparamd/bootparamd bootparamd.c main.c 
     usr.sbin/bootparamd/callbootd callbootd.c 
   Log:
   MFC 1.14:
   Fix bootparamd on 64 bit platforms - at least amd64 was broken due to the
   code believing long == 64 bits and using it to store/compare IPv4 addresses.
   
   PR:             bin/112163
   Submitted by:   Tyler Spivey <tspivey@pcdesk.net>
   Reviewed by:    imp
   Approved by:    imp (mentor)
   
   Revision   Changes    Path
   1.12.10.1  +3 -3      src/usr.sbin/bootparamd/bootparamd/bootparamd.c
   1.10.18.1  +1 -1      src/usr.sbin/bootparamd/bootparamd/main.c
   1.10.20.1  +1 -1      src/usr.sbin/bootparamd/callbootd/callbootd.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/112163: commit references a PR
Date: Thu,  7 Feb 2008 07:35:22 +0000 (UTC)

 rink        2008-02-07 07:35:18 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     usr.sbin/bootparamd/bootparamd bootparamd.c main.c 
     usr.sbin/bootparamd/callbootd callbootd.c 
   Log:
   Fix bootparamd on 64 bit platforms - at least amd64 was broken due to the
   code believing long == 64 bits and using it to store/compare IPv4 addresses.
   
   PR:             bin/112163
   Submitted by:   Tyler Spivey <tspivey@pcdesk.net>
   Reviewed by:    imp
   Approved by:    imp (mentor)
   
   Revision   Changes    Path
   1.12.2.1   +3 -3      src/usr.sbin/bootparamd/bootparamd/bootparamd.c
   1.10.8.1   +1 -1      src/usr.sbin/bootparamd/bootparamd/main.c
   1.10.10.1  +1 -1      src/usr.sbin/bootparamd/callbootd/callbootd.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/112163: commit references a PR
Date: Thu,  7 Feb 2008 19:00:13 +0000 (UTC)

 rink        2008-02-07 19:00:00 UTC
 
   FreeBSD src repository
 
   Modified files:
     usr.sbin/bootparamd  Makefile Makefile.inc 
   Log:
   The previous commit message was wrong. It should have read:
   
   "Fix bootparamd on 64 bit platforms - at least amd64 was broken due to the
    code believing long == 32 bits and using it to store/compare IPv4 addresses."
   
   Note the "== 32 bits" - the previous commit message stated 64 bits, which is
   plain wrong.
   
   PR:                     bin/112163
   Pointed out by:         obrien
   Approved by:            imp (mentor, implicit)
   
   Revision  Changes    Path
   1.3       +0 -0      src/usr.sbin/bootparamd/Makefile
   1.3       +0 -0      src/usr.sbin/bootparamd/Makefile.inc
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: rink 
State-Changed-When: Mon Feb 11 14:28:38 UTC 2008 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=112163 
>Unformatted:
