Hi, after reading the "Support for DHCP?" thread, the f* man pages and RFC's, I've decided to give it a shot and patch etherboot to work with DHCP. Since DHCP is a superset of BOOTP, as Mike Hammer ( and the RFC) says, the implementation should be pretty simple. We must issue a DHCP request ("DHCPDISCOVER"), which is very simple (just add the "DHCP message type " option to the vendor extensions, that is 53 1 1). The BIG problem is that the server reply has a vendor extension bigger than 64 bytes(BOOTP_VENDOR_LEN) and the Linux tagged image complains about "BOOTP record too large" (this is btperr in first.S) when is verifying the vendor extension, which is clipped to 64 bytes. So we must add a "PARAMETER REQUEST LIST" option to the vendor extension to shorten the reply. I've requested only the router option (that is 55 1 3), but I think some more options should be added. Anyway, the reply becomes too short, so I must remove the packet length test in the await_reply routine. The rest of the patch is a fix for the ne2000 problem, and is not written by me. WARNING! This piece of code - SUCKS BIG TIME! - is version 0.0.0 alpha! - is not RFC 2131 compliant(after the DHCPDISCOVER phase, the client MUST issue a DHCPREQUEST, so the server marks the address as unavailable, eventually wait for DHCPACK). - is only a quick hack intended to allow you to test the interaction between DHCP and etherboot. Commentaries, flames, fixes, xxx passwords are welcome. Thanks for your patience, Vlad -----------------------cut here-------------------- diff -u -r etherboot-3.2.orig/src/main.c etherboot-3.2/src/main.c --- etherboot-3.2.orig/src/main.c Wed Sep 3 16:54:56 1997 +++ etherboot-3.2/src/main.c Tue Jan 13 14:12:23 1998 @@ -46,7 +46,7 @@ unsigned char *end_of_rfc1533 = NULL; unsigned char vendorext_magic[] = {0xE4,0x45,0x74,0x68}; /* äEth */ -char rfc1533_cookie[5] = { RFC1533_COOKIE, RFC1533_END }; +char rfc1533_cookie[11] = { RFC1533_COOKIE,53,1,1,55,1,3,RFC1533_END }; char broadcast[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; void sleep (int secs); @@ -718,7 +718,7 @@ bp.bp_hlen = ETHER_ADDR_SIZE; bp.bp_xid = starttime = currticks(); bcopy(arptable[ARP_CLIENT].node, bp.bp_hwaddr, ETHER_ADDR_SIZE); - bcopy(rfc1533_cookie, bp.bp_vend, 5); /* request RFC-style options */ + bcopy(rfc1533_cookie, bp.bp_vend, 11); /* request RFC-style options */ for (retry = 0; retry < MAX_BOOTP_RETRIES; ) { udp_transmit(IP_BROADCAST, 0, BOOTP_SERVER, @@ -791,9 +791,9 @@ /* BOOTP ? */ bootpreply = (struct bootp_t *)&nic.packet[ETHER_HDR_SIZE]; - if ((type == AWAIT_BOOTP) && + if ((type == AWAIT_BOOTP) /*&& (nic.packetlen >= (ETHER_HDR_SIZE + - sizeof(struct bootp_t))) && + sizeof(struct bootp_t))) */&& (ntohs(udp->dest) == BOOTP_CLIENT) && (bootpreply->bp_op == BOOTP_REPLY)) { convert_ipaddr((char *)&arptable[ARP_CLIENT].ipaddr, diff -u -r etherboot-3.2.orig/src/ns8390.c etherboot-3.2/src/ns8390.c --- etherboot-3.2.orig/src/ns8390.c Thu Jul 17 17:12:35 1997 +++ etherboot-3.2/src/ns8390.c Tue Jan 13 08:36:50 1998 @@ -94,15 +94,15 @@ if (eth_flags & FLAG_16BIT) { cnt >>= 1; /* number of words */ while (cnt--) { - outw_p(eth_asic_base + NE_DATA, *((unsigned short *)src)); + outw(eth_asic_base + NE_DATA, *((unsigned short *)src)); src += 2; } } else { while (cnt--) - outb_p(eth_asic_base + NE_DATA, *(src++)); + outb(eth_asic_base + NE_DATA, *(src++)); } - while((inb_p(eth_nic_base + D8390_P0_ISR) & D8390_ISR_RDC) + while((inb(eth_nic_base + D8390_P0_ISR) & D8390_ISR_RDC) != D8390_ISR_RDC); } #else
For requests or suggestions regarding this mailing list archive please write to netboot@gkminix.han.de.