Commit ee46e7f
Konur
Use shorter pcap buffer timeout for response capture
dhcp-probe uses response_wait_time as the total window for listening
for DHCP/BOOTP replies, enforced by alarm() and pcap_breakloop().
The timeout passed to pcap_open_live(), however, is a packet buffer
timeout. When both values are the same, replies can remain buffered
inside libpcap until dhcp_probe's alarm fires. In that case
pcap_dispatch() can return due to pcap_breakloop() before the buffered
reply is delivered to process_response(), causing the alert path to be
missed. This is an undesired race condition resulting in the dhcp-probe
tool to fail to detect DHCP servers nearly 100 percent of the time (at
least on certian networks).
Use a shorter pcap buffer timeout derived from response_wait_time so
pcap_dispatch() wakes periodically and processes captured replies before
the overall response window expires.
Change-Id: If4b9d6076447fcecdbe069277325d067dfb0fd551 parent ea66e80 commit ee46e7f
1 file changed
Lines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
78 | 84 | | |
79 | 85 | | |
80 | 86 | | |
| |||
517 | 523 | | |
518 | 524 | | |
519 | 525 | | |
520 | | - | |
| 526 | + | |
521 | 527 | | |
522 | 528 | | |
523 | 529 | | |
| |||
1297 | 1303 | | |
1298 | 1304 | | |
1299 | 1305 | | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
0 commit comments