[PATCH 05/10] net: dns: use net_eth_to_udp() for packet parsing
Sascha Hauer
s.hauer at pengutronix.de
Wed Apr 1 23:36:44 PDT 2026
Replace the separate net_eth_to_udp_payload() and net_eth_to_udplen()
calls with the new consolidated net_eth_to_udp() helper.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
Co-Authored-By: Claude Opus 4.6 <noreply at anthropic.com>
---
net/dns.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/net/dns.c b/net/dns.c
index 8fbd13cdc3..8616e353c1 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -206,9 +206,12 @@ static void dns_recv(struct header *header, unsigned len)
static void dns_handler(void *ctx, char *packet, unsigned len)
{
- (void)ctx;
- dns_recv((struct header *)net_eth_to_udp_payload(packet),
- net_eth_to_udplen(packet));
+ struct net_udp_pkt udp;
+
+ if (net_eth_to_udp(packet, len, &udp))
+ return;
+
+ dns_recv(udp.payload, udp.len);
}
int resolv(const char *host, IPaddr_t *ip)
--
2.47.3
More information about the barebox
mailing list