Problem s BOOTPD
Marek Kubita
kubitovi na mbox.lantanet.cz
Středa Duben 9 14:14:16 CEST 1997
On Wed, 9 Apr 1997, Milan Kerslager wrote:
> DHCP neumi predat jmeno domeny :-|
> Takze za to mohou stanice s W95, ktere si pres DHCP zjistuji adresu.
DHCP to umi, ale bootpd+DHCP nekdy ne.
Nasel jsem v archivu DejaNews patch, o kterem jsem psal v predchozi
zprave. Aplikoval jsem ho tehdy na
ftp://ftp.vse.cz/pub/network/tools/bootp-2.4.3+DHCP.tar.gz .
Nevim, je-li to dnes jeste aktualni a neni-li misto bootpd+DHCP lepsi
pouzit DHCPd, nicmene zde je patch:
Date: Fri, 19 Jan 1996 19:38:39 +0100
From: Dietmar Berg <Dietmar.Berg na wienrg.aut.alcatel.at>
To: samba na anu.edu.au
Subject: DHCP-Patch & Win95 bugs
Message-ID: <199601191838.TAA00449 na atfmhs.wienrg.aut.alcatel.at>
Dear Samba users,
I know this is a bit off the topic of this list, but since I
learned about the DHCP-Patch through this list, I would like
to share my experience with you.
I am using bootpd-2.4.3 with the DHCP-patch applied.
There are two problems with it:
1) By default, bootpd responds with a packet of the same length
as the request. In my case, this was too short to fit all
requested information into it. When making it longer (by
explicitely defining the message size with ms=something
in /etc/bootptab), bootpd+DHCP-Patch turns the response
into a plain bootp-packet, forgetting about DHCP.
This causes DHCP-Clients to hang.
2) Despite the byte count preceding each option field,
Windows 95 copies the domainname up to the first '\0';
this frequently results in a domainname with trailing garbage.
I have not checked whether this applies to the NETBIOS-
Scope Identifier as well (if it is supplied).
Enclosed are two patches. The first problem is within bootpd.c,
I rearranged the code not to bypass the test for DHCP when
the message size is explicit.
The second problem is tackled in dovend.c. It is worked around
by immediately following the DOMAINNAME option by a PAD option
(which is defined as the null-character). IMHO this is the safest
route not to break any implementation of the client part.
Enjoy,
Dietmar Berg
--
V Dietmar Berg <Dietmar.Berg na aut.alcatel.at>
+---------------+ Alcatel Austria AG / Dept. BIS-C
| A L C A T E L | Ruthnergasse 1-7 +43-1-29121-278 (tel)
+---------------+ A-1210 Vienna +43-1-2921452 (fax)
*** bootpd.c.orig Tue Dec 12 11:32:46 1995
--- bootpd.c Wed Dec 20 18:04:21 1995
***************
*** 1278,1286 ****
--- 1278,1290 ----
vp = bp->bp_vend;
+ #define DHCP_PATCH_2
+ #ifndef DHCP_PATCH_2
if (hp->flags.msg_size) {
pktlen = hp->msg_size;
} else {
+ #endif
+
/*
* If the request was longer than the official length, build
* a response of that same length where the additional length
***************
*** 1338,1345 ****
--- 1342,1364 ----
report(LOG_INFO, "request has DHCP msglen=%d", msgsz);
pktlen = msgsz;
}
+
+
+ #ifdef DHCP_PATCH_2
+ /* check for user-defined msgsize,
+ use this unless limited by MAX_MSGSZ */
+ if (msgsz == 0 && hp->flags.msg_size)
+ {
+ pktlen = hp->msg_size;
+ if (debug > 1)
+ report(LOG_INFO, "request has size extended to %d", hp->msg_size);
+ } /*if*/
+ #endif
+
}
+ #ifndef DHCP_PATCH_2
}
+ #endif
if (pktlen < sizeof(*bp)) {
report(LOG_ERR, "invalid response length=%d", pktlen);
*** dovend.c.orig Tue Dec 12 11:39:48 1995
--- dovend.c Fri Dec 22 14:28:50 1995
***************
*** 138,151 ****
/*
* Check for room for domain_name. Add 2 to account for
* TAG_DOMAIN_NAME and length.
*/
len = strlen(hp->domain_name->string);
! NEED((len + 2), "dn");
*vp++ = TAG_DOMAIN_NAME;
*vp++ = (byte) (len & 0xFF);
bcopy(hp->domain_name->string, vp, len);
vp += len;
! bytesleft -= len + 2;
}
/*
* NIS (YP) server and domain
--- 138,154 ----
/*
* Check for room for domain_name. Add 2 to account for
* TAG_DOMAIN_NAME and length.
+ * Add one more for a 'PAD' option to make
+ * the string zero-terminated for Win95 to work.
*/
len = strlen(hp->domain_name->string);
! NEED((len + 3), "dn");
*vp++ = TAG_DOMAIN_NAME;
*vp++ = (byte) (len & 0xFF);
bcopy(hp->domain_name->string, vp, len);
vp += len;
! bytesleft -= len + 3;
! *vp++ = '\0'; /* Courtesy to M$ */
}
/*
* NIS (YP) server and domain
***************
*** 268,273 ****
--- 271,277 ----
/*
* The end marker is inserted by the caller.
*/
+ report(LOG_INFO,"end of _rfc1497: bytesleft=%d\n", bytesleft);
return (vp - buf);
#undef NEED
} /* dovend_rfc1497 */
Další informace o konferenci Linux