Skip to content

Commit

Permalink
Acknowledge pbufs following the first one
Browse files Browse the repository at this point in the history
  • Loading branch information
malwarepad committed Dec 2, 2024
1 parent e379e8a commit d25ba1d
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/kernel/drivers/nics/nic_controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@ void initiateNetworking() {
}

err_t lwipOutput(struct netif *netif, struct pbuf *p) {
uint8_t *complete = malloc(p->tot_len);
struct pbuf *browse = p;
uint32_t cnt = 0;

while (browse) {
memcpy(&complete[cnt], browse->payload, browse->len);
cnt += browse->len;
browse = browse->next;
}

if (cnt != p->tot_len) {
debugf("[networking::lwipOut] Something is seriously wrong! tot_len{%d} "
"cnt{%d}\n",
p->tot_len, cnt);
panic();
}

PCI *pci = firstPCI;
while (pci) {
NIC *nic = (NIC *)pci->extra;
Expand All @@ -46,7 +63,7 @@ err_t lwipOutput(struct netif *netif, struct pbuf *p) {
}

NIC *nic = (NIC *)pci->extra;
sendPacketRaw(nic, p->payload, p->len);
sendPacketRaw(nic, complete, p->tot_len);
return ERR_OK;
}

Expand Down

0 comments on commit d25ba1d

Please sign in to comment.