From nobody@FreeBSD.org  Sun Sep 29 08:02:03 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id BE42C37B401
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 29 Sep 2002 08:02:03 -0700 (PDT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 5C06143E42
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 29 Sep 2002 08:02:03 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.6/8.12.6) with ESMTP id g8TF237R059595
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 29 Sep 2002 08:02:03 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.6/8.12.6/Submit) id g8TF23rF059594;
	Sun, 29 Sep 2002 08:02:03 -0700 (PDT)
Message-Id: <200209291502.g8TF23rF059594@www.freebsd.org>
Date: Sun, 29 Sep 2002 08:02:03 -0700 (PDT)
From: Dirk-Willem van Gulik <dirkx@webweaving.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: dhcp.* values not set in kenv by bootp client in kernel
X-Send-Pr-Version: www-1.0

>Number:         43474
>Category:       kern
>Synopsis:       [nfs] [patch] dhcp.* values not set in kenv by bootp client in kernel
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 29 08:10:04 PDT 2002
>Closed-Date:    Wed May 21 21:26:53 UTC 2008
>Last-Modified:  Wed May 21 21:26:53 UTC 2008
>Originator:     Dirk-Willem van Gulik
>Release:        4.6.2, 5-Current
>Organization:
WebWeaving
>Environment:
FreeBSD foem.leiden.webweaving.org 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Mon Jul  1 11:24:18 CEST 2002     dirkx@foem.leiden.webweaving.org:/usr/src/sys/i386/compile/FOEM  i386
>Description:
rc.diskless1 would like several dhcp.* variables to be set during the dhcp lease process of the kernel; i.e particular that of the dns servers. These are no longer set by the nfsclient/boot* system.
>How-To-Repeat:
Diskless boot -> /etc/resolv.conf not created by kenv extraction.
>Fix:
Add the nessesary fields (see patch) below.

Index: bootp_subr.c
===================================================================
RCS file: /usr/cvs/src/sys/nfsclient/bootp_subr.c,v
retrieving revision 1.33
diff -r1.33 bootp_subr.c
181a183
> #define TAG_DOMAINSRVS          6  /* Domain name servers */
182a185
> #define TAG_DOMAIN     15  /* Domain name */
199a203
> #define TAG_COOKIE    134     /* ascii info for userland, via sysctl */
1537a1555,1602
>                      TAG_DOMAINSRVS);
>       if (p != NULL) {
>               /* DNS / Domain name servers */ 
>               struct in_addr addr;
> #define               _MAX_DNSSRV (3)
>               char tmp[ _MAX_DNSSRV * (4*3+3+1)+1]; /* dot.dot.dot.dot space repeat */
>               int i,l = gctx->tag.taglen;
>               tmp[0] = '\0';
>       
>               /* XX should we panic on currupted DHCP ?? */
>               if (l % 4)
>                       panic("bootpc: DNS srv len is %d", gctx->tag.taglen);
>               printf("domainnameservers ");
> 
>               /* XX double check if this is hte right method to obtain multiple entries 
>                */
>               l = l < sizeof(struct in_addr) * _MAX_DNSSRV ? l : sizeof(struct in_addr) * _MAX_DNSSRV;
>               for(i=0; i < l; i+=sizeof(struct in_addr)) {
>                       unsigned int ip;
> 
>                       bcopy(p+i, &addr,sizeof(struct in_addr));
>                       ip = ntohl(addr.s_addr);
> 
>                       print_in_addr(addr);
>                       printf(" ");
> 
>                       snprintf(tmp+strlen(tmp),sizeof(tmp),
>                               " %d.%d.%d.%d",
>                               ip >> 24, (ip >> 16) & 255, (ip >> 8) & 255, ip & 255);
>               }
>               setenv("dhcp.domain-name-servers",tmp+1);
>       }
> 
>       p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen,
>                      TAG_DOMAIN);
>       if (p != NULL) {
>               char tmp[ MAXHOSTNAMELEN +1 ];
>               /* XXX so we can panic a boot with weird DHCP entries ? */
>               if (gctx->tag.taglen > MAXHOSTNAMELEN)
>                       panic("bootpc: DNS name too long (%d).",gctx->tag.taglen);
>               strncpy(tmp,p,gctx->tag.taglen);
>               tmp[gctx->tag.taglen]='\0';
>               printf("domainname %s",tmp);
>               printf(" ");
>               setenv("dhcp.domain-name",tmp);
>       }
> 
>       p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen,

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->murray 
Responsible-Changed-By: kris 
Responsible-Changed-When: Fri Jul 18 15:09:14 PDT 2003 
Responsible-Changed-Why:  
Assign to dhcp maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=43474 
Responsible-Changed-From-To: murray->freebsd-bugs 
Responsible-Changed-By: murray 
Responsible-Changed-When: Fri Mar 18 15:25:36 GMT 2005 
Responsible-Changed-Why:  
I am no longer the DHCP maintainer. 


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

From: Max Campos <mcampos@bpsw.biz>
To: bug-followup@FreeBSD.org,
 dirkx@webweaving.org
Cc:  
Subject: Re: kern/43474: [nfs] [patch] dhcp.* values not set in kenv by bootp client in kernel
Date: Fri, 5 Aug 2005 21:14:08 -0700

 This issue is also reported in / fixed by the patch contained in PR  
 bin/61239.
 
 

From: Dirk-Willem van Gulik <dirkx@webweaving.org>
To: bug-followup@freebsd.org, dirkx@webweaving.org
Cc:  
Subject: Re: kern/43474: [nfs] [patch] dhcp.* values not set in kenv by bootp client in kernel
Date: Wed, 21 May 2008 21:04:23 +0200

 This can be closed - fine on 7
 
 Dw.
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Wed May 21 21:25:54 UTC 2008 
State-Changed-Why:  
Submitter notes that this works fine on FreeBSD 7. 

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