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