From fbff149ce2d9649f4179b6d8ca3dd0cc2ec64675 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Thu, 7 Jul 2022 12:46:15 -0400 Subject: [PATCH] openbsd_network: Refactor if_input_openbsd to use ml_dequeue. Should not be any functional change. --- .../compat/openbsd_network/compat/net/if_var.h | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/libs/compat/openbsd_network/compat/net/if_var.h b/src/libs/compat/openbsd_network/compat/net/if_var.h index 6e138d26b3..fafb0a0ba5 100644 --- a/src/libs/compat/openbsd_network/compat/net/if_var.h +++ b/src/libs/compat/openbsd_network/compat/net/if_var.h @@ -12,25 +12,14 @@ static inline int if_input_openbsd(if_t ifp, struct mbuf_list* ml) { - if (ml_empty(ml)) - return 0; - - struct mbuf* mb = ml->ml_head, *next = NULL; + struct mbuf* m; int status = 0; - while (mb != NULL) { - // if_input takes only the first packet, it ignores mb->m_nextpkt. - next = mb->m_nextpkt; - status = if_input(ifp, mb); + while ((m = ml_dequeue(ml)) != NULL) { + status = if_input(ifp, m); if (status != 0) break; - - mb = next; - next = NULL; } - if (next != NULL) - m_freem(next); - ml_init(ml); return status; } #define if_input if_input_openbsd