Print this page
7388 Support DHCP Client FQDN. Allow IAID/DUID for all v4.
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/common/net/dhcp/dhcp_impl.h
+++ new/usr/src/common/net/dhcp/dhcp_impl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
|
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 + * Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
24 25 */
25 26
26 27 #ifndef _DHCP_IMPL_H
27 28 #define _DHCP_IMPL_H
28 29
29 30 #pragma ident "%Z%%M% %I% %E% SMI"
30 31
31 32 /*
32 33 * Common definitions used by Sun DHCP implementations
33 34 */
34 35
35 36 #ifdef __cplusplus
36 37 extern "C" {
37 38 #endif
38 39
39 40 #include <sys/types.h>
40 41 #include <sys/socket.h>
41 42 #include <netinet/in.h>
42 43 #include <netinet/udp.h>
43 44 #include <netinet/dhcp.h>
44 45 #include <netinet/dhcp6.h>
45 46 #include <dhcp_symbol_common.h>
46 47 #include <sys/sunos_dhcp_class.h>
47 48
48 49 /* Packet fields */
49 50 #define CD_PACKET_START 0
50 51 #define CD_POPCODE 0 /* packet opcode */
51 52 #define CD_PHTYPE 1 /* packet header type */
52 53 #define CD_PHLEN 2 /* packet header len */
53 54 #define CD_PHOPS 3 /* packet header len */
54 55 #define CD_PXID 4 /* packet hops */
55 56 #define CD_PSECS 8 /* packet xid */
56 57 #define CD_PFLAGS 10 /* packet secs */
57 58 #define CD_PCIADDR 12 /* packet flags */
58 59 #define CD_YIADDR 16 /* client's ip address */
59 60 #define CD_SIADDR 20 /* Bootserver's ip address */
60 61 #define CD_GIADDR 24 /* BOOTP relay agent address */
61 62 #define CD_PCHADDR 28 /* BOOTP relay agent address */
62 63 #define CD_SNAME 44 /* Hostname of Bootserver, or opts */
63 64 #define CD_BOOTFILE 108 /* File to boot or opts */
64 65 #define CD_PCOOKIE 236 /* packet cookie */
65 66 #define CD_POPTIONS 240 /* packet options */
66 67 #define CD_PACKET_END CD_POPTIONS
67 68
68 69 /* Internal server options */
69 70 #define CD_INTRNL_START 1024
70 71 #define CD_BOOL_HOSTNAME 1024 /* Entry wants hostname (Nameserv) */
71 72 #define CD_BOOL_LEASENEG 1025 /* Entry's lease is negotiable */
72 73 #define CD_BOOL_ECHO_VCLASS 1026 /* Echo Vendor class back to Entry */
73 74 #define CD_BOOTPATH 1027 /* prefix path to File to boot */
74 75 #define CD_INTRNL_END 1027
75 76
76 77 /* Error codes that could be generated while parsing packets */
77 78 #define DHCP_ERR_OFFSET 512
78 79 #define DHCP_GARBLED_MSG_TYPE (DHCP_ERR_OFFSET+0)
79 80 #define DHCP_WRONG_MSG_TYPE (DHCP_ERR_OFFSET+1)
80 81 #define DHCP_BAD_OPT_OVLD (DHCP_ERR_OFFSET+2)
81 82
82 83 /*
83 84 * Arbitrary "maximum" client ID length (in bytes), used by various bits
84 85 * of the standalone code. This needs to go away someday.
85 86 */
86 87 #define DHCP_MAX_CID_LEN 64
|
↓ open down ↓ |
53 lines elided |
↑ open up ↑ |
87 88
88 89 /*
89 90 * Generic DHCP option structure.
90 91 */
91 92 typedef struct {
92 93 uint8_t code;
93 94 uint8_t len;
94 95 uint8_t value[1];
95 96 } DHCP_OPT;
96 97
98 +/*
99 + * Defines the size of DHCP_OPT code + len
100 + */
101 +#define DHCP_OPT_META_LEN 2
102 +
97 103 typedef union sockaddr46_s {
98 104 struct sockaddr_in v4;
99 105 struct sockaddr_in6 v6;
100 106 } sockaddr46_t;
101 107
102 108 /*
103 109 * Generic DHCP packet list. Ensure that _REENTRANT bracketed code stays at
104 110 * bottom of this definition - the client doesn't include it. Scan.c in
105 111 * libdhcp isn't aware of it either...
106 112 *
107 113 * The PKT * pointer here actually points to a dhcpv6_message_t if the packet
108 114 * is DHCPv6. We assume that PKT * the same or stricter alignment
109 115 * requirements, and that the unused elements are not a significant burden.
110 116 */
111 117 #define MAX_PKT_LIST 5 /* maximum list size */
112 118 typedef struct dhcp_list {
113 119 struct dhcp_list *next; /* keep first and in this */
114 120 struct dhcp_list *prev; /* order for insque/remque */
115 121
116 122 PKT *pkt; /* client packet */
117 123 uint_t len; /* packet len */
118 124 int rfc1048; /* RFC1048 options - boolean */
119 125 uint8_t offset; /* BOOTP packet offset */
120 126 uint8_t isv6; /* DHCPv6 packet - boolean */
121 127 /*
122 128 * standard/site options
123 129 */
124 130 DHCP_OPT *opts[DHCP_LAST_OPT + 1];
125 131
126 132 /*
127 133 * Vendor specific options (client only)
128 134 */
129 135 DHCP_OPT *vs[VS_OPTION_END - VS_OPTION_START + 1];
130 136
131 137 struct in_addr off_ip; /* Address OFFERed */
132 138
133 139 uint_t ifindex; /* received ifindex (if any) */
134 140 sockaddr46_t pktfrom; /* source (peer) address on input */
135 141 sockaddr46_t pktto; /* destination (local) address */
136 142
137 143 } PKT_LIST;
138 144
139 145 extern int dhcp_options_scan(PKT_LIST *, boolean_t);
140 146 extern boolean_t dhcp_getinfo_pl(PKT_LIST *, uchar_t, uint16_t, uint16_t,
141 147 void *, size_t *);
142 148 extern dhcpv6_option_t *dhcpv6_find_option(const void *, size_t,
143 149 const dhcpv6_option_t *, uint16_t, uint_t *);
144 150 extern dhcpv6_option_t *dhcpv6_pkt_option(const PKT_LIST *,
145 151 const dhcpv6_option_t *, uint16_t, uint_t *);
146 152
147 153 #ifdef __cplusplus
148 154 }
149 155 #endif
150 156
151 157 #endif /* _DHCP_IMPL_H */
|
↓ open down ↓ |
45 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX