]>
Commit | Line | Data |
---|---|---|
9d6ebeaf JR |
1 | diff -rc bootp-2.4.2/Announce bootp-2.4.3/Announce |
2 | *** bootp-2.4.2/Announce Thu Feb 16 21:18:17 1995 | |
3 | --- bootp-2.4.3/Announce Thu Mar 16 08:58:23 1995 | |
4 | *************** | |
5 | *** 6,11 **** | |
6 | --- 6,13 ---- | |
7 | ||
8 | New features in version 2.4 include: | |
9 | ||
10 | + Added static DHCP allocation capabilities. | |
11 | + Use: :dl=leasetime for DHCP leasetime handouts | |
12 | Added a simple BOOTP gateway program: bootpgw | |
13 | Allow host name anywhere IP address is expected. | |
14 | Automatically lookup the IP address when the name of a | |
15 | *************** | |
16 | *** 49,60 **** | |
17 | SunOS 4.X (Solaris 1.X) | |
18 | SunOS 5.X (Solaris 2.X) | |
19 | System V/386 Rel. 4.0 | |
20 | ||
21 | Systems on which others say this code works: | |
22 | CDC EP/IX (1.4.3, 2.1.1) | |
23 | DEC Ultrix (4.2, 4.3) | |
24 | - Linux 1.1.81 | |
25 | OSF/1 (DEC Alpha CPU) | |
26 | ||
27 | Please direct questions, comments, and bug reports to: | |
28 | <bootp@andrew.cmu.edu> | |
29 | --- 51,69 ---- | |
30 | SunOS 4.X (Solaris 1.X) | |
31 | SunOS 5.X (Solaris 2.X) | |
32 | System V/386 Rel. 4.0 | |
33 | + Linux 1.1.81 | |
34 | ||
35 | Systems on which others say this code works: | |
36 | CDC EP/IX (1.4.3, 2.1.1) | |
37 | DEC Ultrix (4.2, 4.3) | |
38 | OSF/1 (DEC Alpha CPU) | |
39 | + HP 9000 | |
40 | + | |
41 | + How to get the latest version: | |
42 | + ftp firewall.mc.com (anonymous) | |
43 | + cd /pub | |
44 | + binary | |
45 | + get bootp-2.4.2.tar.Z | |
46 | ||
47 | Please direct questions, comments, and bug reports to: | |
48 | <bootp@andrew.cmu.edu> | |
49 | diff -rc bootp-2.4.2/Changes bootp-2.4.3/Changes | |
50 | *** bootp-2.4.2/Changes Thu Feb 16 17:52:06 1995 | |
51 | --- bootp-2.4.3/Changes Thu Mar 16 08:24:18 1995 | |
52 | *************** | |
53 | *** 2,13 **** | |
54 | --- 2,28 ---- | |
55 | Date, <email> Real Name | |
56 | what... | |
57 | ||
58 | + --> bootp-2.4.3 | |
59 | + | |
60 | + 08/07/95 middelin@polyware.iaf.nl (Pauline Middelink) | |
61 | + Fixed problem while reporting duplicate hardware address in | |
62 | + readfile.c (kerry@maine.maine.edu) | |
63 | + Changed some code to allow the giaddr to pass through. Needed | |
64 | + when the client request is forwarded to us through a gateway. | |
65 | + (Broadcasting to the gateway will not reach the client) | |
66 | + | |
67 | + 01/26/95 Phil.Packer@bbc.co.uk (Phil.Packer) | |
68 | + Added dl tag for DHCP lease and rejigged Pauline's codes | |
69 | + at the end of bootpd.c to allow the setting of explicit leases. | |
70 | + Added "sco" Makefile target. | |
71 | + | |
72 | --> bootp-2.4.2 | |
73 | ||
74 | 01/14/95 middelin@polyware.iaf.nl (Pauline Middelink) | |
75 | Corrected support for the Linux networking code. | |
76 | Fixed lots of warnings (gcc -Wall) | |
77 | Added "linux" Makefile target. | |
78 | + Written code for DHCP static IP allocation. | |
79 | ||
80 | 01/02/95 Jukka Ukkonen <ukkonen@csc.fi> | |
81 | Allow bootptab syntax: ha="0:0:c0:80:e8:a7" | |
82 | diff -rc bootp-2.4.2/Makefile bootp-2.4.3/Makefile | |
83 | *** bootp-2.4.2/Makefile Thu Feb 16 16:25:19 1995 | |
84 | --- bootp-2.4.3/Makefile Thu Mar 16 08:52:30 1995 | |
85 | *************** | |
86 | *** 9,15 **** | |
87 | # OPTion DEFinitions: | |
88 | # Remove the -DVEND_CMU if you don't wish to support the "CMU vendor format" | |
89 | # in addition to the RFC1048 format. Leaving out DEBUG saves little. | |
90 | ! OPTDEFS= -DSYSLOG -DVEND_CMU -DDEBUG | |
91 | ||
92 | # Uncomment and edit this to choose the facility code used for syslog. | |
93 | # LOG_FACILITY= "-DLOG_BOOTP=LOG_LOCAL2" | |
94 | --- 9,16 ---- | |
95 | # OPTion DEFinitions: | |
96 | # Remove the -DVEND_CMU if you don't wish to support the "CMU vendor format" | |
97 | # in addition to the RFC1048 format. Leaving out DEBUG saves little. | |
98 | ! # Remove the -DDHCP if you don't need DHCP support. | |
99 | ! OPTDEFS= -DSYSLOG -DVEND_CMU -DDHCP -DDEBUG | |
100 | ||
101 | # Uncomment and edit this to choose the facility code used for syslog. | |
102 | # LOG_FACILITY= "-DLOG_BOOTP=LOG_LOCAL2" | |
103 | *************** | |
104 | *** 95,103 **** | |
105 | SYSDEFS="-DSVR4" \ | |
106 | SYSLIBS="-lsocket -lnsl" | |
107 | ||
108 | ! # Linux 1.1.80+ on [34]86 | |
109 | linux: | |
110 | ! $(MAKE) SYSDEFS="-O6 -Wall -fomit-frame-pointer" | |
111 | ||
112 | # SunOS 4.X | |
113 | sunos4: | |
114 | --- 96,111 ---- | |
115 | SYSDEFS="-DSVR4" \ | |
116 | SYSLIBS="-lsocket -lnsl" | |
117 | ||
118 | ! # Linux 1.1.80+ | |
119 | linux: | |
120 | ! $(MAKE) SYSDEFS="-O6 -Wall -fomit-frame-pointer" \ | |
121 | ! SYSLIBS="" \ | |
122 | ! FILEDEFS='-DCONFIG_FILE=\"/etc/bootptab\" \ | |
123 | ! -DDUMPTAB_FILE=\"/tmp/bootpd.dump\"' | |
124 | ! | |
125 | ! # SCO (pah!) SYSV rel 3.2 | |
126 | ! sco: | |
127 | ! $(MAKE) CC="cc" SYSLIBS="-lsocket" | |
128 | ||
129 | # SunOS 4.X | |
130 | sunos4: | |
131 | diff -rc bootp-2.4.2/bootp.h bootp-2.4.3/bootp.h | |
132 | *** bootp-2.4.2/bootp.h Mon Aug 22 18:49:17 1994 | |
133 | --- bootp-2.4.3/bootp.h Thu Mar 16 08:17:22 1995 | |
134 | *************** | |
135 | *** 122,129 **** | |
136 | #define TAG_NIS_SERVER ((unsigned char) 41) | |
137 | #define TAG_NTP_SERVER ((unsigned char) 42) | |
138 | /* DHCP maximum message size. */ | |
139 | #define TAG_MAX_MSGSZ ((unsigned char) 57) | |
140 | ! | |
141 | /* XXX - Add new tags here */ | |
142 | ||
143 | ||
144 | --- 122,133 ---- | |
145 | #define TAG_NIS_SERVER ((unsigned char) 41) | |
146 | #define TAG_NTP_SERVER ((unsigned char) 42) | |
147 | /* DHCP maximum message size. */ | |
148 | + #define TAG_DHCP_IPLEASE ((unsigned char) 51) | |
149 | + #define TAG_DHCP_MSG ((unsigned char) 53) | |
150 | + #define TAG_DHCP_SERVERID ((unsigned char) 54) | |
151 | #define TAG_MAX_MSGSZ ((unsigned char) 57) | |
152 | ! #define TAG_DHCP_IPRENEW ((unsigned char) 58) /* PeP hic facet */ | |
153 | ! #define TAG_DHCP_IPREBIND ((unsigned char) 59) | |
154 | /* XXX - Add new tags here */ | |
155 | ||
156 | ||
157 | diff -rc bootp-2.4.2/bootpd.c bootp-2.4.3/bootpd.c | |
158 | *** bootp-2.4.2/bootpd.c Wed Feb 15 22:21:58 1995 | |
159 | --- bootp-2.4.3/bootpd.c Thu Mar 16 08:31:12 1995 | |
160 | *************** | |
161 | *** 76,81 **** | |
162 | --- 76,90 ---- | |
163 | # define bzero(p,l) memset(p,0,l) | |
164 | # define bcmp(a,b,c) memcmp(a,b,c) | |
165 | #endif | |
166 | + #ifdef __linux__ | |
167 | + /* Use sigaction to make signal last... */ | |
168 | + inline void (*signal(int sig,void (*handler)(int)))(int) { | |
169 | + struct sigaction so,sa = {NULL,0,SA_NOMASK|SA_RESTART,NULL}; | |
170 | + sa.sa_handler = handler; | |
171 | + if (sigaction(sig,&sa,&so)<0) return NULL; | |
172 | + return so.sa_handler; | |
173 | + } | |
174 | + #endif | |
175 | ||
176 | #include "bootp.h" | |
177 | #include "hash.h" | |
178 | *************** | |
179 | *** 114,125 **** | |
180 | #ifdef VEND_CMU | |
181 | PRIVATE void dovend_cmu P((struct bootp *, struct host *)); | |
182 | #endif | |
183 | ! PRIVATE void dovend_rfc1048 P((struct bootp *, struct host *, int32)); | |
184 | PRIVATE void handle_reply P((void)); | |
185 | PRIVATE void handle_request P((void)); | |
186 | PRIVATE void sendreply P((int forward, int32 dest_override)); | |
187 | PRIVATE void usage P((void)); | |
188 | ||
189 | #undef P | |
190 | ||
191 | /* | |
192 | --- 123,144 ---- | |
193 | #ifdef VEND_CMU | |
194 | PRIVATE void dovend_cmu P((struct bootp *, struct host *)); | |
195 | #endif | |
196 | ! PRIVATE int dovend_rfc1048 P((struct bootp *, struct host *, int32)); | |
197 | PRIVATE void handle_reply P((void)); | |
198 | PRIVATE void handle_request P((void)); | |
199 | PRIVATE void sendreply P((int forward, int32 dest_override)); | |
200 | PRIVATE void usage P((void)); | |
201 | ||
202 | + #ifdef DHCP | |
203 | + PRIVATE int dhcp_discover P((struct bootp *, struct host *, byte *, int)); | |
204 | + PRIVATE int dhcp_request P((struct bootp *, struct host *, byte *, int)); | |
205 | + PRIVATE int dhcp_decline P((struct bootp *, struct host *, byte *, int)); | |
206 | + PRIVATE int dhcp_release P((struct bootp *, struct host *, byte *, int)); | |
207 | + PRIVATE int dhcp_offer P((struct bootp *, struct host *, byte *, int)); | |
208 | + PRIVATE int dhcp_ack P((struct bootp *, struct host *, byte *, int)); | |
209 | + PRIVATE int dhcp_lease P((struct bootp *, struct host *, byte **)); | |
210 | + #endif | |
211 | + | |
212 | #undef P | |
213 | ||
214 | /* | |
215 | *************** | |
216 | *** 477,482 **** | |
217 | --- 496,512 ---- | |
218 | bootpc_port = (u_short) IPPORT_BOOTPC; | |
219 | } | |
220 | ||
221 | + #ifdef DHCP | |
222 | + /* | |
223 | + * Maybe we have to broadcast, so enable it. | |
224 | + */ | |
225 | + n = 1; | |
226 | + if (setsockopt(s,SOL_SOCKET,SO_BROADCAST,&n,sizeof(n))<0) { | |
227 | + report(LOG_ERR, "setsockopt: %s\n", get_errmsg()); | |
228 | + exit(1); | |
229 | + } | |
230 | + #endif | |
231 | + | |
232 | /* | |
233 | * Set up signals to read or dump the table. | |
234 | */ | |
235 | *************** | |
236 | *** 701,707 **** | |
237 | haddrtoa(bp->bp_chaddr, bp->bp_hlen)); | |
238 | return; /* not found */ | |
239 | } | |
240 | - (bp->bp_yiaddr).s_addr = hp->iaddr.s_addr; | |
241 | ||
242 | } else { | |
243 | ||
244 | --- 731,736 ---- | |
245 | *************** | |
246 | *** 724,729 **** | |
247 | --- 753,759 ---- | |
248 | return; | |
249 | } | |
250 | } | |
251 | + (bp->bp_yiaddr).s_addr = hp->iaddr.s_addr; | |
252 | ||
253 | if (debug) { | |
254 | report(LOG_INFO, "found %s (%s)", inet_ntoa(hp->iaddr), | |
255 | *************** | |
256 | *** 961,967 **** | |
257 | */ | |
258 | if (!bcmp(bp->bp_vend, vm_rfc1048, 4)) { | |
259 | /* RFC1048 conformant bootp client */ | |
260 | ! dovend_rfc1048(bp, hp, bootsize); | |
261 | if (debug > 1) { | |
262 | report(LOG_INFO, "sending reply (with RFC1048 options)"); | |
263 | } | |
264 | --- 991,998 ---- | |
265 | */ | |
266 | if (!bcmp(bp->bp_vend, vm_rfc1048, 4)) { | |
267 | /* RFC1048 conformant bootp client */ | |
268 | ! if (!dovend_rfc1048(bp, hp, bootsize)) | |
269 | ! return; | |
270 | if (debug > 1) { | |
271 | report(LOG_INFO, "sending reply (with RFC1048 options)"); | |
272 | } | |
273 | *************** | |
274 | *** 1093,1098 **** | |
275 | --- 1124,1137 ---- | |
276 | /* Finally, set the server address field. */ | |
277 | bp->bp_siaddr = siaddr; | |
278 | } | |
279 | + #ifdef DHCP | |
280 | + /* | |
281 | + * This code is placed here, because otherwise the siaddr | |
282 | + * will not be found... | |
283 | + */ | |
284 | + if (ntohs(bp->bp_flags) & 0x8000 && bp->bp_giaddr.s_addr==0) | |
285 | + dst.s_addr = INADDR_BROADCAST; | |
286 | + #endif | |
287 | /* Set up socket address for send. */ | |
288 | send_addr.sin_family = AF_INET; | |
289 | send_addr.sin_port = htons(port); | |
290 | *************** | |
291 | *** 1220,1228 **** | |
292 | if (bytesleft < (LEN)) { \ | |
293 | report(LOG_NOTICE, noroom, \ | |
294 | hp->hostname->string, MSG); \ | |
295 | ! return; \ | |
296 | } while (0) | |
297 | ! PRIVATE void | |
298 | dovend_rfc1048(bp, hp, bootsize) | |
299 | struct bootp *bp; | |
300 | struct host *hp; | |
301 | --- 1259,1267 ---- | |
302 | if (bytesleft < (LEN)) { \ | |
303 | report(LOG_NOTICE, noroom, \ | |
304 | hp->hostname->string, MSG); \ | |
305 | ! return 0; \ | |
306 | } while (0) | |
307 | ! PRIVATE int | |
308 | dovend_rfc1048(bp, hp, bootsize) | |
309 | struct bootp *bp; | |
310 | struct host *hp; | |
311 | *************** | |
312 | *** 1230,1235 **** | |
313 | --- 1269,1278 ---- | |
314 | { | |
315 | int bytesleft, len; | |
316 | byte *vp; | |
317 | + #ifdef DHCP | |
318 | + int dhcp = 0; | |
319 | + int isme = TRUE; /* DHCP uses this for not-mine-requests */ | |
320 | + #endif | |
321 | ||
322 | static char noroom[] = "%s: No room for \"%s\" option"; | |
323 | ||
324 | *************** | |
325 | *** 1280,1286 **** | |
326 | case TAG_SUBNET_MASK: | |
327 | /* XXX - Should preserve this if given... */ | |
328 | break; | |
329 | ! } /* swtich */ | |
330 | p += len; | |
331 | } | |
332 | ||
333 | --- 1323,1335 ---- | |
334 | case TAG_SUBNET_MASK: | |
335 | /* XXX - Should preserve this if given... */ | |
336 | break; | |
337 | ! case TAG_DHCP_MSG: | |
338 | ! dhcp = *p; | |
339 | ! break; | |
340 | ! case TAG_DHCP_SERVERID: | |
341 | ! isme = (len==4) && my_ip_addr.s_addr == ((struct in_addr *)p)->s_addr; | |
342 | ! break; | |
343 | ! } /* switch */ | |
344 | p += len; | |
345 | } | |
346 | ||
347 | *************** | |
348 | *** 1347,1362 **** | |
349 | vp += len; | |
350 | *vp++ = TAG_END; | |
351 | bytesleft -= len + 3; | |
352 | ! return; /* no more options here. */ | |
353 | } | |
354 | /* | |
355 | ! * The remaining options are inserted by the following | |
356 | ! * function (which is shared with bootpef.c). | |
357 | ! * Keep back one byte for the TAG_END. | |
358 | */ | |
359 | ! len = dovend_rfc1497(hp, vp, bytesleft - 1); | |
360 | ! vp += len; | |
361 | ! bytesleft -= len; | |
362 | ||
363 | /* There should be at least one byte left. */ | |
364 | NEED(1, "(end)"); | |
365 | --- 1396,1439 ---- | |
366 | vp += len; | |
367 | *vp++ = TAG_END; | |
368 | bytesleft -= len + 3; | |
369 | ! return 1; /* no more options here. */ | |
370 | } | |
371 | + | |
372 | + #ifdef DHCP | |
373 | /* | |
374 | ! * Check if this is a DHCP request. | |
375 | */ | |
376 | ! if (dhcp!=0) { | |
377 | ! if (!isme) | |
378 | ! return 0; /* Not mine, discard! */ | |
379 | ! | |
380 | ! switch (dhcp) { | |
381 | ! case 1 : len = dhcp_discover(bp,hp,vp,bytesleft-1); break; | |
382 | ! case 3 : len = dhcp_request(bp,hp,vp,bytesleft-1); break; | |
383 | ! case 4 : len = dhcp_decline(bp,hp,vp,bytesleft-1); break; | |
384 | ! case 7 : len = dhcp_release(bp,hp,vp,bytesleft-1); break; | |
385 | ! default : report(LOG_NOTICE,"Unknown DHCP request (%d)",dhcp); | |
386 | ! return 0; | |
387 | ! } | |
388 | ! /* Is there a DHCP reply at all? */ | |
389 | ! if (len==0) | |
390 | ! return 0; | |
391 | ! vp += len; | |
392 | ! bytesleft -= len; | |
393 | ! } | |
394 | ! else { | |
395 | ! #endif | |
396 | ! /* | |
397 | ! * The remaining options are inserted by the following | |
398 | ! * function (which is shared with bootpef.c). | |
399 | ! * Keep back one byte for the TAG_END. | |
400 | ! */ | |
401 | ! len = dovend_rfc1497(hp, vp, bytesleft - 1); | |
402 | ! vp += len; | |
403 | ! bytesleft -= len; | |
404 | ! #ifdef DHCP | |
405 | ! } | |
406 | ! #endif | |
407 | ||
408 | /* There should be at least one byte left. */ | |
409 | NEED(1, "(end)"); | |
410 | *************** | |
411 | *** 1370,1375 **** | |
412 | --- 1447,1453 ---- | |
413 | */ | |
414 | bzero(vp, bytesleft); | |
415 | } | |
416 | + return 1; /* sent reply */ | |
417 | } /* dovend_rfc1048 */ | |
418 | #undef NEED | |
419 | \f | |
420 | *************** | |
421 | *** 1389,1394 **** | |
422 | --- 1467,1637 ---- | |
423 | */ | |
424 | ||
425 | /* get_errmsg() - now in report.c */ | |
426 | + | |
427 | + | |
428 | + #ifdef DHCP | |
429 | + | |
430 | + /* | |
431 | + * PeP hic facet | |
432 | + * Stuff the packet with the Lease info, We need to do this on the Offer and | |
433 | + * the ack so separated out here | |
434 | + */ | |
435 | + PRIVATE | |
436 | + int dhcp_lease(bp, hp, vp) | |
437 | + struct bootp *bp; | |
438 | + struct host *hp; | |
439 | + byte **vp; | |
440 | + { | |
441 | + *(*vp)++ = TAG_DHCP_IPRENEW; /* DHCP Renewal time 50% of lease */ | |
442 | + *(*vp)++ = 4; /* Length */ | |
443 | + insert_u_long(htonl(hp->dhcp_lease/2),vp); | |
444 | + | |
445 | + *(*vp)++ = TAG_DHCP_IPREBIND; /* DHCP Rebinding time 85% of lease */ | |
446 | + *(*vp)++ = 4; | |
447 | + insert_u_long(htonl(hp->dhcp_lease*7/8),vp); | |
448 | + | |
449 | + *(*vp)++ = TAG_DHCP_IPLEASE; /* IP address lease time */ | |
450 | + *(*vp)++ = 4; /* Length */ | |
451 | + insert_u_long(htonl(hp->dhcp_lease),vp); /* PeP hic facet, lets see if this works */ | |
452 | + | |
453 | + return(19); | |
454 | + } | |
455 | + | |
456 | + | |
457 | + /* | |
458 | + * Formulate an DHCP_DISCOVER reply | |
459 | + */ | |
460 | + PRIVATE | |
461 | + int dhcp_discover(bp, hp, vp, bytesleft) | |
462 | + struct bootp *bp; | |
463 | + struct host *hp; | |
464 | + byte *vp; | |
465 | + int bytesleft; | |
466 | + { | |
467 | + if(debug) | |
468 | + report(LOG_INFO, "Received: DHCPDISCOVER"); | |
469 | + return(dhcp_offer(bp,hp,vp,bytesleft)); | |
470 | + } | |
471 | + | |
472 | + /* | |
473 | + * formulate an DHCP_RELEASE reply | |
474 | + */ | |
475 | + PRIVATE | |
476 | + int dhcp_release(bp, hp, vp, bytesleft) | |
477 | + struct bootp *bp; | |
478 | + struct host *hp; | |
479 | + byte *vp; | |
480 | + int bytesleft; | |
481 | + { | |
482 | + if (debug) | |
483 | + report(LOG_INFO, "Received: DHCPRELEASE (discarded)"); | |
484 | + return 0; | |
485 | + } | |
486 | + | |
487 | + PRIVATE | |
488 | + int dhcp_offer(bp, hp, vp, bytesleft) | |
489 | + struct bootp *bp; | |
490 | + struct host *hp; | |
491 | + byte *vp; | |
492 | + int bytesleft; | |
493 | + { | |
494 | + int len=0; | |
495 | + if (debug) | |
496 | + report(LOG_INFO, "Sent: DHCPOFFER"); | |
497 | + | |
498 | + bp->bp_secs = bp->bp_hops = 0; | |
499 | + bp->bp_ciaddr.s_addr = 0; | |
500 | + | |
501 | + *vp++ = TAG_DHCP_MSG; /* DHCP */ | |
502 | + *vp++ = 1; /* length */ | |
503 | + *vp++ = 2; /* DHCPOFFER */ | |
504 | + len += 3; | |
505 | + | |
506 | + len += dhcp_lease(bp,hp,&vp); | |
507 | + | |
508 | + *vp++ = TAG_DHCP_SERVERID; | |
509 | + *vp++ = 4; | |
510 | + insert_u_long(my_ip_addr.s_addr,&vp); | |
511 | + len += 6; | |
512 | + | |
513 | + return len + dovend_rfc1497(hp, vp, bytesleft - len); | |
514 | + } | |
515 | + | |
516 | + /* | |
517 | + * Formulate an DHCP_REQUEST reply | |
518 | + */ | |
519 | + PRIVATE | |
520 | + int dhcp_request(bp, hp, vp, bytesleft) | |
521 | + struct bootp *bp; | |
522 | + struct host *hp; | |
523 | + byte *vp; | |
524 | + int bytesleft; | |
525 | + { | |
526 | + bp->bp_secs = bp->bp_hops = 0; | |
527 | + | |
528 | + if(debug) | |
529 | + report(LOG_INFO,"Received: DHCPREQUEST"); | |
530 | + /* | |
531 | + * Make absolutely sure that if the client requests an address, | |
532 | + * it is its own address, and also make sure the hardware | |
533 | + * addresses match perfectly. We want to minimize spoofing! | |
534 | + */ | |
535 | + if ((bp->bp_ciaddr.s_addr && bp->bp_ciaddr.s_addr!=bp->bp_yiaddr.s_addr) || | |
536 | + bp->bp_htype != hp->htype || | |
537 | + bcmp(bp->bp_chaddr, hp->haddr, haddrlength(hp->htype))) { | |
538 | + if (debug) | |
539 | + report(LOG_INFO, "Sent: DHCPNAK"); | |
540 | + | |
541 | + *vp++ = TAG_DHCP_MSG; /* DHCPNAK */ | |
542 | + *vp++ = 1; | |
543 | + *vp++ = 6; | |
544 | + return 3; | |
545 | + } | |
546 | + else | |
547 | + return(dhcp_ack(bp,hp,vp,bytesleft)); | |
548 | + } | |
549 | + | |
550 | + PRIVATE | |
551 | + int dhcp_ack(bp, hp, vp, bytesleft) | |
552 | + struct bootp *bp; | |
553 | + struct host *hp; | |
554 | + byte *vp; | |
555 | + int bytesleft; | |
556 | + { | |
557 | + int len=0; | |
558 | + if (debug) | |
559 | + report(LOG_INFO, "Sent: DHCPACK"); | |
560 | + | |
561 | + *vp++ = TAG_DHCP_MSG; /* DHCPACK */ | |
562 | + *vp++ = 1; | |
563 | + *vp++ = 5; | |
564 | + len += 3; | |
565 | + | |
566 | + len += dhcp_lease(bp,hp,&vp); | |
567 | + | |
568 | + *vp++ = TAG_DHCP_SERVERID; /* Server id */ | |
569 | + *vp++ = 4; | |
570 | + insert_u_long(my_ip_addr.s_addr,&vp); | |
571 | + len += 6; | |
572 | + | |
573 | + return len + dovend_rfc1497(hp, vp, bytesleft - len); | |
574 | + } | |
575 | + | |
576 | + /* | |
577 | + * formulate an DHCP_DECLINE reply | |
578 | + */ | |
579 | + PRIVATE | |
580 | + int dhcp_decline(bp, hp, vp, bytesleft) | |
581 | + struct bootp *bp; | |
582 | + struct host *hp; | |
583 | + byte *vp; | |
584 | + int bytesleft; | |
585 | + { | |
586 | + if (debug) | |
587 | + report(LOG_INFO, "Recived: DHCPDECLINE (ignored)"); | |
588 | + return 0; | |
589 | + } | |
590 | + #endif | |
591 | ||
592 | /* | |
593 | * Local Variables: | |
594 | diff -rc bootp-2.4.2/bootpd.h bootp-2.4.3/bootpd.h | |
595 | *** bootp-2.4.2/bootpd.h Thu Jul 28 00:30:29 1994 | |
596 | --- bootp-2.4.3/bootpd.h Thu Mar 16 08:17:23 1995 | |
597 | *************** | |
598 | *** 126,131 **** | |
599 | --- 126,134 ---- | |
600 | exec_file :1, | |
601 | msg_size :1, | |
602 | min_wait :1, | |
603 | + #ifdef DHCP | |
604 | + dhcp_lease :1, /* PeP hic facet */ | |
605 | + #endif | |
606 | /* XXX - Add new tags here */ | |
607 | vm_cookie :1; | |
608 | }; | |
609 | *************** | |
610 | *** 184,189 **** | |
611 | --- 187,195 ---- | |
612 | unsigned int32 bootsize, | |
613 | msg_size, | |
614 | min_wait; | |
615 | + #ifdef DHCP | |
616 | + unsigned int32 dhcp_lease; /* PeP hic facet */ | |
617 | + #endif | |
618 | struct in_addr bootserver, | |
619 | iaddr, | |
620 | swap_server, | |
621 | diff -rc bootp-2.4.2/bootptest.c bootp-2.4.3/bootptest.c | |
622 | *** bootp-2.4.2/bootptest.c Thu Feb 16 16:36:25 1995 | |
623 | --- bootp-2.4.3/bootptest.c Thu Mar 16 08:17:36 1995 | |
624 | *************** | |
625 | *** 50,55 **** | |
626 | --- 50,58 ---- | |
627 | #include <unistd.h> | |
628 | #endif | |
629 | ||
630 | + #ifndef NO_UNISTD | |
631 | + #include <unistd.h> | |
632 | + #endif | |
633 | #include <stdlib.h> | |
634 | #include <signal.h> | |
635 | #include <stdio.h> | |
636 | *************** | |
637 | *** 66,71 **** | |
638 | --- 69,77 ---- | |
639 | ||
640 | #include "patchlevel.h" | |
641 | ||
642 | + static void send_request(); | |
643 | + | |
644 | + extern int getether(); | |
645 | static void send_request(); | |
646 | ||
647 | #define LOG_ERR 1 | |
648 | diff -rc bootp-2.4.2/print-bootp.c bootp-2.4.3/print-bootp.c | |
649 | *** bootp-2.4.2/print-bootp.c Wed Feb 15 23:21:13 1995 | |
650 | --- bootp-2.4.3/print-bootp.c Thu Mar 16 08:41:15 1995 | |
651 | *************** | |
652 | *** 268,274 **** | |
653 | "iXW-FS", /* 48: X Window System Font Servers */ | |
654 | "iXW-DM", /* 49: X Window System Display Managers */ | |
655 | ||
656 | ! /* DHCP extensions (RFC-1533, sect. 9) */ | |
657 | #endif | |
658 | }; | |
659 | #define KNOWN_OPTIONS (sizeof(rfc1048_opts) / sizeof(rfc1048_opts[0])) | |
660 | --- 268,279 ---- | |
661 | "iXW-FS", /* 48: X Window System Font Servers */ | |
662 | "iXW-DM", /* 49: X Window System Display Managers */ | |
663 | ||
664 | ! /* DHCP extensions (RFC-1533, sect. 9) PeP hic facet */ | |
665 | ! "iDHCPreq", /* 50: DHCP requested IP address */ | |
666 | ! "lDHCPlease", /* 51: DHCP lease time */ | |
667 | ! "bDHCPooptol", /* 52: DHCP option overload */ | |
668 | ! "bDHCPtype", /* 53: DHCP message type */ | |
669 | ! "iDHCPSid", /* 54: DHCP server ID */ | |
670 | #endif | |
671 | }; | |
672 | #define KNOWN_OPTIONS (sizeof(rfc1048_opts) / sizeof(rfc1048_opts[0])) | |
673 | diff -rc bootp-2.4.2/readfile.c bootp-2.4.3/readfile.c | |
674 | *** bootp-2.4.2/readfile.c Wed Feb 15 21:45:25 1995 | |
675 | --- bootp-2.4.3/readfile.c Thu Mar 16 08:46:17 1995 | |
676 | *************** | |
677 | *** 113,118 **** | |
678 | --- 113,121 ---- | |
679 | #define SYM_EXEC_FILE 33 /* YORK_EX_OPTION */ | |
680 | #define SYM_MSG_SIZE 34 | |
681 | #define SYM_MIN_WAIT 35 | |
682 | + #define SYM_DHCP_LEASE 36 /* RFC 1533 PeP hic facet */ | |
683 | + #define SYM_DHCP_IPRENEW 37 | |
684 | + #define SYM_DHCP_IPREBIND 38 | |
685 | /* XXX - Add new tags here */ | |
686 | ||
687 | #define OP_ADDITION 1 /* Operations on tags */ | |
688 | *************** | |
689 | *** 161,166 **** | |
690 | --- 164,172 ---- | |
691 | {"df", SYM_DUMP_FILE}, | |
692 | {"dn", SYM_DOMAIN_NAME}, | |
693 | {"ds", SYM_DOMAIN_SERVER}, | |
694 | + #ifdef DHCP | |
695 | + {"dl", SYM_DHCP_LEASE}, /* PeP hic facet */ | |
696 | + #endif | |
697 | {"ef", SYM_EXTEN_FILE}, | |
698 | {"ex", SYM_EXEC_FILE}, /* YORK_EX_OPTION */ | |
699 | {"gw", SYM_GATEWAY}, | |
700 | *************** | |
701 | *** 1125,1131 **** | |
702 | PARSE_UINT(min_wait); | |
703 | break; | |
704 | ||
705 | ! /* XXX - Add new tags here */ | |
706 | ||
707 | default: | |
708 | return E_UNKNOWN_SYMBOL; | |
709 | --- 1131,1146 ---- | |
710 | PARSE_UINT(min_wait); | |
711 | break; | |
712 | ||
713 | ! #ifdef DHCP | |
714 | ! /* PeP hic facet. */ | |
715 | ! case SYM_DHCP_LEASE: | |
716 | ! PARSE_UINT(dhcp_lease); | |
717 | ! break; | |
718 | ! | |
719 | ! /* XXX - Add new DHCP tags here */ | |
720 | ! #endif | |
721 | ! | |
722 | ! /* XXX - Add new tags here */ | |
723 | ||
724 | default: | |
725 | return E_UNKNOWN_SYMBOL; | |
726 | *************** | |
727 | *** 1506,1511 **** | |
728 | --- 1521,1527 ---- | |
729 | DUP_COPY(min_wait); | |
730 | ||
731 | /* XXX - Add new tags here */ | |
732 | + DUP_COPY(dhcp_lease); /* PeP hic facet */ | |
733 | ||
734 | DUP_LINK(generic); | |
735 | ||
736 |