Index: configure =================================================================== RCS file: /sources/grub/grub/configure,v retrieving revision 1.114 diff -u -r1.114 configure --- configure 8 May 2005 02:51:51 -0000 1.114 +++ configure 2 Feb 2006 19:05:10 -0000 @@ -5571,6 +5571,15 @@ NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONFIG_PCI_DIRECT=1" fi +# Check whether --enable-dhcpvsi or --disable-dhcpvsi was given. +if test "${enable_dhcpvsi+set}" = set; then + enableval="$enable_dhcpvsi" + +fi; +if test "x$enable_dhcpvsi" = xyes; then + NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DINCLUDE_DHCPVSI=1" +fi + # Check whether --enable-3c509 or --disable-3c509 was given. if test "${enable_3c509+set}" = set; then enableval="$enable_3c509" Index: configure.ac =================================================================== RCS file: /sources/grub/grub/configure.ac,v retrieving revision 1.9 diff -u -r1.9 configure.ac --- configure.ac 8 May 2005 02:51:51 -0000 1.9 +++ configure.ac 2 Feb 2006 19:05:10 -0000 @@ -326,6 +326,12 @@ NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONFIG_PCI_DIRECT=1" fi +AC_ARG_ENABLE(dhcpvsi, + [ --enable-dhcpvsi enable VSI option for DHCP]) +if test "x$enable_dhcpvsi" = xyes; then + NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DINCLUDE_DHCPVSI=1" +fi + dnl Device drivers. AC_ARG_ENABLE(3c509, [ --enable-3c509 enable 3Com509 driver]) Index: netboot/README.netboot =================================================================== RCS file: /sources/grub/grub/netboot/README.netboot,v retrieving revision 1.7 diff -u -r1.7 README.netboot --- netboot/README.netboot 2 Jan 2002 21:56:40 -0000 1.7 +++ netboot/README.netboot 2 Feb 2006 19:05:10 -0000 @@ -22,6 +22,10 @@ the latter is the ``Preboot Execution Environment" format, which is used by a PXE ROM. You may buy a PXE ROM from some companies. +--enable-dhcpvsi + Forces pxegrub to send a vendor specific DHCP option for all outgoing + traffic, and forces it to check all incoming traffic for a VS option. + Here is the information about the device drivers. They are all disabled by default, so you must specify configure options to enable drivers you want to use. Some drivers have extra per-driver options, so the extra Index: netboot/main.c =================================================================== RCS file: /sources/grub/grub/netboot/main.c,v retrieving revision 1.16 diff -u -r1.16 main.c --- netboot/main.c 20 May 2004 22:17:27 -0000 1.16 +++ netboot/main.c 2 Feb 2006 19:05:10 -0000 @@ -82,8 +82,17 @@ RFC2132_MSG_TYPE, 1, DHCPDISCOVER, RFC2132_MAX_SIZE,2, /* request as much as we can */ ETH_MAX_MTU / 256, ETH_MAX_MTU % 256, - RFC2132_PARAM_LIST, 4, RFC1533_NETMASK, RFC1533_GATEWAY, + RFC2132_PARAM_LIST, +#ifdef INCLUDE_DHCPVSI + 5, +#else + 4, +#endif + RFC1533_NETMASK, RFC1533_GATEWAY, RFC1533_HOSTNAME, RFC1533_EXTENSIONPATH +#ifdef INCLUDE_DHCPVSI + , RFC1533_VENDOR, RFC2132_VENDOR_CLASS_ID,7,'p','x','e','g','r','u','b' +#endif /*INCLUDE_DHCPVSI*/ }; static const unsigned char dhcprequest[] = @@ -95,14 +104,25 @@ ETH_MAX_MTU / 256, ETH_MAX_MTU % 256, /* request parameters */ RFC2132_PARAM_LIST, +#ifdef INCLUDE_DHCPVSI + /* 4 standard + 2 vendortags + 1 VSI tag*/ + 4 + 2 + 1, +#else /* 4 standard + 2 vendortags */ 4 + 2, +#endif /* Standard parameters */ RFC1533_NETMASK, RFC1533_GATEWAY, RFC1533_HOSTNAME, RFC1533_EXTENSIONPATH, +#ifdef INCLUDE_DHCPVSI + RFC1533_VENDOR, +#endif /* Etherboot vendortags */ RFC1533_VENDOR_MAGIC, RFC1533_VENDOR_CONFIGFILE, +#ifdef INCLUDE_DHCPVSI + RFC2132_VENDOR_CLASS_ID,7,'p','x','e','g','r','u','b' +#endif }; #endif /* ! NO_DHCP_SUPPORT */ @@ -738,6 +758,11 @@ int await_reply (int type, int ival, void *ptr, int timeout) { +#ifdef INCLUDE_DHCPVSI + unsigned int vendi,count; + char grubvendorID[] = {0x70,0x78,0x65,0x67,0x72,0x75,0x62,0xFF}; + unsigned int gvIDsize = (sizeof(grubvendorID)/sizeof(char)); +#endif unsigned long time; struct iphdr *ip; struct udphdr *udp; @@ -900,6 +925,21 @@ arptable[ARP_CLIENT].ipaddr.s_addr = bootpreply->bp_yiaddr.s_addr; #ifndef NO_DHCP_SUPPORT +#ifdef INCLUDE_DHCPVSI + /**Check that DHCP option 43 for magic grubvendorID*/ + for(vendi=count=0; vendi<(BOOTP_VENDOR_LEN+2-gvIDsize);vendi++) { + while(bootpreply->bp_vend[vendi+count]==grubvendorID[count] + && count < gvIDsize) + count++; + if (count==gvIDsize) + break; + count=0; + } + if (count==0) { + etherboot_printf("DHCP did not provide VSI\n"); + continue; + } +#endif dhcp_addr.s_addr = bootpreply->bp_yiaddr.s_addr; #ifdef DEBUG etherboot_printf ("dhcp_addr = %@\n", dhcp_addr.s_addr);