Skip site navigation (1)Skip section navigation (2)
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:   misc/43474: dhcp.* values not set in kenv by bootp client in kernel
Message-ID:  <200209291502.g8TF23rF059594@www.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         43474
>Category:       misc
>Synopsis:       dhcp.* values not set in kenv by bootp client in kernel
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 29 08:10:04 PDT 2002
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209291502.g8TF23rF059594>