[PATCH 05/10] net: dns: use net_eth_to_udp() for packet parsing
Ahmad Fatoum
a.fatoum at pengutronix.de
Fri Apr 17 03:10:39 PDT 2026
On 4/2/26 8:36 AM, Sascha Hauer wrote:
> 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>
Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
> 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)
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list