You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. #ifndef _BOOTP_H
  2. #define _BOOTP_H
  3. #ifdef ALTERNATE_DHCP_PORTS_1067_1068
  4. #undef NON_STANDARD_BOOTP_SERVER
  5. #define NON_STANDARD_BOOTP_SERVER 1067
  6. #undef NON_STANDARD_BOOTP_CLIENT
  7. #define NON_STANDARD_BOOTP_CLIENT 1068
  8. #endif
  9. #ifdef NON_STANDARD_BOOTP_SERVER
  10. #define BOOTP_SERVER NON_STANDARD_BOOTP_SERVER
  11. #else
  12. #define BOOTP_SERVER 67
  13. #endif
  14. #ifdef NON_STANDARD_BOOTP_CLIENT
  15. #define BOOTP_CLIENT NON_STANDARD_BOOTP_CLIENT
  16. #else
  17. #define BOOTP_CLIENT 68
  18. #endif
  19. #define PROXYDHCP_SERVER 4011 /* For PXE */
  20. #define BOOTP_REQUEST 1
  21. #define BOOTP_REPLY 2
  22. #define TAG_LEN(p) (*((p)+1))
  23. #define RFC1533_COOKIE 99, 130, 83, 99
  24. #define RFC1533_PAD 0
  25. #define RFC1533_NETMASK 1
  26. #define RFC1533_TIMEOFFSET 2
  27. #define RFC1533_GATEWAY 3
  28. #define RFC1533_TIMESERVER 4
  29. #define RFC1533_IEN116NS 5
  30. #define RFC1533_DNS 6
  31. #define RFC1533_LOGSERVER 7
  32. #define RFC1533_COOKIESERVER 8
  33. #define RFC1533_LPRSERVER 9
  34. #define RFC1533_IMPRESSSERVER 10
  35. #define RFC1533_RESOURCESERVER 11
  36. #define RFC1533_HOSTNAME 12
  37. #define RFC1533_BOOTFILESIZE 13
  38. #define RFC1533_MERITDUMPFILE 14
  39. #define RFC1533_DOMAINNAME 15
  40. #define RFC1533_SWAPSERVER 16
  41. #define RFC1533_ROOTPATH 17
  42. #define RFC1533_EXTENSIONPATH 18
  43. #define RFC1533_IPFORWARDING 19
  44. #define RFC1533_IPSOURCEROUTING 20
  45. #define RFC1533_IPPOLICYFILTER 21
  46. #define RFC1533_IPMAXREASSEMBLY 22
  47. #define RFC1533_IPTTL 23
  48. #define RFC1533_IPMTU 24
  49. #define RFC1533_IPMTUPLATEAU 25
  50. #define RFC1533_INTMTU 26
  51. #define RFC1533_INTLOCALSUBNETS 27
  52. #define RFC1533_INTBROADCAST 28
  53. #define RFC1533_INTICMPDISCOVER 29
  54. #define RFC1533_INTICMPRESPOND 30
  55. #define RFC1533_INTROUTEDISCOVER 31
  56. #define RFC1533_INTROUTESOLICIT 32
  57. #define RFC1533_INTSTATICROUTES 33
  58. #define RFC1533_LLTRAILERENCAP 34
  59. #define RFC1533_LLARPCACHETMO 35
  60. #define RFC1533_LLETHERNETENCAP 36
  61. #define RFC1533_TCPTTL 37
  62. #define RFC1533_TCPKEEPALIVETMO 38
  63. #define RFC1533_TCPKEEPALIVEGB 39
  64. #define RFC1533_NISDOMAIN 40
  65. #define RFC1533_NISSERVER 41
  66. #define RFC1533_NTPSERVER 42
  67. #define RFC1533_VENDOR 43
  68. #define RFC1533_NBNS 44
  69. #define RFC1533_NBDD 45
  70. #define RFC1533_NBNT 46
  71. #define RFC1533_NBSCOPE 47
  72. #define RFC1533_XFS 48
  73. #define RFC1533_XDM 49
  74. #ifndef NO_DHCP_SUPPORT
  75. #define RFC2132_REQ_ADDR 50
  76. #define RFC2132_MSG_TYPE 53
  77. #define RFC2132_SRV_ID 54
  78. #define RFC2132_PARAM_LIST 55
  79. #define RFC2132_MAX_SIZE 57
  80. #define RFC2132_VENDOR_CLASS_ID 60
  81. #define RFC2132_CLIENT_ID 61
  82. #define RFC2132_TFTP_SERVER_NAME 66
  83. #define RFC2132_BOOTFILE_NAME 67
  84. #define RFC3004_USER_CLASS 77
  85. #ifdef PXE_DHCP_STRICT
  86. /*
  87. * The following options are acknowledged in RFC3679 because they are
  88. * widely used by PXE implementations, but have never been properly
  89. * allocated. Despite other PXE options being correctly packed in a
  90. * vendor encapsulated field, these are exposed. Sigh. Note that the
  91. * client UUID (option 97) is also noted in the PXE spec as using
  92. * option 61.
  93. */
  94. #define RFC3679_PXE_CLIENT_ARCH 93
  95. #define RFC3679_PXE_CLIENT_NDI 94
  96. #define RFC3679_PXE_CLIENT_UUID 97
  97. /* The lengths are fixed. */
  98. #define RFC3679_PXE_CLIENT_ARCH_LENGTH 2
  99. #define RFC3679_PXE_CLIENT_NDI_LENGTH 3
  100. #define RFC3679_PXE_CLIENT_UUID_LENGTH 17
  101. /*
  102. * Values of RFC3679_PXE_CLIENT_ARCH can apparently be one of the
  103. * following, according to the PXE spec. The spec only actually
  104. * described the 2nd octet, not the first. Duh... assume 0.
  105. */
  106. #define RFC3679_PXE_CLIENT_ARCH_IAX86PC 0,0
  107. #define RFC3679_PXE_CLIENT_ARCH_NECPC98 0,1
  108. #define RFC3679_PXE_CLIENT_ARCH_IA64PC 0,2
  109. #define RFC3679_PXE_CLIENT_ARCH_DECALPHA 0,3
  110. #define RFC3679_PXE_CLIENT_ARCH_ARCX86 0,4
  111. #define RFC3679_PXE_CLIENT_ARCH_INTELLEAN 0,5
  112. /*
  113. * Only one valid value of NDI type (must be 1) and UNDI version (must
  114. * be 2.1)
  115. */
  116. #define RFC3679_PXE_CLIENT_NDI_21 1,2,1
  117. /*
  118. * UUID - type must be 1 and then 16 octets of UID, as with the client ID.
  119. * The value is a default for testing only
  120. */
  121. #define RFC3679_PXE_CLIENT_UUID_TYPE 0
  122. #warning "UUID is a default for testing ONLY!"
  123. #define RFC3679_PXE_CLIENT_UUID_DEFAULT \
  124. RFC3679_PXE_CLIENT_UUID_TYPE, \
  125. 0xDE,0xAD,0xBE,0xEF, \
  126. 0xDE,0xAD,0xBE,0xEF, \
  127. 0xDE,0xAD,0xBE,0xEF, \
  128. 0xDE,0xAD,0xBE,0xEF
  129. /*
  130. * The Vendor Class ID. Note that the Arch and UNDI version numbers
  131. * are fixed and must be same as the ARCH and NDI above.
  132. */
  133. #define RFC2132_VENDOR_CLASS_ID_PXE_LENGTH 32
  134. #define RFC2132_VENDOR_CLASS_ID_PXE \
  135. 'P','X','E','C','l','i','e','n','t',':', \
  136. 'A','r','c','h',':','0','0','0','0','0',':', \
  137. 'U','N','D','I',':','0','0','2','0','0','1'
  138. /*
  139. * The following vendor options are required in the PXE spec to pull
  140. * options for the *next* image. The PXE spec doesn't help us with
  141. * this (like explaining why).
  142. */
  143. #define RFC1533_VENDOR_PXE_OPT128 128
  144. #define RFC1533_VENDOR_PXE_OPT129 129
  145. #define RFC1533_VENDOR_PXE_OPT130 130
  146. #define RFC1533_VENDOR_PXE_OPT131 131
  147. #define RFC1533_VENDOR_PXE_OPT132 132
  148. #define RFC1533_VENDOR_PXE_OPT133 133
  149. #define RFC1533_VENDOR_PXE_OPT134 134
  150. #define RFC1533_VENDOR_PXE_OPT135 135
  151. #endif /* PXE_DHCP_STRICT */
  152. #define DHCPDISCOVER 1
  153. #define DHCPOFFER 2
  154. #define DHCPREQUEST 3
  155. #define DHCPACK 5
  156. #endif /* NO_DHCP_SUPPORT */
  157. #define RFC1533_VENDOR_MAJOR 0
  158. #define RFC1533_VENDOR_MINOR 0
  159. #define RFC1533_VENDOR_MAGIC 128
  160. #define RFC1533_VENDOR_ADDPARM 129
  161. #define RFC1533_VENDOR_ETHDEV 130
  162. /* We should really apply for an official Etherboot encap option */
  163. #define RFC1533_VENDOR_ETHERBOOT_ENCAP 150
  164. /* I'll leave it to FREEBSD to decide if they want to renumber */
  165. #ifdef IMAGE_FREEBSD
  166. #define RFC1533_VENDOR_HOWTO 132
  167. #define RFC1533_VENDOR_KERNEL_ENV 133
  168. #endif
  169. #define RFC1533_VENDOR_NIC_DEV_ID 175
  170. #define RFC1533_VENDOR_ARCH 177
  171. #define RFC1533_END 255
  172. #define BOOTP_VENDOR_LEN 64
  173. #ifndef NO_DHCP_SUPPORT
  174. #define DHCP_OPT_LEN 312
  175. #endif /* NO_DHCP_SUPPORT */
  176. /* Format of a bootp packet */
  177. struct bootp_t {
  178. uint8_t bp_op;
  179. uint8_t bp_htype;
  180. uint8_t bp_hlen;
  181. uint8_t bp_hops;
  182. uint32_t bp_xid;
  183. uint16_t bp_secs;
  184. uint16_t unused;
  185. in_addr bp_ciaddr;
  186. in_addr bp_yiaddr;
  187. in_addr bp_siaddr;
  188. in_addr bp_giaddr;
  189. uint8_t bp_hwaddr[16];
  190. uint8_t bp_sname[64];
  191. char bp_file[128];
  192. #ifdef NO_DHCP_SUPPORT
  193. uint8_t bp_vend[BOOTP_VENDOR_LEN];
  194. #else
  195. uint8_t bp_vend[DHCP_OPT_LEN];
  196. #endif /* NO_DHCP_SUPPORT */
  197. };
  198. /* Format of a bootp IP packet */
  199. struct bootpip_t
  200. {
  201. struct iphdr ip;
  202. struct udphdr udp;
  203. struct bootp_t bp;
  204. };
  205. /* Format of bootp packet with extensions */
  206. struct bootpd_t {
  207. struct bootp_t bootp_reply;
  208. uint8_t bootp_extension[MAX_BOOTP_EXTLEN];
  209. };
  210. #endif /* _BOOTP_H */