From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 90B42C04E69 for ; Mon, 14 Aug 2023 14:19:46 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E15578678A; Mon, 14 Aug 2023 16:19:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="onV1zL0x"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B617B867F7; Mon, 14 Aug 2023 16:19:43 +0200 (CEST) Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C0A5486679 for ; Mon, 14 Aug 2023 16:19:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3179ed1dfbbso3912674f8f.1 for ; Mon, 14 Aug 2023 07:19:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692022781; x=1692627581; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=6NL2vRBlMXHMqD6RTVuFdK8KdanDfk/bwngySIpTesA=; b=onV1zL0xuxJH1P3A+yvmPJjPQRPLHYqTmWwBnMl1pINAxOyjuiwk1uTtVJZTG3NQ7d cDet5jJSzSfE0A3jWlsGZAcxyvLuBrhQItBPCGv8mrMRqo/eQXEwi3cqGEfDPTH/Lxv6 QT52WwTToZfSXK5zczZuUm2XAl1HF4BV35W1qXGgCkfOSumzGZr81Iqu9w6FZADw9zSN pZd5GlvWqfIrawEII7uvnc36WUbn8R6nFkBkb3SST9RwVqdelwIXAdFVabi3dly1fTle ljsEBhHHGospHC/gtEkECibn3ZR/JuVfljYKSE4Ge6gOzrB3MrcmQXtV7I9AQqgCjZsN W3Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692022781; x=1692627581; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6NL2vRBlMXHMqD6RTVuFdK8KdanDfk/bwngySIpTesA=; b=ZRecRQTxw9CclvEv4Fqqw0fFVLW7bt1nPyvCehMIASN2++SjedsNdk9QsNVewT2/yV Umpn16SFBk8BDFTcr79I7raMLlJ3g5n7s69Rh9emI31UMc9HNKEiyDAT5AY6E/ziE4QL 3KaDmotxFatKpjg2clLUE+5htpfBrJfx5dqtxWOTkWdVwAllYERuc+zRbJbnTjZRIcxP LbQXM+865MwpEIHosI7+YuimFK+b+tv8N8ELNZfQPzysb/mU2ckNhZ8L0m7S6Q9SK0PU Ro1vkzE3LKnMTUymCCeTBqBIv4nPuPuObyzM5PxdoJv+iDQo479FW9HguWHh7CRJuSpT qnhw== X-Gm-Message-State: AOJu0YwpN5LspS1ml/oW4vocSGmnNmFpAp3OoucH9R5blSA/QwFR4b74 84Ja3mysz6b0zQrGKjgtlk35HQ== X-Google-Smtp-Source: AGHT+IHN1lD10yekRTbZ2jzkaAtbYjovmUoQSRFPiHoiN2GjZwV5m/LdhB4GEJEE7BWAs3jXVUh25A== X-Received: by 2002:a5d:5347:0:b0:314:3b1f:8ea2 with SMTP id t7-20020a5d5347000000b003143b1f8ea2mr7879484wrv.6.1692022781208; Mon, 14 Aug 2023 07:19:41 -0700 (PDT) Received: from hades (ppp089210246083.access.hol.gr. [89.210.246.83]) by smtp.gmail.com with ESMTPSA id r10-20020a5d52ca000000b003140fff4f75sm14653250wrv.17.2023.08.14.07.19.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Aug 2023 07:19:40 -0700 (PDT) Date: Mon, 14 Aug 2023 17:19:38 +0300 From: Ilias Apalodimas To: Maxim Uvarov Cc: u-boot@lists.denx.de, pbrobinson@redhat.com, joe.hershberger@ni.com, rfried.dev@gmail.com, trini@konsulko.com, goldsimon@gmx.de, lwip-devel@nongnu.org Subject: Re: [PATCHv6 03/14] net/lwip: implement dns cmd Message-ID: References: <20230814133253.4150-1-maxim.uvarov@linaro.org> <20230814133253.4150-4-maxim.uvarov@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230814133253.4150-4-maxim.uvarov@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean On Mon, Aug 14, 2023 at 07:32:42PM +0600, Maxim Uvarov wrote: > Implement function for dns command with lwIP variant. Usage and output is > the same as the original command. This code called by compatibility code > between U-Boot and lwIP. What's compatibility code? I think something along the lines of 'U-Boot recently got support for an alternative network stack using LWIP. Replace XXXX command with the LWIP variant while keeping the output and error messages identical" > + > +int do_lwip_dns(struct cmd_tbl *cmdtp, int flag, int argc, > + char *const argv[]); > + > +/* > +* This function creates the DNS request to resolve a domain host name. Function You need the name of the function as well. Please have a look at how the rest of the code is documented. > +* can return immediately if previous request was cached or it might require > +* entering the polling loop for a request to a remote server. > +* > +* @name dns name to resolve @name: etc > +* @varname (optional) U-Boot variable name to store the result > +* Return: ERR_OK(0) for fetching entry from the cache > +* ERR_INPROGRESS(-5) success, can go to the polling loop > +* Other value < 0, if error > +*/ > +int ulwip_dns(char *name, char *varname); > diff --git a/net/lwip/Makefile b/net/lwip/Makefile > index d1161bea78..6d2c00605b 100644 > --- a/net/lwip/Makefile > + */ > + > +#include > +#include > +#include > + > +#include > +#include > + > +#include > + > +static void dns_found_cb(const char *name, const ip_addr_t *ipaddr, void *callback_arg) > +{ > + char *varname = (char *)callback_arg; > + > + if (varname) > + env_set(varname, ip4addr_ntoa(ipaddr)); Why do we have to set the varname to the resolved address? Is this something the dns command already does? > + > + log_info("resolved %s to %s\n", name, ip4addr_ntoa(ipaddr)); > + ulwip_exit(0); > +} > + > +int ulwip_dns(char *name, char *varname) > +{ > + int err; > + ip_addr_t ipaddr; /* not used */ > + ip_addr_t dns1; > + ip_addr_t dns2; > + > + ipaddr_aton(env_get("dnsip"), &dns1); > + ipaddr_aton(env_get("dnsip2"), &dns2); > + > + dns_init(); > + dns_setserver(0, &dns1); > + dns_setserver(1, &dns2); > + > + err = dns_gethostbyname(name, &ipaddr, dns_found_cb, varname); > + if (err == ERR_OK) > + dns_found_cb(name, &ipaddr, varname); > + > + return err; > +} > -- > 2.30.2 > Thanks /Ilias