From ad5d77530e96e3759b4d1712a3d9b861ea07712c Mon Sep 17 00:00:00 2001 From: Gene Cumm Date: Mon, 28 May 2012 18:16:19 -0400 Subject: pxechn: Turn off debug Signed-off-by: Gene Cumm --- com32/modules/pxechn.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/com32/modules/pxechn.c b/com32/modules/pxechn.c index 3f9ebd32..301f311e 100644 --- a/com32/modules/pxechn.c +++ b/com32/modules/pxechn.c @@ -43,7 +43,11 @@ #include -#define PXECHN_DEBUG 1 +#ifdef DEBUG +# define PXECHN_DEBUG 1 +#else +# define PXECHN_DEBUG 0 +#endif typedef union { uint64_t q; @@ -54,15 +58,21 @@ typedef union { #define dprintf0(f, ...) ((void)0) +#ifndef dprintf +# if (PXECHN_DEBUG > 0) +# define dprintf printf +# else +# define dprintf(f, ...) ((void)0) +# endif +#endif + #if (PXECHN_DEBUG > 0) # define dpressanykey pressanykey -# define dprintf printf # define dprint_pxe_bootp_t print_pxe_bootp_t # define dprint_pxe_vendor_blk print_pxe_vendor_blk # define dprint_pxe_vendor_raw print_pxe_vendor_raw #else # define dpressanykey(tm) ((void)0) -# define dprintf(f, ...) ((void)0) # define dprint_pxe_bootp_t(p, l) ((void)0) # define dprint_pxe_vendor_blk(p, l) ((void)0) # define dprint_pxe_vendor_raw(p, l) ((void)0) -- cgit v1.2.1 From 476b2abb37d2734ec77e8e3c0f4f9c412965640e Mon Sep 17 00:00:00 2001 From: Gene Cumm Date: Tue, 29 May 2012 17:04:04 -0400 Subject: NEWS: add pxechn.c32 Signed-off-by: Gene Cumm --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index a84b8901..9dadd7e3 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,9 @@ to all derivatives. Changes in 4.06: * Support for NTFS, by Paulo Alcantara. + * pxechn.c32, a PXE NBP chainloader. More versatile alternative + to pxechain.com and resolves the PXELINUX -> WDS issue with + Microsoft Windows Server 2008R2 (Gene Cumm). Changes in 4.05: * HDT updated, and now supports uploading data to a TFTP -- cgit v1.2.1 From 3cf65ff842c9017195646e684a437d100316dfe9 Mon Sep 17 00:00:00 2001 From: Gene Cumm Date: Thu, 31 May 2012 23:04:43 -0400 Subject: doc/pxechn.txt: WDS specifics, example, issue Notes on using the WDS option. Known issue with gPXE/iPXE Signed-off-by: Gene Cumm --- doc/pxechn.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/pxechn.txt b/doc/pxechn.txt index a09bbe2b..f2638f62 100644 --- a/doc/pxechn.txt +++ b/doc/pxechn.txt @@ -2,7 +2,7 @@ :doctype: manpage :author: Gene Cumm :email: gene.cumm@gmail.com -:revdate: 2012-05-27 +:revdate: 2012-05-31 == NAME == @@ -58,7 +58,9 @@ Chainboot to a new NBP (Network Boot Program) 'FILE' with options to adjust PXE wait after loading before booting for user input. *-W*:: - Enable WDS (Windows Deployment Services) - specific options. + Enable WDS (Windows Deployment Services) - specific options. 'FILE' (or its overrides) must point at the WDS server. + *NOTE:* As of 2012-05-31, there is a known issue with gPXE/iPXE, at least with undionly.kkpxe. +// It appears as if wdsnbp.com walks memory to find a PXE stack == DECIMAL INPUT == @@ -76,13 +78,17 @@ pxechn.c32 gpxelinux.0 -p http://172.16.23.1/tftp/ -w -X A012345678 -x 197:00d0d pxechn.c32 gpxelinux.0 -p http://172.16.23.1/tftp/ -w -X A012:3456:78 -x 197:00-d0-de-00 Both of these are equivalent. Load gpxelinux.0 (relative to the current directory and not altering sname/option 66), set the PXELINUX path prefix, wait after loading, set option 160 to 0x12 0x34 0x56 0x78, and option 197 to 0x00 0xD0 0xDE 0x00. +pxechn.c32 172.16.23.8:boot\x86\wdsnbp.com -W +pxechn.c32 172.16.23.2:boot\x86\wdsnbp.com -W -o 66.x=ac:10:17:08 + These are similar but not identical. Load wdsnbp.com (first example from 172.16.23.8 and the second from 172.16.23.2) but point the packets at 172.16.23.8 for use with WDS. + == NOTES == -Please note that some NBPs may ignore packet #3 by either not examining it at all or by issuing its own DHCP DISCOVER/REQUEST, negating all DHCP field/option modifications by pxechn.c32. +Please note that some NBPs may ignore packet #3 by either not examining it at all or by issuing its own DHCP DISCOVER/REQUEST, negating all DHCP field/option modifications by pxechn.c32, including Microsoft Windows Server 2008R2 WDS's wdsnbp.com. URL specifications in 'FILE' that include user/password before the host will currently cause the siaddr field to not be set properly. -The non-space constraint is due to how Syslinux variants parse the command line as of 2012-01-12. +The non-space constraint is due to how Syslinux variants parse the command line as of 2012-05-31. == AUTHOR == -- cgit v1.2.1 From 616162f3564a3cebc8e18c8033fee4e244db5271 Mon Sep 17 00:00:00 2001 From: Gene Cumm Date: Fri, 1 Jun 2012 21:40:46 -0400 Subject: pxechn.c32: add -S to transform sname to siaddr Signed-off-by: Gene Cumm --- com32/modules/pxechn.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/com32/modules/pxechn.c b/com32/modules/pxechn.c index 301f311e..26376900 100644 --- a/com32/modules/pxechn.c +++ b/com32/modules/pxechn.c @@ -117,6 +117,7 @@ struct pxelinux_opt { uint32_t force; uint32_t wait; /* Additional decision to wait before boot */ int32_t wds; /* WDS option/level */ + in_addr_t sip; /* siaddr: Next Server IP Address */ struct dhcp_option p[PXECHN_NUM_PKT_AVAIL]; /* original _DHCP_DISCOVER, _DHCP_ACK, _CACHED_REPLY then modified packets */ char host[PXECHN_HOST_LEN]; @@ -463,6 +464,7 @@ void pxechn_init(struct pxelinux_opt *pxe) pxe->wait = 0; pxe->gip = 0; pxe->wds = 0; + pxe->sip = 0; pxe->host[0] = 0; pxe->host[((NUM_DHCP_OPTS) - 1)] = 0; for (int j = 0; j < PXECHN_NUM_PKT_TYPE; j++){ @@ -741,7 +743,7 @@ int pxechn_parse_args(int argc, char *argv[], struct pxelinux_opt *pxe, { int arg, optnum, rv = 0; char *p = NULL; - const char optstr[] = "c:f:g:o:p:t:uwW"; + const char optstr[] = "c:f:g:o:p:St:uwW"; struct dhcp_option iopt; if (pxe->p[5].data) @@ -775,6 +777,9 @@ int pxechn_parse_args(int argc, char *argv[], struct pxelinux_opt *pxe, case 'p': /* prefix */ pxechn_setopt_str(&(opts[210]), optarg); break; + case 'S': /* sip from sName */ + pxe->sip = 1; + break; case 't': /* timeout */ optnum = strtoul(optarg, &p, 0); if (p != optarg) { @@ -819,6 +824,7 @@ int pxechn_args(int argc, char *argv[], struct pxelinux_opt *pxe) pxe_bootp_t *bootp0, *bootp1; int ret = 0; struct dhcp_option *opts; + char *str; opts = pxe->opts[2]; /* Start filling packet #1 */ @@ -836,7 +842,30 @@ int pxechn_args(int argc, char *argv[], struct pxelinux_opt *pxe) ret = pxechn_parse_args(argc, argv, pxe, opts); if (ret) return ret; - bootp1->sip = pxe->fip; + if (pxe->sip > 0xFFFFFF) { /* a real IPv4 address */ + bootp1->sip = pxe->sip; + } else if ((pxe->sip == 1) + && (opts[66].len > 0)){ + /* unterminated? */ + if (strnlen(opts[66].data, opts[66].len) == (size_t)opts[66].len) { + str = malloc(opts[66].len + 1); + if (str) { + memcpy(str, opts[66].data, opts[66].len); + str[opts[66].len] = 0; + } + } else { + str = opts[66].data; + } + if (str) { + bootp1->sip = pxe_dns(str); + if (str != opts[66].data) + free(str); + } else { + bootp1->sip = pxe->fip; + } + } else { + bootp1->sip = pxe->fip; + } bootp1->gip = pxe->gip; ret = dhcp_pack_packet(bootp1, (size_t *)&(pxe->p[5].len), opts); -- cgit v1.2.1 From 2c6cd98a70980c419a0e45624b10f93a0548a3e9 Mon Sep 17 00:00:00 2001 From: Gene Cumm Date: Fri, 1 Jun 2012 23:26:40 -0400 Subject: doc/pxechn.txt: add -S, examples, clarify Signed-off-by: Gene Cumm --- doc/pxechn.txt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/doc/pxechn.txt b/doc/pxechn.txt index f2638f62..2c68d633 100644 --- a/doc/pxechn.txt +++ b/doc/pxechn.txt @@ -2,7 +2,7 @@ :doctype: manpage :author: Gene Cumm :email: gene.cumm@gmail.com -:revdate: 2012-05-31 +:revdate: 2012-06-01 == NAME == @@ -48,6 +48,9 @@ Chainboot to a new NBP (Network Boot Program) 'FILE' with options to adjust PXE *-r*:: Call the PXE stack with PXENV_RESTART_TFTP. _Must_ be the only option and before 'FILE'. +*-S*:: + Set sip based on sname field/option 66 (by direct IP if a period-delimited address or otherwise DNS). + *-t* 'SECONDS':: PXELINUX timeout (DHCP Option 211). @@ -58,7 +61,7 @@ Chainboot to a new NBP (Network Boot Program) 'FILE' with options to adjust PXE wait after loading before booting for user input. *-W*:: - Enable WDS (Windows Deployment Services) - specific options. 'FILE' (or its overrides) must point at the WDS server. + Enable WDS (Windows Deployment Services) - specific options. 'FILE' (or its overrides for DHCP fields siaddr and file) must point at the WDS server. *NOTE:* As of 2012-05-31, there is a known issue with gPXE/iPXE, at least with undionly.kkpxe. // It appears as if wdsnbp.com walks memory to find a PXE stack @@ -71,16 +74,16 @@ All parameters that are defaulted to decimal format are processed by *strtoul*(3 pxechn.c32 http://myhost.dom.loc/path/nbp.0 -c myconfig Load nbp.0 and set PXELINUX config (option 209). -pxechn.c32 gpxelinux.0 -p http://172.16.23.1/tftp/ -w -c myconfig -o 15.s=domain.loc -o 6.x=0A:01:01:02:ac:17:4D:Ec - +pxechn.c32 gpxelinux.0 -p http://10.1.1.4/tftp/ -w -c myconfig -o 15.s=domain.loc -o 6.x=0A:01:01:02:ac:17:4D:Ec - Load gpxelinux.0 from the current directory, set prefix, wait to execute, set first config, set the domain name and 2 domain name servers (case mixed to show insensitivity; 10.1.1.2 and 172.23.77.236). -pxechn.c32 gpxelinux.0 -p http://172.16.23.1/tftp/ -w -X A012345678 -x 197:00d0de00 -pxechn.c32 gpxelinux.0 -p http://172.16.23.1/tftp/ -w -X A012:3456:78 -x 197:00-d0-de-00 +pxechn.c32 gpxelinux.0 -p http://10.1.1.4/tftp/ -w -X A012345678 -x 197:00d0de00 +pxechn.c32 gpxelinux.0 -p http://10.1.1.4/tftp/ -w -X A012:3456:78 -x 197:00-d0-de-00 Both of these are equivalent. Load gpxelinux.0 (relative to the current directory and not altering sname/option 66), set the PXELINUX path prefix, wait after loading, set option 160 to 0x12 0x34 0x56 0x78, and option 197 to 0x00 0xD0 0xDE 0x00. -pxechn.c32 172.16.23.8:boot\x86\wdsnbp.com -W -pxechn.c32 172.16.23.2:boot\x86\wdsnbp.com -W -o 66.x=ac:10:17:08 - These are similar but not identical. Load wdsnbp.com (first example from 172.16.23.8 and the second from 172.16.23.2) but point the packets at 172.16.23.8 for use with WDS. +pxechn.c32 10.1.1.8:boot\x86\wdsnbp.com -W +pxechn.c32 10.1.1.4:boot\x86\wdsnbp.com -W -o 66.x=0a:01:01:08 -S + These are similar but not identical. Load wdsnbp.com (first example from 10.1.1.8 and the second from 10.1.1.4) but point the packets at 10.1.1.8 for use with WDS. DHCP Option 66 will be placed in DHCP field sname when there's room. -S decodes this to an IPv4 address. == NOTES == -- cgit v1.2.1 From 46cd46a6b2ec27d1eab1727ad83f42bdea3f4503 Mon Sep 17 00:00:00 2001 From: Gene Cumm Date: Thu, 1 Dec 2011 22:38:08 -0500 Subject: prdhcp.c32: Print DHCP packets For PXELINUX, print the generically parsed contents of the DHCP packets for examining the options used in all 3. It currently accepts no options. Signed-off-by: Gene Cumm --- com32/modules/prdhcp.c | 163 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 com32/modules/prdhcp.c diff --git a/com32/modules/prdhcp.c b/com32/modules/prdhcp.c new file mode 100644 index 00000000..5b572b0b --- /dev/null +++ b/com32/modules/prdhcp.c @@ -0,0 +1,163 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2010-2011 Gene Cumm - All Rights Reserved + * + * Portions from chain.c: + * Copyright 2003-2009 H. Peter Anvin - All Rights Reserved + * Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin + * Significant portions copyright (C) 2010 Shao Miller + * [partition iteration, GPT, "fs"] + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, Inc., 53 Temple Place Ste 330, + * Boston MA 02111-1307, USA; either version 2 of the License, or + * (at your option) any later version; incorporated herein by reference. + * + * ----------------------------------------------------------------------- */ + +/* + * prdhcp.c + * + * Print the contents of the 3 DHCP packets + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEBUG 1 + +#define dprintf0(f, ...) ((void)0) + +#ifdef DEBUG +# define dpressanykey pressanykey +# define dprintf printf +# define dprint_pxe_bootp_t print_pxe_bootp_t +# define dprint_pxe_vendor_blk print_pxe_vendor_blk +# define dprint_pxe_vendor_raw print_pxe_vendor_raw +#else +# define dpressanykey(void) ((void)0) +# define dprintf(f, ...) ((void)0) +# define dprint_pxe_bootp_t(p, l) ((void)0) +# define dprint_pxe_vendor_blk(p, l) ((void)0) +# define dprint_pxe_vendor_raw(p, l) ((void)0) +#endif + +#define dprintf_opt_cp dprintf0 +#define dprintf_opt_inj dprintf + + +const char app_name_str[] = "prdhcp.c32"; + + +int pressanykey(void) { + int inc; + + printf("Press any key to continue. "); + inc = KEY_NONE; + while (inc == KEY_NONE) + inc = get_key(stdin, 6000); + puts(""); + return inc; +} + +void print_pxe_vendor_blk(pxe_bootp_t *p, size_t len) +{ + int i, vlen, oplen, j; + uint8_t *d; + uint32_t magic; + if (!p) { + printf(" packet pointer is null\n"); + return; + } + vlen = len - ((void *)&(p->vendor) - (void *)p); + printf(" Vendor Data: Len=%d", vlen); + d = p->vendor.d; + /* Print only 256 characters of the vendor/option data */ + /* + print_pxe_vendor_raw(p, (len - vlen) + 256); + vlen = 0; + */ + magic = ntohl(*((uint32_t *)d)); + printf(" Magic: %08X", ntohl(*((uint32_t *)d))); + if (magic != VM_RFC1048) /* Invalid DHCP packet */ + vlen = 0; + for (i = 4; i < vlen; i++) { + if (d[i]) /* Skip the padding */ + printf("\n @%03X-%3d", i, d[i]); + if (d[i] == 255) /* End of list */ + break; + if (d[i]) { + oplen = d[++i]; + printf(" l=%3d:", oplen); + for (j = (++i + oplen); i < vlen && i < j; i++) { + printf(" %02X", d[i]); + } + i--; + } + } + printf("\n"); +} + +void print_pxe_bootp_t(pxe_bootp_t *p, size_t len) +{ + if (!p) { + printf(" packet pointer is null\n"); + return; + } + printf(" op:%02X hw:%02X hl:%02X gh:%02X id:%08X se:%04X f:%04X" + " cip:%08X\n", p->opcode, p->Hardware, p->Hardlen, p->Gatehops, + ntohl(p->ident), ntohs(p->seconds), ntohs(p->Flags), ntohl(p->cip)); + printf(" yip:%08X sip:%08X gip:%08X", + ntohl(p->yip), ntohl(p->sip), ntohl(p->gip)); + printf(" caddr-%02X:%02X:%02X:%02X:%02X:%02X\n", p->CAddr[0], + p->CAddr[1], p->CAddr[2], p->CAddr[3], p->CAddr[4], p->CAddr[5]); + printf(" sName: '%s'\n", p->Sname); + printf(" bootfile: '%s'\n", p->bootfile); + print_pxe_vendor_blk(p, len); +} + +void print_dhcp_pkt_all(void) +{ + pxe_bootp_t *p; + size_t len; + int i; + + for (i = 0; i < 3; i++) { + if (!pxe_get_cached_info(PXENV_PACKET_TYPE_CACHED_REPLY, + (void **)&(p), &(len))) { + dprintf("Got packet #%d\n", i); + print_pxe_bootp_t(p, len); + pressanykey(); + } + } +} + +int main(void) +{ + int rv= -1; + const struct syslinux_version *sv; + + console_ansi_raw(); + sv = syslinux_version(); + if (sv->filesystem != SYSLINUX_FS_PXELINUX) { + printf("%s: May only run in PXELINUX\n", app_name_str); + return -2; + } + print_dhcp_pkt_all(); + return rv; +} -- cgit v1.2.1 From 98bd851f6eb241c4303f3f27df1241651c112525 Mon Sep 17 00:00:00 2001 From: Gene Cumm Date: Sun, 18 Dec 2011 00:15:09 -0500 Subject: prdhcp.c32: Add to Makefile Signed-off-by: Gene Cumm --- com32/modules/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com32/modules/Makefile b/com32/modules/Makefile index d8861c48..35e297fe 100644 --- a/com32/modules/Makefile +++ b/com32/modules/Makefile @@ -24,7 +24,7 @@ MODULES = config.c32 ethersel.c32 dmitest.c32 cpuidtest.c32 \ meminfo.c32 sdi.c32 sanboot.c32 ifcpu64.c32 vesainfo.c32 \ kbdmap.c32 cmd.c32 vpdtest.c32 host.c32 ls.c32 gpxecmd.c32 \ ifcpu.c32 cpuid.c32 cat.c32 pwd.c32 ifplop.c32 zzjson.c32 \ - whichsys.c32 pxechn.c32 + whichsys.c32 prdhcp.c32 pxechn.c32 TESTFILES = -- cgit v1.2.1 From 87b2cfbe323b7d53c5df27b066f235c7c1bf4aae Mon Sep 17 00:00:00 2001 From: Gene Cumm Date: Fri, 3 Feb 2012 23:14:04 -0500 Subject: prdhcp.c32: Fix what is retrieved. Signed-off-by: Gene Cumm --- com32/modules/prdhcp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/com32/modules/prdhcp.c b/com32/modules/prdhcp.c index 5b572b0b..321d4e77 100644 --- a/com32/modules/prdhcp.c +++ b/com32/modules/prdhcp.c @@ -136,11 +136,12 @@ void print_dhcp_pkt_all(void) pxe_bootp_t *p; size_t len; int i; + int ptype[3] = {PXENV_PACKET_TYPE_DHCP_DISCOVER, PXENV_PACKET_TYPE_DHCP_ACK, PXENV_PACKET_TYPE_CACHED_REPLY}; for (i = 0; i < 3; i++) { - if (!pxe_get_cached_info(PXENV_PACKET_TYPE_CACHED_REPLY, + if (!pxe_get_cached_info(ptype[i], (void **)&(p), &(len))) { - dprintf("Got packet #%d\n", i); + dprintf("Got packet #%d/%d\n", (i + 1), ptype[i]); print_pxe_bootp_t(p, len); pressanykey(); } -- cgit v1.2.1 From f24d8129ff91336b4c819cf8589cff4b4431e040 Mon Sep 17 00:00:00 2001 From: Gene Cumm Date: Mon, 3 Sep 2012 13:47:48 -0400 Subject: doc/pxechn.txt: Change title for manpage use. Signed-off-by: Gene Cumm --- doc/pxechn.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/pxechn.txt b/doc/pxechn.txt index 2c68d633..6b5b99c3 100644 --- a/doc/pxechn.txt +++ b/doc/pxechn.txt @@ -1,4 +1,4 @@ -= pxechn.c32 = += pxechn.c32(1) = :doctype: manpage :author: Gene Cumm :email: gene.cumm@gmail.com -- cgit v1.2.1 From 0ce24cd6343760ab6b76809b957717d71edcfce7 Mon Sep 17 00:00:00 2001 From: Gene Cumm Date: Mon, 3 Sep 2012 13:48:40 -0400 Subject: doc/pxechn.txt: Updates for clarity/flow Signed-off-by: Gene Cumm --- doc/pxechn.txt | 60 ++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/doc/pxechn.txt b/doc/pxechn.txt index 6b5b99c3..a747b744 100644 --- a/doc/pxechn.txt +++ b/doc/pxechn.txt @@ -2,14 +2,15 @@ :doctype: manpage :author: Gene Cumm :email: gene.cumm@gmail.com -:revdate: 2012-06-01 +:revdate: 2012-09-03 == NAME == -pxechn.c32 - Chainboot to new NBP +pxechn.c32 - Chainboot to new Network Boot Program == SYNOPSIS == +[verse] *pxechn.c32* [-h | --help | -?] *pxechn.c32* -r 'FILE' *pxechn.c32* 'FILE' ['OPTIONS'] @@ -22,48 +23,48 @@ Chainboot to a new NBP (Network Boot Program) 'FILE' with options to adjust PXE == OPTIONS == *-c* 'CONFIG':: - PXELINUX config file (DHCP Option 209). + 'config' file for PXELINUX (DHCP Option 209). // *-f* 'MOD':: -// Force behavior specified by 'MOD' +// 'Force' behavior specified by modifier 'MOD' // // *-g* 'HOST':: -// Set DHCP gateway/relay. Parsed by pxe_dns(). +// Set 'gateway'/relay DHCP field to 'HOST'. Parsed by pxe_dns(). // *-h*, *--help*, *-?*:: - Print usage information; invalid options will also cause this. + Print 'help'/usage information; invalid options will also cause this. // *-n*:: -// Use native methods, ignoring underlying gPXE/iPXE. +// Use 'native' methods, ignoring underlying gPXE/iPXE. // // *-N*:: -// Use non-native methods to utilize gPXE/iPXE (if available). +// Use 'non-native' methods to utilize gPXE/iPXE (if available). // *-o* 'OPT.TYPE=VALUE':: - Specify a generic option. 'OPT' is in 'DECIMAL INPUT' format (below). 'TYPE' specifies the output type and input syntax. 'b'yte, 'w'ord(2B), 'l'ong(4B), 'q'uad(8B), character 's'tring and colon-separated he'x' string (case insensitive; bytes must have 2 digits and each byte must be separated). byte, word, long and quad input values must meet criteria for 'DECIMAL INPUT' + Set 'option'. 'OPT' is in 'DECIMAL INPUT' format (below). 'TYPE' specifies the output type and input syntax. ''b'yte', ''w'ord'(2B), ''l'ong'(4B), ''q'uad'(8B), character ''s'tring' and colon-separated 'he'x'' string (case insensitive; bytes must have 2 digits and each byte must be separated). byte, word, long and quad input values must meet criteria for 'DECIMAL INPUT' *-p* 'PATH':: - PXELINUX path (DHCP Option 210). + 'path' option for PXELINUX (DHCP Option 210). *-r*:: - Call the PXE stack with PXENV_RESTART_TFTP. _Must_ be the only option and before 'FILE'. + 'restart'. Call the PXE stack with PXENV_RESTART_TFTP. _Must_ be the only option and before 'FILE'. *-S*:: - Set sip based on sname field/option 66 (by direct IP if a period-delimited address or otherwise DNS). + Set 'sip' based on sname field/option 66 (by direct IP if a period-delimited address or otherwise DNS). *-t* 'SECONDS':: - PXELINUX timeout (DHCP Option 211). + 'timeout' option for PXELINUX (DHCP Option 211). // *-u*:: -// Copy UUID (Option 97) if found in packet #1 +// Copy 'UUID' (Option 97) if found in packet #1 *-w*:: - wait after loading before booting for user input. + 'wait'. After loading, wait for user input before booting. *-W*:: - Enable WDS (Windows Deployment Services) - specific options. 'FILE' (or its overrides for DHCP fields siaddr and file) must point at the WDS server. + Enable 'WDS' (Windows Deployment Services) - specific options. 'FILE' (or its overrides for DHCP fields siaddr and file) must point at the WDS server. *NOTE:* As of 2012-05-31, there is a known issue with gPXE/iPXE, at least with undionly.kkpxe. -// It appears as if wdsnbp.com walks memory to find a PXE stack +// PXELINUX asks gPXE/iPXE to unload, reverting to an underlying stack == DECIMAL INPUT == @@ -71,19 +72,23 @@ All parameters that are defaulted to decimal format are processed by *strtoul*(3 == EXAMPLES == -pxechn.c32 http://myhost.dom.loc/path/nbp.0 -c myconfig +`pxechn.c32 http://myhost.dom.loc/path/nbp.0 -c myconfig`:: Load nbp.0 and set PXELINUX config (option 209). -pxechn.c32 gpxelinux.0 -p http://10.1.1.4/tftp/ -w -c myconfig -o 15.s=domain.loc -o 6.x=0A:01:01:02:ac:17:4D:Ec - +`pxechn.c32 gpxelinux.0 -p http://10.1.1.4/tftp/ -w -c myconfig -o 15.s=domain.loc -o 6.x=0A:01:01:02:ac:17:4D:Ec -`:: Load gpxelinux.0 from the current directory, set prefix, wait to execute, set first config, set the domain name and 2 domain name servers (case mixed to show insensitivity; 10.1.1.2 and 172.23.77.236). -pxechn.c32 gpxelinux.0 -p http://10.1.1.4/tftp/ -w -X A012345678 -x 197:00d0de00 -pxechn.c32 gpxelinux.0 -p http://10.1.1.4/tftp/ -w -X A012:3456:78 -x 197:00-d0-de-00 - Both of these are equivalent. Load gpxelinux.0 (relative to the current directory and not altering sname/option 66), set the PXELINUX path prefix, wait after loading, set option 160 to 0x12 0x34 0x56 0x78, and option 197 to 0x00 0xD0 0xDE 0x00. +`pxechn.c32 gpxelinux.0 -p http://10.1.1.4/tftp/ -w -X A012345678 -x 197:00d0de00`:: + Load gpxelinux.0 (relative to the current directory and not altering sname/option 66), set the PXELINUX path prefix, wait after loading, set option 160 to 0x12 0x34 0x56 0x78, and option 197 to 0x00 0xD0 0xDE 0x00. -pxechn.c32 10.1.1.8:boot\x86\wdsnbp.com -W -pxechn.c32 10.1.1.4:boot\x86\wdsnbp.com -W -o 66.x=0a:01:01:08 -S - These are similar but not identical. Load wdsnbp.com (first example from 10.1.1.8 and the second from 10.1.1.4) but point the packets at 10.1.1.8 for use with WDS. DHCP Option 66 will be placed in DHCP field sname when there's room. -S decodes this to an IPv4 address. +`pxechn.c32 gpxelinux.0 -p http://10.1.1.4/tftp/ -w -X A012:3456:78 -x 197:00-d0-de-00`:: + Equivalent to the above example. + +`pxechn.c32 10.1.1.8:boot\x86\wdsnbp.com -W`:: + Load wdsnbp.com from 10.1.1.8 and copy DHCP Option 66 to DHCP field sname if there's room. + +`pxechn.c32 10.1.1.4:boot\x86\wdsnbp.com -W -o 66.x=0a:01:01:08 -S`:: + Load wdsnbp.com from 10.1.1.4, point packets to 10.1.1.8 for use with WDS, copy DHCP Option 66 to DHCP field sname if there's room and decode this to an IPv4 address. == NOTES == @@ -91,7 +96,7 @@ Please note that some NBPs may ignore packet #3 by either not examining it at al URL specifications in 'FILE' that include user/password before the host will currently cause the siaddr field to not be set properly. -The non-space constraint is due to how Syslinux variants parse the command line as of 2012-05-31. +The non-space constraint is due to how Syslinux variants parse the command line as of 2012-09-03. == AUTHOR == @@ -100,4 +105,5 @@ The non-space constraint is due to how Syslinux variants parse the command line == COPYRIGHT == Copyright \(C) 2012 {author}. Free use of this software is granted under -the terms of the GNU General Public License (GPL). +the terms of the GNU General Public License (GPL), version 2 (GPLv2) +(or, at your option, any later version). -- cgit v1.2.1 From a8400f4d8334836088d5f3b9786e69c2063649e5 Mon Sep 17 00:00:00 2001 From: Gene Cumm Date: Mon, 3 Sep 2012 14:13:11 -0400 Subject: doc/pxechn.txt: word wrap Signed-off-by: Gene Cumm --- doc/pxechn.txt | 66 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/doc/pxechn.txt b/doc/pxechn.txt index a747b744..bc2e8c21 100644 --- a/doc/pxechn.txt +++ b/doc/pxechn.txt @@ -17,7 +17,11 @@ pxechn.c32 - Chainboot to new Network Boot Program == DESCRIPTION == -Chainboot to a new NBP (Network Boot Program) 'FILE' with options to adjust PXE packet #3 (PXENV_PACKET_TYPE_CACHED_REPLY) to alter end behavior. 'FILE' may be a filename, an IP::FN ( 192.168.1.1::path/to/file.0 ), or URL. 'FILE' is parsed to adjust the DHCP 'sname' field/option 66 and 'file' field/option 67. +Chainboot to a new NBP (Network Boot Program) 'FILE' with options to +adjust PXE packet #3 (PXENV_PACKET_TYPE_CACHED_REPLY) to alter end +behavior. 'FILE' may be a filename, an IP::FN ( +192.168.1.1::path/to/file.0 ), or URL. 'FILE' is parsed to adjust the +DHCP 'sname' field/option 66 and 'file' field/option 67. // but these may be override-able in the future. @@ -32,7 +36,8 @@ Chainboot to a new NBP (Network Boot Program) 'FILE' with options to adjust PXE // Set 'gateway'/relay DHCP field to 'HOST'. Parsed by pxe_dns(). // *-h*, *--help*, *-?*:: - Print 'help'/usage information; invalid options will also cause this. + Print 'help'/usage information; invalid options will also cause + this. // *-n*:: // Use 'native' methods, ignoring underlying gPXE/iPXE. @@ -41,16 +46,24 @@ Chainboot to a new NBP (Network Boot Program) 'FILE' with options to adjust PXE // Use 'non-native' methods to utilize gPXE/iPXE (if available). // *-o* 'OPT.TYPE=VALUE':: - Set 'option'. 'OPT' is in 'DECIMAL INPUT' format (below). 'TYPE' specifies the output type and input syntax. ''b'yte', ''w'ord'(2B), ''l'ong'(4B), ''q'uad'(8B), character ''s'tring' and colon-separated 'he'x'' string (case insensitive; bytes must have 2 digits and each byte must be separated). byte, word, long and quad input values must meet criteria for 'DECIMAL INPUT' + Set 'option'. 'OPT' is in 'DECIMAL INPUT' format (below). 'TYPE' + specifies the output type and input syntax (listed here in quotes + and at present, 1 character). ''b'yte', ''w'ord'(2B), ''l'ong'(4B), + ''q'uad'(8B), character ''s'tring' and colon-separated 'he'x'' + string (case insensitive; bytes must have 2 digits and each byte + must be separated). byte, word, long and quad input values must + meet criteria for 'DECIMAL INPUT' *-p* 'PATH':: 'path' option for PXELINUX (DHCP Option 210). *-r*:: - 'restart'. Call the PXE stack with PXENV_RESTART_TFTP. _Must_ be the only option and before 'FILE'. + 'restart'. Call the PXE stack with PXENV_RESTART_TFTP. _Must_ be + the only option and before 'FILE'. *-S*:: - Set 'sip' based on sname field/option 66 (by direct IP if a period-delimited address or otherwise DNS). + Set 'sip' based on sname field/option 66 (by direct IP if a + period-delimited address or otherwise DNS). *-t* 'SECONDS':: 'timeout' option for PXELINUX (DHCP Option 211). @@ -62,41 +75,60 @@ Chainboot to a new NBP (Network Boot Program) 'FILE' with options to adjust PXE 'wait'. After loading, wait for user input before booting. *-W*:: - Enable 'WDS' (Windows Deployment Services) - specific options. 'FILE' (or its overrides for DHCP fields siaddr and file) must point at the WDS server. - *NOTE:* As of 2012-05-31, there is a known issue with gPXE/iPXE, at least with undionly.kkpxe. + Enable 'WDS' (Windows Deployment Services) - specific options. + 'FILE' (or its overrides for DHCP fields siaddr and file) must point + at the WDS server. + *NOTE:* As of 2012-05-31, there is a known issue with gPXE/iPXE, at + least with undionly.kkpxe. // PXELINUX asks gPXE/iPXE to unload, reverting to an underlying stack == DECIMAL INPUT == -All parameters that are defaulted to decimal format are processed by *strtoul*(3) with a base of 0 which allows alternate formats and finds a suitable non-space separating character. +All parameters that are defaulted to decimal format are processed by +*strtoul*(3) with a base of 0 which allows alternate formats and finds a +suitable non-space separating character. == EXAMPLES == `pxechn.c32 http://myhost.dom.loc/path/nbp.0 -c myconfig`:: - Load nbp.0 and set PXELINUX config (option 209). + Load nbp.0 and set PXELINUX config (option 209). `pxechn.c32 gpxelinux.0 -p http://10.1.1.4/tftp/ -w -c myconfig -o 15.s=domain.loc -o 6.x=0A:01:01:02:ac:17:4D:Ec -`:: - Load gpxelinux.0 from the current directory, set prefix, wait to execute, set first config, set the domain name and 2 domain name servers (case mixed to show insensitivity; 10.1.1.2 and 172.23.77.236). + Load gpxelinux.0 from the current directory, set prefix, wait to + execute, set first config, set the domain name and 2 domain name + servers (case mixed to show insensitivity; 10.1.1.2 and + 172.23.77.236). `pxechn.c32 gpxelinux.0 -p http://10.1.1.4/tftp/ -w -X A012345678 -x 197:00d0de00`:: - Load gpxelinux.0 (relative to the current directory and not altering sname/option 66), set the PXELINUX path prefix, wait after loading, set option 160 to 0x12 0x34 0x56 0x78, and option 197 to 0x00 0xD0 0xDE 0x00. + Load gpxelinux.0 (relative to the current directory and not + altering sname/option 66), set the PXELINUX path prefix, wait after + loading, set option 160 to 0x12 0x34 0x56 0x78, and option 197 to + 0x00 0xD0 0xDE 0x00. `pxechn.c32 gpxelinux.0 -p http://10.1.1.4/tftp/ -w -X A012:3456:78 -x 197:00-d0-de-00`:: - Equivalent to the above example. + Equivalent to the above example. `pxechn.c32 10.1.1.8:boot\x86\wdsnbp.com -W`:: - Load wdsnbp.com from 10.1.1.8 and copy DHCP Option 66 to DHCP field sname if there's room. + Load wdsnbp.com from 10.1.1.8 and copy DHCP Option 66 to DHCP + field sname if there's room. `pxechn.c32 10.1.1.4:boot\x86\wdsnbp.com -W -o 66.x=0a:01:01:08 -S`:: - Load wdsnbp.com from 10.1.1.4, point packets to 10.1.1.8 for use with WDS, copy DHCP Option 66 to DHCP field sname if there's room and decode this to an IPv4 address. + Load wdsnbp.com from 10.1.1.4, point packets to 10.1.1.8 for use + with WDS, copy DHCP Option 66 to DHCP field sname if there's room + and decode this to an IPv4 address. == NOTES == -Please note that some NBPs may ignore packet #3 by either not examining it at all or by issuing its own DHCP DISCOVER/REQUEST, negating all DHCP field/option modifications by pxechn.c32, including Microsoft Windows Server 2008R2 WDS's wdsnbp.com. +Please note that some NBPs may ignore packet #3 by either not examining +it at all or by issuing its own DHCP DISCOVER/REQUEST, negating all DHCP +field/option modifications by pxechn.c32, including Microsoft Windows +Server 2008R2 WDS's wdsnbp.com. -URL specifications in 'FILE' that include user/password before the host will currently cause the siaddr field to not be set properly. +URL specifications in 'FILE' that include user/password before the host +will currently cause the siaddr field to not be set properly. -The non-space constraint is due to how Syslinux variants parse the command line as of 2012-09-03. +The non-space constraint is due to how Syslinux variants parse the +command line as of 2012-09-03. == AUTHOR == -- cgit v1.2.1 From e7fa638d4dd3e96796a99989ed537935ca118dea Mon Sep 17 00:00:00 2001 From: Gene Cumm Date: Thu, 6 Sep 2012 18:27:30 -0400 Subject: doc/pxechn.txt: Fix old example Command line options changed. Signed-off-by: Gene Cumm --- doc/pxechn.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/doc/pxechn.txt b/doc/pxechn.txt index bc2e8c21..7e31d12a 100644 --- a/doc/pxechn.txt +++ b/doc/pxechn.txt @@ -99,15 +99,12 @@ suitable non-space separating character. servers (case mixed to show insensitivity; 10.1.1.2 and 172.23.77.236). -`pxechn.c32 gpxelinux.0 -p http://10.1.1.4/tftp/ -w -X A012345678 -x 197:00d0de00`:: +`pxechn.c32 gpxelinux.0 -p http://10.1.1.4/tftp/ -w -o 0xA0.x=12:34:56:78 -x 197.x=00:d0:de:00`:: Load gpxelinux.0 (relative to the current directory and not altering sname/option 66), set the PXELINUX path prefix, wait after loading, set option 160 to 0x12 0x34 0x56 0x78, and option 197 to 0x00 0xD0 0xDE 0x00. -`pxechn.c32 gpxelinux.0 -p http://10.1.1.4/tftp/ -w -X A012:3456:78 -x 197:00-d0-de-00`:: - Equivalent to the above example. - `pxechn.c32 10.1.1.8:boot\x86\wdsnbp.com -W`:: Load wdsnbp.com from 10.1.1.8 and copy DHCP Option 66 to DHCP field sname if there's room. -- cgit v1.2.1 From 85dba2c3058996d72def4a44304df882da3aa807 Mon Sep 17 00:00:00 2001 From: Gene Cumm Date: Sun, 16 Sep 2012 11:19:41 -0400 Subject: doc/pxechn.txt: update Signed-off-by: Gene Cumm --- doc/pxechn.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/pxechn.txt b/doc/pxechn.txt index 7e31d12a..7853d9ab 100644 --- a/doc/pxechn.txt +++ b/doc/pxechn.txt @@ -2,11 +2,11 @@ :doctype: manpage :author: Gene Cumm :email: gene.cumm@gmail.com -:revdate: 2012-09-03 +:revdate: 2012-09-16 == NAME == -pxechn.c32 - Chainboot to new Network Boot Program +pxechn.c32 - Chainboot to new Network Boot Program (NBP) == SYNOPSIS == @@ -17,7 +17,7 @@ pxechn.c32 - Chainboot to new Network Boot Program == DESCRIPTION == -Chainboot to a new NBP (Network Boot Program) 'FILE' with options to +Chainboot to a new Network Boot Program (NBP) 'FILE' with options to adjust PXE packet #3 (PXENV_PACKET_TYPE_CACHED_REPLY) to alter end behavior. 'FILE' may be a filename, an IP::FN ( 192.168.1.1::path/to/file.0 ), or URL. 'FILE' is parsed to adjust the @@ -119,13 +119,13 @@ suitable non-space separating character. Please note that some NBPs may ignore packet #3 by either not examining it at all or by issuing its own DHCP DISCOVER/REQUEST, negating all DHCP field/option modifications by pxechn.c32, including Microsoft Windows -Server 2008R2 WDS's wdsnbp.com. +Server 2008R2 WDS's wdsnbp.com. See also option '-W'. URL specifications in 'FILE' that include user/password before the host will currently cause the siaddr field to not be set properly. The non-space constraint is due to how Syslinux variants parse the -command line as of 2012-09-03. +command line as of 2012-09-16. == AUTHOR == -- cgit v1.2.1