Browse Source

[pxe] Skip PXE boot server discovery if directed to do so

Option 43.6 can direct us to skip PXE boot server discovery and just
perform a standard DHCP filename boot.
tags/v0.9.7
Michael Brown 16 years ago
parent
commit
ff2b308506
2 changed files with 30 additions and 6 deletions
  1. 15
    0
      src/include/gpxe/dhcp.h
  2. 15
    6
      src/usr/autoboot.c

+ 15
- 0
src/include/gpxe/dhcp.h View File

@@ -82,6 +82,21 @@ struct dhcp_packet;
82 82
 /** Vendor encapsulated options */
83 83
 #define DHCP_VENDOR_ENCAP 43
84 84
 
85
+/** PXE boot server discovery control */
86
+#define DHCP_PXE_DISCOVERY_CONTROL DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 6 )
87
+
88
+/** PXE boot server discovery control bits */
89
+enum dhcp_pxe_discovery_control {
90
+	/** Inhibit broadcast discovery */
91
+	PXEBS_NO_BROADCAST = 1,
92
+	/** Inhibit multicast discovery */
93
+	PXEBS_NO_MULTICAST = 2,
94
+	/** Accept only servers in DHCP_PXE_BOOT_SERVERS list */
95
+	PXEBS_NO_UNKNOWN_SERVERS = 4,
96
+	/** Skip discovery if filename present */
97
+	PXEBS_SKIP = 8,
98
+};
99
+
85 100
 /** PXE boot server multicast address */
86 101
 #define DHCP_PXE_BOOT_SERVER_MCAST DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 7 )
87 102
 

+ 15
- 6
src/usr/autoboot.c View File

@@ -167,9 +167,15 @@ int boot_root_path ( const char *root_path ) {
167 167
  * @ret rc		Return status code
168 168
  */
169 169
 static int netboot ( struct net_device *netdev ) {
170
-	struct setting tmp_setting = { .name = NULL };
170
+	struct setting vendor_class_id_setting
171
+		= { .tag = DHCP_VENDOR_CLASS_ID };
172
+	struct setting pxe_discovery_control_setting
173
+		= { .tag = DHCP_PXE_DISCOVERY_CONTROL };
174
+	struct setting pxe_boot_menu_setting
175
+		= { .tag = DHCP_PXE_BOOT_MENU };
171 176
 	char buf[256];
172 177
 	struct in_addr next_server;
178
+	unsigned int pxe_discovery_control;
173 179
 	int rc;
174 180
 
175 181
 	/* Open device and display device status */
@@ -195,12 +201,15 @@ static int netboot ( struct net_device *netdev ) {
195 201
 	if ( rc != ENOENT )
196 202
 		return rc;
197 203
 
198
-	/* Try PXE menu boot, if we have PXE menu options */
199
-	tmp_setting.tag = DHCP_VENDOR_CLASS_ID;
200
-	fetch_string_setting ( NULL, &tmp_setting, buf, sizeof ( buf ) );
201
-	tmp_setting.tag = DHCP_PXE_BOOT_MENU;
204
+	/* Try PXE menu boot, if applicable */
205
+	fetch_string_setting ( NULL, &vendor_class_id_setting,
206
+			       buf, sizeof ( buf ) );
207
+	pxe_discovery_control =
208
+		fetch_uintz_setting ( NULL, &pxe_discovery_control_setting );
202 209
 	if ( ( strcmp ( buf, "PXEClient" ) == 0 ) &&
203
-	     setting_exists ( NULL, &tmp_setting ) ) {
210
+	     setting_exists ( NULL, &pxe_boot_menu_setting ) &&
211
+	     ( ! ( ( pxe_discovery_control & PXEBS_SKIP ) &&
212
+		   setting_exists ( NULL, &filename_setting ) ) ) ) {
204 213
 		printf ( "Booting from PXE menu\n" );
205 214
 		return pxe_menu_boot ( netdev );
206 215
 	}

Loading…
Cancel
Save