From owner-freebsd-bugs Sun Sep 29 8:10:10 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2E6B237B404 for ; Sun, 29 Sep 2002 08:10:06 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 74CF743E77 for ; Sun, 29 Sep 2002 08:10:05 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g8TFA5Co042259 for ; Sun, 29 Sep 2002 08:10:05 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g8TFA55o042258; Sun, 29 Sep 2002 08:10:05 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BE42C37B401 for ; 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 ; 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 ; 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 To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/43474: dhcp.* values not set in kenv by bootp client in kernel Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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