Browse Source

[dhcp] Include gPXE version number within DHCP request

tags/v0.9.7
Michael Brown 15 years ago
parent
commit
ba1016f378
4 changed files with 21 additions and 10 deletions
  1. 1
    0
      src/Makefile
  2. 3
    0
      src/include/gpxe/dhcp.h
  3. 13
    10
      src/include/gpxe/features.h
  4. 4
    0
      src/net/udp/dhcp.c

+ 1
- 0
src/Makefile View File

@@ -123,6 +123,7 @@ MM_VERSION	= $(VERSION_MAJOR).$(VERSION_MINOR)
123 123
 VERSION		= $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION)
124 124
 CFLAGS		+= -DVERSION_MAJOR=$(VERSION_MAJOR) \
125 125
 		   -DVERSION_MINOR=$(VERSION_MINOR) \
126
+		   -DVERSION_PATCH=$(VERSION_PATCH) \
126 127
 		   -DVERSION=\"$(VERSION)\"
127 128
 IDENT		= '$(@F) $(VERSION) (GPL) etherboot.org'
128 129
 version :

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

@@ -260,6 +260,9 @@ struct dhcp_packet;
260 260
  */
261 261
 #define DHCP_EB_REVERSE_PASSWORD DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xc1 )
262 262
 
263
+/** gPXE version number */
264
+#define DHCP_EB_VERSION DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xeb )
265
+
263 266
 /** iSCSI primary target IQN */
264 267
 #define DHCP_ISCSI_PRIMARY_TARGET_IQN 201
265 268
 

+ 13
- 10
src/include/gpxe/features.h View File

@@ -51,17 +51,16 @@
51 51
 /** @} */
52 52
 
53 53
 /** Declare a feature code for DHCP */
54
-#define __dhcp_feature( category )					    \
55
-	 __table ( uint8_t, dhcp_features, category )
54
+#define __dhcp_feature __table ( uint8_t, dhcp_features, 01 )
56 55
 
57 56
 /** Construct a DHCP feature table entry */
58
-#define DHCP_FEATURE( category, feature_opt, version )			    \
59
-	_DHCP_FEATURE ( category, OBJECT, feature_opt, version )
60
-#define _DHCP_FEATURE( category, _name, feature_opt, version )		    \
61
-	__DHCP_FEATURE ( category, _name, feature_opt, version )
62
-#define __DHCP_FEATURE( category, _name, feature_opt, version )		    \
63
-	uint8_t __dhcp_feature_ ## _name [] __dhcp_feature ( category ) = { \
64
-		feature_opt, DHCP_BYTE ( version )			    \
57
+#define DHCP_FEATURE( feature_opt, ... )				    \
58
+	_DHCP_FEATURE ( OBJECT, feature_opt, __VA_ARGS__ )
59
+#define _DHCP_FEATURE( _name, feature_opt, ... )			    \
60
+	__DHCP_FEATURE ( _name, feature_opt, __VA_ARGS__ )
61
+#define __DHCP_FEATURE( _name, feature_opt, ... )			    \
62
+	uint8_t __dhcp_feature_ ## _name [] __dhcp_feature = {		    \
63
+		feature_opt, DHCP_OPTION ( __VA_ARGS__ )		    \
65 64
 	};
66 65
 
67 66
 /** A named feature */
@@ -87,6 +86,10 @@ struct feature {
87 86
 /** Declare a feature */
88 87
 #define FEATURE( category, text, feature_opt, version )			    \
89 88
 	FEATURE_NAME ( category, text );				    \
90
-	DHCP_FEATURE ( category, feature_opt, version );
89
+	DHCP_FEATURE ( feature_opt, version );
90
+
91
+/** Declare the version number feature */
92
+#define FEATURE_VERSION( ... )						    \
93
+	DHCP_FEATURE ( DHCP_ENCAPSULATED ( DHCP_EB_VERSION ), __VA_ARGS__ )
91 94
 
92 95
 #endif /* _GPXE_FEATURES_H */

+ 4
- 0
src/net/udp/dhcp.c View File

@@ -38,6 +38,7 @@
38 38
 #include <gpxe/dhcp.h>
39 39
 #include <gpxe/dhcpopts.h>
40 40
 #include <gpxe/dhcppkt.h>
41
+#include <gpxe/features.h>
41 42
 
42 43
 /** @file
43 44
  *
@@ -93,6 +94,9 @@ static struct dhcp_options dhcp_request_options = {
93 94
 static uint8_t dhcp_features[0] __table_start ( uint8_t, dhcp_features );
94 95
 static uint8_t dhcp_features_end[0] __table_end ( uint8_t, dhcp_features );
95 96
 
97
+/** Version number feature */
98
+FEATURE_VERSION ( VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH );
99
+
96 100
 /** DHCP network device descriptor */
97 101
 struct dhcp_netdev_desc {
98 102
 	/** Bus type ID */

Loading…
Cancel
Save