Simon Kelley | d1ced3a | 2018-01-01 22:18:03 +0000 | [diff] [blame] | 1 | /* dnsmasq is Copyright (c) 2000-2018 Simon Kelley |
Simon Kelley | 572b41e | 2011-02-18 18:11:18 +0000 | [diff] [blame] | 2 | |
| 3 | This program is free software; you can redistribute it and/or modify |
| 4 | it under the terms of the GNU General Public License as published by |
| 5 | the Free Software Foundation; version 2 dated June, 1991, or |
| 6 | (at your option) version 3 dated 29 June, 2007. |
| 7 | |
| 8 | This program is distributed in the hope that it will be useful, |
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | GNU General Public License for more details. |
| 12 | |
| 13 | You should have received a copy of the GNU General Public License |
| 14 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 16 | #define DHCP_SERVER_PORT 67 |
| 17 | #define DHCP_CLIENT_PORT 68 |
| 18 | #define DHCP_SERVER_ALTPORT 1067 |
| 19 | #define DHCP_CLIENT_ALTPORT 1068 |
| 20 | #define PXE_PORT 4011 |
Simon Kelley | 572b41e | 2011-02-18 18:11:18 +0000 | [diff] [blame] | 21 | |
Simon Kelley | bf4e62c | 2016-07-22 21:37:59 +0100 | [diff] [blame] | 22 | /* These each hold a DHCP option max size 255 |
| 23 | and get a terminating zero added */ |
| 24 | #define DHCP_BUFF_SZ 256 |
| 25 | |
Simon Kelley | 572b41e | 2011-02-18 18:11:18 +0000 | [diff] [blame] | 26 | #define BOOTREQUEST 1 |
| 27 | #define BOOTREPLY 2 |
| 28 | #define DHCP_COOKIE 0x63825363 |
| 29 | |
| 30 | /* The Linux in-kernel DHCP client silently ignores any packet |
| 31 | smaller than this. Sigh........... */ |
| 32 | #define MIN_PACKETSZ 300 |
| 33 | |
| 34 | #define OPTION_PAD 0 |
| 35 | #define OPTION_NETMASK 1 |
| 36 | #define OPTION_ROUTER 3 |
| 37 | #define OPTION_DNSSERVER 6 |
| 38 | #define OPTION_HOSTNAME 12 |
| 39 | #define OPTION_DOMAINNAME 15 |
| 40 | #define OPTION_BROADCAST 28 |
| 41 | #define OPTION_VENDOR_CLASS_OPT 43 |
| 42 | #define OPTION_REQUESTED_IP 50 |
| 43 | #define OPTION_LEASE_TIME 51 |
| 44 | #define OPTION_OVERLOAD 52 |
| 45 | #define OPTION_MESSAGE_TYPE 53 |
| 46 | #define OPTION_SERVER_IDENTIFIER 54 |
| 47 | #define OPTION_REQUESTED_OPTIONS 55 |
| 48 | #define OPTION_MESSAGE 56 |
| 49 | #define OPTION_MAXMESSAGE 57 |
| 50 | #define OPTION_T1 58 |
| 51 | #define OPTION_T2 59 |
| 52 | #define OPTION_VENDOR_ID 60 |
| 53 | #define OPTION_CLIENT_ID 61 |
| 54 | #define OPTION_SNAME 66 |
| 55 | #define OPTION_FILENAME 67 |
| 56 | #define OPTION_USER_CLASS 77 |
| 57 | #define OPTION_CLIENT_FQDN 81 |
| 58 | #define OPTION_AGENT_ID 82 |
| 59 | #define OPTION_ARCH 93 |
| 60 | #define OPTION_PXE_UUID 97 |
| 61 | #define OPTION_SUBNET_SELECT 118 |
| 62 | #define OPTION_DOMAIN_SEARCH 119 |
| 63 | #define OPTION_SIP_SERVER 120 |
| 64 | #define OPTION_VENDOR_IDENT 124 |
| 65 | #define OPTION_VENDOR_IDENT_OPT 125 |
| 66 | #define OPTION_END 255 |
| 67 | |
| 68 | #define SUBOPT_CIRCUIT_ID 1 |
| 69 | #define SUBOPT_REMOTE_ID 2 |
| 70 | #define SUBOPT_SUBNET_SELECT 5 /* RFC 3527 */ |
| 71 | #define SUBOPT_SUBSCR_ID 6 /* RFC 3393 */ |
| 72 | #define SUBOPT_SERVER_OR 11 /* RFC 5107 */ |
| 73 | |
| 74 | #define SUBOPT_PXE_BOOT_ITEM 71 /* PXE standard */ |
| 75 | #define SUBOPT_PXE_DISCOVERY 6 |
| 76 | #define SUBOPT_PXE_SERVERS 8 |
| 77 | #define SUBOPT_PXE_MENU 9 |
| 78 | #define SUBOPT_PXE_MENU_PROMPT 10 |
| 79 | |
| 80 | #define DHCPDISCOVER 1 |
| 81 | #define DHCPOFFER 2 |
| 82 | #define DHCPREQUEST 3 |
| 83 | #define DHCPDECLINE 4 |
| 84 | #define DHCPACK 5 |
| 85 | #define DHCPNAK 6 |
| 86 | #define DHCPRELEASE 7 |
| 87 | #define DHCPINFORM 8 |
| 88 | |
| 89 | #define BRDBAND_FORUM_IANA 3561 /* Broadband forum IANA enterprise */ |
| 90 | |
| 91 | #define DHCP_CHADDR_MAX 16 |
| 92 | |
| 93 | struct dhcp_packet { |
| 94 | u8 op, htype, hlen, hops; |
| 95 | u32 xid; |
| 96 | u16 secs, flags; |
| 97 | struct in_addr ciaddr, yiaddr, siaddr, giaddr; |
| 98 | u8 chaddr[DHCP_CHADDR_MAX], sname[64], file[128]; |
| 99 | u8 options[312]; |
| 100 | }; |