]>
Commit | Line | Data |
---|---|---|
d8feb2d7 SS |
1 | diff -up dhcp-4.3.5b1/common/options.c.option97 dhcp-4.3.5b1/common/options.c |
2 | --- dhcp-4.3.5b1/common/options.c.option97 2016-09-12 17:17:13.972691041 +0200 | |
3 | +++ dhcp-4.3.5b1/common/options.c 2016-09-12 17:19:17.706790276 +0200 | |
4 | @@ -4434,13 +4434,26 @@ int validate_packet(struct packet *packe | |
5 | "a future version of ISC DHCP will reject this"); | |
6 | } | |
7 | } else { | |
8 | - /* | |
9 | - * If hlen is 0 we don't have any identifier, we warn the user | |
10 | - * but continue processing the packet as we can. | |
11 | - */ | |
12 | - if (packet->raw->hlen == 0) { | |
13 | - log_debug("Received DHCPv4 packet without client-id" | |
14 | - " option and empty hlen field."); | |
15 | + oc = lookup_option (&dhcp_universe, packet->options, | |
16 | + DHO_PXE_CLIENT_ID); | |
17 | + if (oc) { | |
18 | + /* Let's check if pxe-client-id is sane */ | |
19 | + if ((oc->data.len < 2) || | |
20 | + (oc->data.data[0] == '\0' && | |
21 | + oc->data.len != 17)) { | |
22 | + log_debug("Dropped DHCPv4 packet with wrong " | |
23 | + "(len == %d) pxe-client-id", oc->data.len); | |
24 | + return (0); | |
25 | + } | |
26 | + } else { | |
27 | + /* | |
28 | + * If hlen is 0 we don't have any identifier, we warn the user | |
29 | + * but continue processing the packet as we can. | |
30 | + */ | |
31 | + if (packet->raw->hlen == 0) { | |
32 | + log_debug("Received DHCPv4 packet without client-id" | |
33 | + " option and empty hlen field."); | |
34 | + } | |
35 | } | |
36 | } | |
37 | ||
38 | diff -up dhcp-4.3.5b1/common/tables.c.option97 dhcp-4.3.5b1/common/tables.c | |
39 | --- dhcp-4.3.5b1/common/tables.c.option97 2016-09-12 17:17:13.927691005 +0200 | |
40 | +++ dhcp-4.3.5b1/common/tables.c 2016-09-12 17:17:13.972691041 +0200 | |
41 | @@ -196,8 +196,9 @@ static struct option dhcp_options[] = { | |
42 | /* Defined by RFC 4578 */ | |
43 | { "pxe-system-type", "S", &dhcp_universe, 93, 1 }, | |
44 | { "pxe-interface-id", "BBB", &dhcp_universe, 94, 1 }, | |
45 | - { "pxe-client-id", "BX", &dhcp_universe, 97, 1 }, | |
46 | #endif | |
47 | + { "pxe-client-id", "BX", &dhcp_universe, 97, 1 }, | |
48 | + | |
49 | { "uap-servers", "t", &dhcp_universe, 98, 1 }, | |
50 | #if defined(RFC4776_OPTIONS) | |
51 | { "geoconf-civic", "X", &dhcp_universe, 99, 1 }, | |
52 | diff -up dhcp-4.3.5b1/includes/dhcp.h.option97 dhcp-4.3.5b1/includes/dhcp.h | |
53 | --- dhcp-4.3.5b1/includes/dhcp.h.option97 2016-09-12 17:17:13.936691013 +0200 | |
54 | +++ dhcp-4.3.5b1/includes/dhcp.h 2016-09-12 17:17:13.972691041 +0200 | |
55 | @@ -159,6 +159,7 @@ struct dhcp_packet { | |
56 | #define DHO_AUTHENTICATE 90 /* RFC3118, was 210 */ | |
57 | #define DHO_CLIENT_LAST_TRANSACTION_TIME 91 | |
58 | #define DHO_ASSOCIATED_IP 92 | |
59 | +#define DHO_PXE_CLIENT_ID 97 /* RFC4578 */ | |
60 | #define DHO_SUBNET_SELECTION 118 /* RFC3011! */ | |
61 | #define DHO_DOMAIN_SEARCH 119 /* RFC3397 */ | |
62 | #define DHO_CLASSLESS_STATIC_ROUTES 121 /* RFC3442 */ | |
63 | diff -up dhcp-4.3.5b1/server/dhcp.c.option97 dhcp-4.3.5b1/server/dhcp.c | |
64 | --- dhcp-4.3.5b1/server/dhcp.c.option97 2016-09-12 17:17:13.947691021 +0200 | |
65 | +++ dhcp-4.3.5b1/server/dhcp.c 2016-09-12 17:17:13.973691042 +0200 | |
66 | @@ -221,6 +221,10 @@ dhcp (struct packet *packet) { | |
67 | oc = lookup_option (&dhcp_universe, packet -> options, | |
68 | DHO_DHCP_CLIENT_IDENTIFIER); | |
69 | if (!oc) | |
70 | + oc = lookup_option (&dhcp_universe, | |
71 | + packet -> options, | |
72 | + DHO_PXE_CLIENT_ID); | |
73 | + if (!oc) | |
74 | goto nolease; | |
75 | ||
76 | memset (&data, 0, sizeof data); | |
77 | @@ -818,6 +822,9 @@ void dhcprelease (packet, ms_nulltp) | |
78 | ||
79 | oc = lookup_option (&dhcp_universe, packet -> options, | |
80 | DHO_DHCP_CLIENT_IDENTIFIER); | |
81 | + if (!oc) | |
82 | + oc = lookup_option (&dhcp_universe, packet -> options, | |
83 | + DHO_PXE_CLIENT_ID); | |
84 | memset (&data, 0, sizeof data); | |
85 | if (oc && | |
86 | evaluate_option_cache (&data, packet, (struct lease *)0, | |
87 | @@ -1286,6 +1293,9 @@ void dhcpinform (packet, ms_nulltp) | |
88 | */ | |
89 | oc = lookup_option(&dhcp_universe, packet->options, | |
90 | DHO_DHCP_CLIENT_IDENTIFIER); | |
91 | + if (!oc) | |
92 | + oc = lookup_option (&dhcp_universe, packet -> options, | |
93 | + DHO_PXE_CLIENT_ID); | |
94 | memset(&d1, 0, sizeof(d1)); | |
95 | if (oc && | |
96 | evaluate_option_cache(&d1, packet, NULL, NULL, | |
97 | @@ -2381,6 +2391,9 @@ void ack_lease (packet, lease, offer, wh | |
98 | can be used. */ | |
99 | oc = lookup_option (&dhcp_universe, packet -> options, | |
100 | DHO_DHCP_CLIENT_IDENTIFIER); | |
101 | + if (!oc) | |
102 | + oc = lookup_option (&dhcp_universe, packet -> options, | |
103 | + DHO_PXE_CLIENT_ID); | |
104 | if (oc && | |
105 | evaluate_option_cache (&d1, packet, lease, | |
106 | (struct client_state *)0, | |
107 | @@ -2962,6 +2975,9 @@ void ack_lease (packet, lease, offer, wh | |
108 | /* Record the uid, if given... */ | |
109 | oc = lookup_option (&dhcp_universe, packet -> options, | |
110 | DHO_DHCP_CLIENT_IDENTIFIER); | |
111 | + if (!oc) | |
112 | + oc = lookup_option (&dhcp_universe, packet -> options, | |
113 | + DHO_PXE_CLIENT_ID); | |
114 | if (oc && | |
115 | evaluate_option_cache(&d1, packet, lease, NULL, | |
116 | packet->options, state->options, | |
117 | @@ -4068,6 +4084,9 @@ int find_lease (struct lease **lp, | |
118 | specified unique client identifier. */ | |
119 | oc = lookup_option (&dhcp_universe, packet -> options, | |
120 | DHO_DHCP_CLIENT_IDENTIFIER); | |
121 | + if (!oc) | |
122 | + oc = lookup_option (&dhcp_universe, packet -> options, | |
123 | + DHO_PXE_CLIENT_ID); | |
124 | memset (&client_identifier, 0, sizeof client_identifier); | |
125 | if (oc && | |
126 | evaluate_option_cache (&client_identifier, | |
127 | diff -up dhcp-4.3.5b1/server/dhcpd.conf.5.option97 dhcp-4.3.5b1/server/dhcpd.conf.5 | |
128 | --- dhcp-4.3.5b1/server/dhcpd.conf.5.option97 2016-09-12 17:17:13.885690972 +0200 | |
129 | +++ dhcp-4.3.5b1/server/dhcpd.conf.5 2016-09-12 17:17:13.974691043 +0200 | |
130 | @@ -1587,10 +1587,12 @@ should be a name identifying the host. | |
131 | not specified for the host, \fIhostname\fR is used. | |
132 | .PP | |
133 | \fIHost\fR declarations are matched to actual DHCP or BOOTP clients | |
134 | -by matching the \fRdhcp-client-identifier\fR option specified in the | |
135 | +by matching the \fIdhcp-client-identifier\fR or \fIpxe-client-id\fR | |
136 | +options specified in the | |
137 | \fIhost\fR declaration to the one supplied by the client, or, if the | |
138 | \fIhost\fR declaration or the client does not provide a | |
139 | -\fRdhcp-client-identifier\fR option, by matching the \fIhardware\fR | |
140 | +\fIdhcp-client-identifier\fR or \fIpxe-client-id\fR options, | |
141 | +by matching the \fIhardware\fR | |
142 | parameter in the \fIhost\fR declaration to the network hardware | |
143 | address supplied by the client. BOOTP clients do not normally | |
144 | provide a \fIdhcp-client-identifier\fR, so the hardware address must | |
145 | @@ -1602,7 +1604,8 @@ to identify hosts. | |
146 | .PP | |
147 | Please be aware that | |
148 | .B only | |
149 | -the \fIdhcp-client-identifier\fR option and the hardware address can be | |
150 | +the \fIdhcp-client-identifier\fR and \fIpxe-client-id\fR | |
151 | +options and the hardware address can be | |
152 | used to match a host declaration, or the \fIhost-identifier option\fR | |
153 | parameter for DHCPv6 servers. For example, it is not possible to | |
154 | match a host declaration to a \fIhost-name\fR option. This is | |
155 | diff -up dhcp-4.3.5b1/server/dhcpleasequery.c.option97 dhcp-4.3.5b1/server/dhcpleasequery.c | |
156 | --- dhcp-4.3.5b1/server/dhcpleasequery.c.option97 2016-08-26 20:19:53.000000000 +0200 | |
157 | +++ dhcp-4.3.5b1/server/dhcpleasequery.c 2016-09-12 17:17:13.974691043 +0200 | |
158 | @@ -273,7 +273,7 @@ dhcpleasequery(struct packet *packet, in | |
159 | */ | |
160 | ||
161 | memset(&uid, 0, sizeof(uid)); | |
162 | - if (get_option(&uid, | |
163 | + i = get_option(&uid, | |
164 | &dhcp_universe, | |
165 | packet, | |
166 | NULL, | |
167 | @@ -283,8 +283,20 @@ dhcpleasequery(struct packet *packet, in | |
168 | packet->options, | |
169 | &global_scope, | |
170 | DHO_DHCP_CLIENT_IDENTIFIER, | |
171 | - MDL)) { | |
172 | - | |
173 | + MDL); | |
174 | + if (!i) | |
175 | + i = get_option(&uid, | |
176 | + &dhcp_universe, | |
177 | + packet, | |
178 | + NULL, | |
179 | + NULL, | |
180 | + packet->options, | |
181 | + NULL, | |
182 | + packet->options, | |
183 | + &global_scope, | |
184 | + DHO_PXE_CLIENT_ID, | |
185 | + MDL); | |
186 | + if (i) { | |
187 | snprintf(dbg_info, | |
188 | sizeof(dbg_info), | |
189 | "client-id %s", | |
190 | diff -up dhcp-4.3.5b1/server/failover.c.option97 dhcp-4.3.5b1/server/failover.c | |
191 | --- dhcp-4.3.5b1/server/failover.c.option97 2016-08-26 20:19:53.000000000 +0200 | |
192 | +++ dhcp-4.3.5b1/server/failover.c 2016-09-12 17:17:13.975691044 +0200 | |
193 | @@ -5957,6 +5957,9 @@ int load_balance_mine (struct packet *pa | |
194 | ||
195 | oc = lookup_option(&dhcp_universe, packet->options, | |
196 | DHO_DHCP_CLIENT_IDENTIFIER); | |
197 | + if (!oc) | |
198 | + oc = lookup_option(&dhcp_universe, packet -> options, | |
199 | + DHO_PXE_CLIENT_ID); | |
200 | memset(&ds, 0, sizeof ds); | |
201 | if (oc && | |
202 | evaluate_option_cache(&ds, packet, NULL, NULL, | |
203 | diff -up dhcp-4.3.5b1/server/mdb.c.option97 dhcp-4.3.5b1/server/mdb.c | |
204 | --- dhcp-4.3.5b1/server/mdb.c.option97 2016-08-26 20:19:53.000000000 +0200 | |
205 | +++ dhcp-4.3.5b1/server/mdb.c 2016-09-12 17:17:13.975691044 +0200 | |
206 | @@ -129,8 +129,9 @@ static int find_uid_statement (struct ex | |
207 | esp -> data.option && | |
208 | (esp -> data.option -> option -> universe == | |
209 | &dhcp_universe) && | |
210 | - (esp -> data.option -> option -> code == | |
211 | - DHO_DHCP_CLIENT_IDENTIFIER)) { | |
212 | + ((esp -> data.option -> option -> code == | |
213 | + DHO_DHCP_CLIENT_IDENTIFIER) || | |
214 | + (esp -> data.option -> option -> code == DHO_PXE_CLIENT_ID))) { | |
215 | if (condp) { | |
216 | log_error ("dhcp client identifier may not be %s", | |
217 | "specified conditionally."); |