mirror of
https://github.com/opnsense/src.git
synced 2026-06-14 19:20:18 -04:00
debugnet: Fix false-positive assertions for dp_state
debugnet_handle_arp: An assertion is present to ensure the pcb is only modified when the state is DN_STATE_INIT. Because debugnet_arp_gw() is asynchronous it is possible for ARP replies to come in after the gateway address is known and the state already changed. debugnet_handle_ip: Similarly it is possible for packets to come in, from the expected server, during the gateway mac discovery phase. This can happen from testing disconnects / reconnects in quick succession. This later causes some acks to be sent back but hit an assertion because the state is wrong. Reviewed by: cem, debugnet_handle_arp: markj, vangyzen Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D31327
This commit is contained in:
parent
07c4b78d0a
commit
7cbf1de38e
1 changed files with 10 additions and 1 deletions
|
|
@ -86,6 +86,9 @@ debugnet_handle_ip(struct debugnet_pcb *pcb, struct mbuf **mb)
|
|||
struct mbuf *m;
|
||||
unsigned short hlen;
|
||||
|
||||
if (pcb->dp_state < DN_STATE_HAVE_GW_MAC)
|
||||
return;
|
||||
|
||||
/* IP processing. */
|
||||
m = *mb;
|
||||
if (m->m_pkthdr.len < sizeof(struct ip)) {
|
||||
|
|
@ -347,13 +350,19 @@ debugnet_handle_arp(struct debugnet_pcb *pcb, struct mbuf **mb)
|
|||
" server or gateway)\n", buf);
|
||||
return;
|
||||
}
|
||||
if (pcb->dp_state >= DN_STATE_HAVE_GW_MAC) {
|
||||
inet_ntoa_r(isaddr, buf);
|
||||
DNETDEBUG("ignoring server ARP reply from %s (already"
|
||||
" have gateway address)\n", buf);
|
||||
return;
|
||||
}
|
||||
MPASS(pcb->dp_state == DN_STATE_INIT);
|
||||
memcpy(pcb->dp_gw_mac.octet, ar_sha(ah),
|
||||
min(ah->ar_hln, ETHER_ADDR_LEN));
|
||||
|
||||
DNETDEBUG("got server MAC address %6D\n",
|
||||
pcb->dp_gw_mac.octet, ":");
|
||||
|
||||
MPASS(pcb->dp_state == DN_STATE_INIT);
|
||||
pcb->dp_state = DN_STATE_HAVE_GW_MAC;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue