|
Lines 130-135
Link Here
|
| 130 |
u_char maxhops = 4; /* Number of hops allowed for requests. */ |
130 |
u_char maxhops = 4; /* Number of hops allowed for requests. */ |
| 131 |
u_int minwait = 3; /* Number of seconds client must wait before |
131 |
u_int minwait = 3; /* Number of seconds client must wait before |
| 132 |
its bootrequest packets are forwarded. */ |
132 |
its bootrequest packets are forwarded. */ |
|
|
133 |
int noarp = FALSE; /* skip modifications of ARP table */ |
| 133 |
|
134 |
|
| 134 |
/* |
135 |
/* |
| 135 |
* General |
136 |
* General |
|
Lines 246-251
Link Here
|
| 246 |
break; |
247 |
break; |
| 247 |
switch (argv[0][1]) { |
248 |
switch (argv[0][1]) { |
| 248 |
|
249 |
|
|
|
250 |
case 'a': /* don't modify the ARP table */ |
| 251 |
noarp = TRUE; |
| 252 |
break; |
| 249 |
case 'd': /* debug level */ |
253 |
case 'd': /* debug level */ |
| 250 |
if (argv[0][2]) { |
254 |
if (argv[0][2]) { |
| 251 |
stmp = &(argv[0][2]); |
255 |
stmp = &(argv[0][2]); |
|
Lines 511-517
Link Here
|
| 511 |
usage() |
515 |
usage() |
| 512 |
{ |
516 |
{ |
| 513 |
fprintf(stderr, |
517 |
fprintf(stderr, |
| 514 |
"usage: bootpgw [-d level] [-i] [-s] [-t timeout] server\n"); |
518 |
"usage: \nbootpgw [-a] [-d level] [-h count] [-i] [-s] [-t timeout] [-w time] server\n"); |
|
|
519 |
fprintf(stderr, "\t -a\tdon't modify ARP table\n"); |
| 515 |
fprintf(stderr, "\t -d n\tset debug level\n"); |
520 |
fprintf(stderr, "\t -d n\tset debug level\n"); |
| 516 |
fprintf(stderr, "\t -h n\tset max hop count\n"); |
521 |
fprintf(stderr, "\t -h n\tset max hop count\n"); |
| 517 |
fprintf(stderr, "\t -i\tforce inetd mode (run as child of inetd)\n"); |
522 |
fprintf(stderr, "\t -i\tforce inetd mode (run as child of inetd)\n"); |
|
Lines 656-674
Link Here
|
| 656 |
send_addr.sin_addr = bp->bp_yiaddr; |
661 |
send_addr.sin_addr = bp->bp_yiaddr; |
| 657 |
send_addr.sin_port = htons(bootpc_port); |
662 |
send_addr.sin_port = htons(bootpc_port); |
| 658 |
|
663 |
|
| 659 |
/* Create an ARP cache entry for the client. */ |
664 |
if ( noarp == FALSE ) { |
| 660 |
ha = bp->bp_chaddr; |
665 |
/* Create an ARP cache entry for the client. */ |
| 661 |
len = bp->bp_hlen; |
666 |
ha = bp->bp_chaddr; |
| 662 |
if (len > MAXHADDRLEN) |
667 |
len = bp->bp_hlen; |
| 663 |
len = MAXHADDRLEN; |
668 |
if (len > MAXHADDRLEN) |
| 664 |
haf = (int) bp->bp_htype; |
669 |
len = MAXHADDRLEN; |
| 665 |
if (haf == 0) |
670 |
haf = (int) bp->bp_htype; |
| 666 |
haf = HTYPE_ETHERNET; |
671 |
if (haf == 0) |
|
|
672 |
haf = HTYPE_ETHERNET; |
| 667 |
|
673 |
|
| 668 |
if (debug > 1) |
674 |
if (debug > 1) |
| 669 |
report(LOG_INFO, "setarp %s - %s", |
675 |
report(LOG_INFO, "setarp %s - %s", |
| 670 |
inet_ntoa(bp->bp_yiaddr), haddrtoa(ha, len)); |
676 |
inet_ntoa(dst), haddrtoa(ha, len)); |
| 671 |
setarp(s, &bp->bp_yiaddr, haf, ha, len); |
677 |
setarp(s, &dst, haf, ha, len); |
|
|
678 |
} |
| 672 |
|
679 |
|
| 673 |
/* Send reply with same size packet as request used. */ |
680 |
/* Send reply with same size packet as request used. */ |
| 674 |
if (sendto(s, pktbuf, pktlen, 0, |
681 |
if (sendto(s, pktbuf, pktlen, 0, |