|
Lines 124-129
Link Here
|
| 124 |
u_char maxhops = 4; /* Number of hops allowed for requests. */ |
124 |
u_char maxhops = 4; /* Number of hops allowed for requests. */ |
| 125 |
u_int minwait = 3; /* Number of seconds client must wait before |
125 |
u_int minwait = 3; /* Number of seconds client must wait before |
| 126 |
its bootrequest packets are forwarded. */ |
126 |
its bootrequest packets are forwarded. */ |
|
|
127 |
int noarp = FALSE; /* skip modifications of ARP table */ |
| 127 |
|
128 |
|
| 128 |
/* |
129 |
/* |
| 129 |
* General |
130 |
* General |
|
Lines 238-243
Link Here
|
| 238 |
break; |
239 |
break; |
| 239 |
switch (argv[0][1]) { |
240 |
switch (argv[0][1]) { |
| 240 |
|
241 |
|
|
|
242 |
case 'a': /* don't modify the ARP table */ |
| 243 |
noarp = TRUE; |
| 244 |
break; |
| 241 |
case 'd': /* debug level */ |
245 |
case 'd': /* debug level */ |
| 242 |
if (argv[0][2]) { |
246 |
if (argv[0][2]) { |
| 243 |
stmp = &(argv[0][2]); |
247 |
stmp = &(argv[0][2]); |
|
Lines 496-502
Link Here
|
| 496 |
usage() |
500 |
usage() |
| 497 |
{ |
501 |
{ |
| 498 |
fprintf(stderr, |
502 |
fprintf(stderr, |
| 499 |
"usage: bootpgw [-d level] [-i] [-s] [-t timeout] server\n"); |
503 |
"usage: \nbootpgw [-a] [-d level] [-h count] [-i] [-s] [-t timeout] [-w time] server\n"); |
|
|
504 |
fprintf(stderr, "\t -a\tdon't modify ARP table\n"); |
| 500 |
fprintf(stderr, "\t -d n\tset debug level\n"); |
505 |
fprintf(stderr, "\t -d n\tset debug level\n"); |
| 501 |
fprintf(stderr, "\t -h n\tset max hop count\n"); |
506 |
fprintf(stderr, "\t -h n\tset max hop count\n"); |
| 502 |
fprintf(stderr, "\t -i\tforce inetd mode (run as child of inetd)\n"); |
507 |
fprintf(stderr, "\t -i\tforce inetd mode (run as child of inetd)\n"); |
|
Lines 641-659
Link Here
|
| 641 |
send_addr.sin_addr = bp->bp_yiaddr; |
646 |
send_addr.sin_addr = bp->bp_yiaddr; |
| 642 |
send_addr.sin_port = htons(bootpc_port); |
647 |
send_addr.sin_port = htons(bootpc_port); |
| 643 |
|
648 |
|
| 644 |
/* Create an ARP cache entry for the client. */ |
649 |
if ( noarp == FALSE ) { |
| 645 |
ha = bp->bp_chaddr; |
650 |
/* Create an ARP cache entry for the client. */ |
| 646 |
len = bp->bp_hlen; |
651 |
ha = bp->bp_chaddr; |
| 647 |
if (len > MAXHADDRLEN) |
652 |
len = bp->bp_hlen; |
| 648 |
len = MAXHADDRLEN; |
653 |
if (len > MAXHADDRLEN) |
| 649 |
haf = (int) bp->bp_htype; |
654 |
len = MAXHADDRLEN; |
| 650 |
if (haf == 0) |
655 |
haf = (int) bp->bp_htype; |
| 651 |
haf = HTYPE_ETHERNET; |
656 |
if (haf == 0) |
|
|
657 |
haf = HTYPE_ETHERNET; |
| 652 |
|
658 |
|
| 653 |
if (debug > 1) |
659 |
if (debug > 1) |
| 654 |
report(LOG_INFO, "setarp %s - %s", |
660 |
report(LOG_INFO, "setarp %s - %s", |
| 655 |
inet_ntoa(bp->bp_yiaddr), haddrtoa(ha, len)); |
661 |
inet_ntoa(dst), haddrtoa(ha, len)); |
| 656 |
setarp(s, &bp->bp_yiaddr, haf, ha, len); |
662 |
setarp(s, &dst, haf, ha, len); |
|
|
663 |
} |
| 657 |
|
664 |
|
| 658 |
/* Send reply with same size packet as request used. */ |
665 |
/* Send reply with same size packet as request used. */ |
| 659 |
if (sendto(s, pktbuf, pktlen, 0, |
666 |
if (sendto(s, pktbuf, pktlen, 0, |