1 /* $OpenBSD: bootp.h,v 1.8 2007/10/07 16:41:05 deraadt Exp $ */ 2 3 /* @(#) $Id: bootp.h,v 1.8 2007/10/07 16:41:05 deraadt Exp $ (LBL) */ 4 /* 5 * Bootstrap Protocol (BOOTP). RFC951 and RFC1048. 6 * 7 * This file specifies the "implementation-independent" BOOTP protocol 8 * information which is common to both client and server. 9 * 10 * Copyright 1988 by Carnegie Mellon. 11 * 12 * Permission to use, copy, modify, and distribute this program for any 13 * purpose and without fee is hereby granted, provided that this copyright 14 * and permission notice appear on all copies and supporting documentation, 15 * the name of Carnegie Mellon not be used in advertising or publicity 16 * pertaining to distribution of the program without specific prior 17 * permission, and notice be given in supporting documentation that copying 18 * and distribution is by permission of Carnegie Mellon and Stanford 19 * University. Carnegie Mellon makes no representations about the 20 * suitability of this software for any purpose. It is provided "as is" 21 * without express or implied warranty. 22 */ 23 24 25 struct bootp { 26 unsigned char bp_op; /* packet opcode type */ 27 unsigned char bp_htype; /* hardware addr type */ 28 unsigned char bp_hlen; /* hardware addr length */ 29 unsigned char bp_hops; /* gateway hops */ 30 u_int32_t bp_xid; /* transaction ID */ 31 unsigned short bp_secs; /* seconds since boot began */ 32 unsigned short bp_flags; /* flags: 0x8000 is broadcast */ 33 struct in_addr bp_ciaddr; /* client IP address */ 34 struct in_addr bp_yiaddr; /* 'your' IP address */ 35 struct in_addr bp_siaddr; /* server IP address */ 36 struct in_addr bp_giaddr; /* gateway IP address */ 37 unsigned char bp_chaddr[16]; /* client hardware address */ 38 unsigned char bp_sname[64]; /* server host name */ 39 unsigned char bp_file[128]; /* boot file name */ 40 unsigned char bp_vend[64]; /* vendor-specific area */ 41 }; 42 43 /* 44 * UDP port numbers, server and client. 45 */ 46 #define IPPORT_BOOTPS 67 47 #define IPPORT_BOOTPC 68 48 49 #define BOOTREPLY 2 50 #define BOOTREQUEST 1 51 52 53 /* 54 * Vendor magic cookie (v_magic) for CMU 55 */ 56 #define VM_CMU "CMU" 57 58 /* 59 * Vendor magic cookie (v_magic) for RFC1048 60 */ 61 #define VM_RFC1048 { 99, 130, 83, 99 } 62 63 64 65 /* 66 * RFC1048 tag values used to specify what information is being supplied in 67 * the vendor field of the packet. 68 */ 69 70 #define TAG_PAD ((unsigned char) 0) 71 #define TAG_SUBNET_MASK ((unsigned char) 1) 72 #define TAG_TIME_OFFSET ((unsigned char) 2) 73 #define TAG_GATEWAY ((unsigned char) 3) 74 #define TAG_TIME_SERVER ((unsigned char) 4) 75 #define TAG_NAME_SERVER ((unsigned char) 5) 76 #define TAG_DOMAIN_SERVER ((unsigned char) 6) 77 #define TAG_LOG_SERVER ((unsigned char) 7) 78 #define TAG_COOKIE_SERVER ((unsigned char) 8) 79 #define TAG_LPR_SERVER ((unsigned char) 9) 80 #define TAG_IMPRESS_SERVER ((unsigned char) 10) 81 #define TAG_RLP_SERVER ((unsigned char) 11) 82 #define TAG_HOSTNAME ((unsigned char) 12) 83 #define TAG_BOOTSIZE ((unsigned char) 13) 84 #define TAG_END ((unsigned char) 255) 85 /* RFC1497 tags */ 86 #define TAG_DUMPPATH ((unsigned char) 14) 87 #define TAG_DOMAINNAME ((unsigned char) 15) 88 #define TAG_SWAP_SERVER ((unsigned char) 16) 89 #define TAG_ROOTPATH ((unsigned char) 17) 90 #define TAG_EXTPATH ((unsigned char) 18) 91 /* RFC2132 */ 92 #define TAG_IP_FORWARD ((unsigned char) 19) 93 #define TAG_NL_SRCRT ((unsigned char) 20) 94 #define TAG_PFILTERS ((unsigned char) 21) 95 #define TAG_REASS_SIZE ((unsigned char) 22) 96 #define TAG_DEF_TTL ((unsigned char) 23) 97 #define TAG_MTU_TIMEOUT ((unsigned char) 24) 98 #define TAG_MTU_TABLE ((unsigned char) 25) 99 #define TAG_INT_MTU ((unsigned char) 26) 100 #define TAG_LOCAL_SUBNETS ((unsigned char) 27) 101 #define TAG_BROAD_ADDR ((unsigned char) 28) 102 #define TAG_DO_MASK_DISC ((unsigned char) 29) 103 #define TAG_SUPPLY_MASK ((unsigned char) 30) 104 #define TAG_DO_RDISC ((unsigned char) 31) 105 #define TAG_RTR_SOL_ADDR ((unsigned char) 32) 106 #define TAG_STATIC_ROUTE ((unsigned char) 33) 107 #define TAG_USE_TRAILERS ((unsigned char) 34) 108 #define TAG_ARP_TIMEOUT ((unsigned char) 35) 109 #define TAG_ETH_ENCAP ((unsigned char) 36) 110 #define TAG_TCP_TTL ((unsigned char) 37) 111 #define TAG_TCP_KEEPALIVE ((unsigned char) 38) 112 #define TAG_KEEPALIVE_GO ((unsigned char) 39) 113 #define TAG_NIS_DOMAIN ((unsigned char) 40) 114 #define TAG_NIS_SERVERS ((unsigned char) 41) 115 #define TAG_NTP_SERVERS ((unsigned char) 42) 116 #define TAG_VENDOR_OPTS ((unsigned char) 43) 117 #define TAG_NETBIOS_NS ((unsigned char) 44) 118 #define TAG_NETBIOS_DDS ((unsigned char) 45) 119 #define TAG_NETBIOS_NODE ((unsigned char) 46) 120 #define TAG_NETBIOS_SCOPE ((unsigned char) 47) 121 #define TAG_XWIN_FS ((unsigned char) 48) 122 #define TAG_XWIN_DM ((unsigned char) 49) 123 #define TAG_NIS_P_DOMAIN ((unsigned char) 64) 124 #define TAG_NIS_P_SERVERS ((unsigned char) 65) 125 #define TAG_MOBILE_HOME ((unsigned char) 68) 126 #define TAG_SMPT_SERVER ((unsigned char) 69) 127 #define TAG_POP3_SERVER ((unsigned char) 70) 128 #define TAG_NNTP_SERVER ((unsigned char) 71) 129 #define TAG_WWW_SERVER ((unsigned char) 72) 130 #define TAG_FINGER_SERVER ((unsigned char) 73) 131 #define TAG_IRC_SERVER ((unsigned char) 74) 132 #define TAG_STREETTALK_SRVR ((unsigned char) 75) 133 #define TAG_STREETTALK_STDA ((unsigned char) 76) 134 /* DHCP options */ 135 #define TAG_REQUESTED_IP ((unsigned char) 50) 136 #define TAG_IP_LEASE ((unsigned char) 51) 137 #define TAG_OPT_OVERLOAD ((unsigned char) 52) 138 #define TAG_TFTP_SERVER ((unsigned char) 66) 139 #define TAG_BOOTFILENAME ((unsigned char) 67) 140 #define TAG_DHCP_MESSAGE ((unsigned char) 53) 141 #define TAG_SERVER_ID ((unsigned char) 54) 142 #define TAG_PARM_REQUEST ((unsigned char) 55) 143 #define TAG_MESSAGE ((unsigned char) 56) 144 #define TAG_MAX_MSG_SIZE ((unsigned char) 57) 145 #define TAG_RENEWAL_TIME ((unsigned char) 58) 146 #define TAG_REBIND_TIME ((unsigned char) 59) 147 #define TAG_VENDOR_CLASS ((unsigned char) 60) 148 #define TAG_CLIENT_ID ((unsigned char) 61) 149 150 /* DHCP Message types (values for TAG_DHCP_MESSAGE option) */ 151 #define DHCPDISCOVER 1 152 #define DHCPOFFER 2 153 #define DHCPREQUEST 3 154 #define DHCPDECLINE 4 155 #define DHCPACK 5 156 #define DHCPNAK 6 157 #define DHCPRELEASE 7 158 #define DHCPINFORM 8 159 160 161 /* 162 * "vendor" data permitted for CMU bootp clients. 163 */ 164 165 struct cmu_vend { 166 unsigned char v_magic[4]; /* magic number */ 167 u_int32_t v_flags; /* flags/opcodes, etc. */ 168 struct in_addr v_smask; /* Subnet mask */ 169 struct in_addr v_dgate; /* Default gateway */ 170 struct in_addr v_dns1, v_dns2; /* Domain name servers */ 171 struct in_addr v_ins1, v_ins2; /* IEN-116 name servers */ 172 struct in_addr v_ts1, v_ts2; /* Time servers */ 173 unsigned char v_unused[24]; /* currently unused */ 174 }; 175 176 177 /* v_flags values */ 178 #define VF_SMASK 1 /* Subnet mask field contains valid data */ 179