| 404 | } |
| 405 | |
| 406 | static void |
| 407 | debugnet_handle_ack(struct debugnet_pcb *pcb, struct mbuf **mb, uint16_t sport) |
| 408 | { |
| 409 | const struct debugnet_ack *dn_ack; |
| 410 | struct mbuf *m; |
| 411 | uint32_t rcv_ackno; |
| 412 | |
| 413 | m = *mb; |
| 414 | |
| 415 | /* Get Ack. */ |
| 416 | if (m->m_len < sizeof(*dn_ack)) { |
| 417 | m = m_pullup(m, sizeof(*dn_ack)); |
| 418 | *mb = m; |
| 419 | if (m == NULL) { |
| 420 | DNETDEBUG("m_pullup failed\n"); |
| 421 | return; |
| 422 | } |
| 423 | } |
| 424 | dn_ack = mtod(m, const void *); |
| 425 | |
| 426 | /* Debugnet processing. */ |
| 427 | /* |
| 428 | * Packet is meant for us. Extract the ack sequence number and the |
| 429 | * port number if necessary. |
| 430 | */ |
| 431 | rcv_ackno = ntohl(dn_ack->da_seqno); |
| 432 | if (pcb->dp_state < DN_STATE_GOT_HERALD_PORT) { |
| 433 | pcb->dp_server_port = sport; |
| 434 | pcb->dp_state = DN_STATE_GOT_HERALD_PORT; |
| 435 | } |
| 436 | if (rcv_ackno >= pcb->dp_seqno + DEBUGNET_MAX_IN_FLIGHT) |
| 437 | printf("%s: ACK %u too far in future!\n", __func__, rcv_ackno); |
| 438 | else if (rcv_ackno >= pcb->dp_seqno) { |
| 439 | /* We're interested in this ack. Record it. */ |
| 440 | pcb->dp_rcvd_acks |= 1 << (rcv_ackno - pcb->dp_seqno); |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | void |
| 445 | debugnet_handle_udp(struct debugnet_pcb *pcb, struct mbuf **mb) |
no test coverage detected