Browse Source

[dhcp] Include gPXE version number within DHCP request

tags/v0.9.7
Michael Brown 16 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
 VERSION		= $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION)
123
 VERSION		= $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION)
124
 CFLAGS		+= -DVERSION_MAJOR=$(VERSION_MAJOR) \
124
 CFLAGS		+= -DVERSION_MAJOR=$(VERSION_MAJOR) \
125
 		   -DVERSION_MINOR=$(VERSION_MINOR) \
125
 		   -DVERSION_MINOR=$(VERSION_MINOR) \
126
+		   -DVERSION_PATCH=$(VERSION_PATCH) \
126
 		   -DVERSION=\"$(VERSION)\"
127
 		   -DVERSION=\"$(VERSION)\"
127
 IDENT		= '$(@F) $(VERSION) (GPL) etherboot.org'
128
 IDENT		= '$(@F) $(VERSION) (GPL) etherboot.org'
128
 version :
129
 version :

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

260
  */
260
  */
261
 #define DHCP_EB_REVERSE_PASSWORD DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xc1 )
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
 /** iSCSI primary target IQN */
266
 /** iSCSI primary target IQN */
264
 #define DHCP_ISCSI_PRIMARY_TARGET_IQN 201
267
 #define DHCP_ISCSI_PRIMARY_TARGET_IQN 201
265
 
268
 

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

51
 /** @} */
51
 /** @} */
52
 
52
 
53
 /** Declare a feature code for DHCP */
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
 /** Construct a DHCP feature table entry */
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
 /** A named feature */
66
 /** A named feature */
87
 /** Declare a feature */
86
 /** Declare a feature */
88
 #define FEATURE( category, text, feature_opt, version )			    \
87
 #define FEATURE( category, text, feature_opt, version )			    \
89
 	FEATURE_NAME ( category, text );				    \
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
 #endif /* _GPXE_FEATURES_H */
95
 #endif /* _GPXE_FEATURES_H */

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

38
 #include <gpxe/dhcp.h>
38
 #include <gpxe/dhcp.h>
39
 #include <gpxe/dhcpopts.h>
39
 #include <gpxe/dhcpopts.h>
40
 #include <gpxe/dhcppkt.h>
40
 #include <gpxe/dhcppkt.h>
41
+#include <gpxe/features.h>
41
 
42
 
42
 /** @file
43
 /** @file
43
  *
44
  *
93
 static uint8_t dhcp_features[0] __table_start ( uint8_t, dhcp_features );
94
 static uint8_t dhcp_features[0] __table_start ( uint8_t, dhcp_features );
94
 static uint8_t dhcp_features_end[0] __table_end ( uint8_t, dhcp_features );
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
 /** DHCP network device descriptor */
100
 /** DHCP network device descriptor */
97
 struct dhcp_netdev_desc {
101
 struct dhcp_netdev_desc {
98
 	/** Bus type ID */
102
 	/** Bus type ID */

Loading…
Cancel
Save