get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2113107/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2113107,
    "url": "http://patchwork.ozlabs.org/api/patches/2113107/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20250718104852.724720-1-jerome.forissier@linaro.org/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api",
        "name": "U-Boot",
        "link_name": "uboot",
        "list_id": "u-boot.lists.denx.de",
        "list_email": "u-boot@lists.denx.de",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20250718104852.724720-1-jerome.forissier@linaro.org>",
    "list_archive_url": null,
    "date": "2025-07-18T10:48:48",
    "name": "net: introduce CONFIG_DNS",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "e51e7af1adaaa493645f41b9395d2555852bde5e",
    "submitter": {
        "id": 69192,
        "url": "http://patchwork.ozlabs.org/api/people/69192/?format=api",
        "name": "Jerome Forissier",
        "email": "jerome.forissier@linaro.org"
    },
    "delegate": {
        "id": 157425,
        "url": "http://patchwork.ozlabs.org/api/users/157425/?format=api",
        "username": "jforissier",
        "first_name": "Jerome",
        "last_name": "Forissier",
        "email": "jerome.forissier@linaro.org"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20250718104852.724720-1-jerome.forissier@linaro.org/mbox/",
    "series": [
        {
            "id": 465780,
            "url": "http://patchwork.ozlabs.org/api/series/465780/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=465780",
            "date": "2025-07-18T10:48:48",
            "name": "net: introduce CONFIG_DNS",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/465780/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2113107/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2113107/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=JQ5v/xGM;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)",
            "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=linaro.org",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de",
            "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.b=\"JQ5v/xGM\";\n\tdkim-atps=neutral",
            "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=linaro.org",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=jerome.forissier@linaro.org"
        ],
        "Received": [
            "from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (secp384r1))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4bk63m0YScz1xpg\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 18 Jul 2025 20:49:07 +1000 (AEST)",
            "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 0A41F835FD;\n\tFri, 18 Jul 2025 12:49:15 +0200 (CEST)",
            "by phobos.denx.de (Postfix, from userid 109)\n id A6A3283623; Fri, 18 Jul 2025 12:49:14 +0200 (CEST)",
            "from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com\n [IPv6:2a00:1450:4864:20::42f])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 51EFD835B3\n for <u-boot@lists.denx.de>; Fri, 18 Jul 2025 12:49:12 +0200 (CEST)",
            "by mail-wr1-x42f.google.com with SMTP id\n ffacd0b85a97d-3a53359dea5so904403f8f.0\n for <u-boot@lists.denx.de>; Fri, 18 Jul 2025 03:49:12 -0700 (PDT)",
            "from builder.. ([2a01:e0a:3cb:7bb0:2f7f:79e1:d80d:c17])\n by smtp.gmail.com with ESMTPSA id\n ffacd0b85a97d-3b61ca5c8dfsm1476577f8f.82.2025.07.18.03.49.09\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 18 Jul 2025 03:49:10 -0700 (PDT)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,\n SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1752835751; x=1753440551; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=i7/kERlNBthTia83by5thLhVXgZMWXVXxt9yrFyV1R8=;\n b=JQ5v/xGMiINvD7HKywqPiFULjKOwB7kFljqRU7WQRahdd6KhlzhXzRg6p8eYnXlapd\n H6cg6aoD6WNZavdMP5BqCTKJboMtBwYL4mo5IqofSgeEOyRlKT7bjt7m+Kip3VzsZMyb\n M4HuB5XDpj40D2eKJAOGgEZm05iEOqzgbrSbcFJ3OOMRjh25KqIQkTSyzvUPfy8HIkXQ\n 2IYdM8Tb/wY0QRjEG3Tb2/p1riy47JyiQFt8/4lV+o0WWCGSCjCn1/RFyiD7uegd2yFy\n tv+VKG6rY8oCmtvdRIfkqFyl9rkuM52DznJ51xMo4e0ZnGTZdCo7eksXRfeJwCdpOfP/\n nx/w==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1752835751; x=1753440551;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=i7/kERlNBthTia83by5thLhVXgZMWXVXxt9yrFyV1R8=;\n b=cMROUi6pGDEKN6Ykzqzvn0YfrSNo36nToTuHUZGlr+0o33zlY/qd/sYRGJFzuhgpkB\n +mEggVN8F6FL0xZHs9uZyzCWuOWlLgAQVOy0xe/JfTNZNd6Hr7csoKzzkaPD2rjv055B\n UcTsXBKbv1Na5iKMZ7EqcXH927z7cYUKHZlCZw82d3AKSgvH2fMaxVp5txquh9tXeyiA\n fj4yZjB6+pzzIpiYK+3pC0pSZ3ifzMOK/+NOmSOC/bosmQ2qsPXIUSvBsMLmKa6dpA2Q\n zKGfCLuN5SQOIF6Nuu8eJLxUZJotUdWYse+9yps0ECCwkJVtn3mgr8aLGrkGOE6+Ehde\n GSJA==",
        "X-Gm-Message-State": "AOJu0YzeSRD5TJCsIAxkN1xNi1l3jotFsHQQey9y5DFLdoCbyPcxRMb1\n 2H2LgBo8db0PRQrD0roy0EtAxucNMT0M6A20qqh7Cdwne33oOtHjFguuelYaUAcUwW8R03U/X9/\n /ctuVtcQ=",
        "X-Gm-Gg": "ASbGncvAaJsyZKuosNb9EcMQkcZjCq2iNAarum9SxXkroY0sDdKJ5AF7CA/kDbsTDAH\n 1hhQIgZMcYLQcUQupEcEHVfAg0U3+7q38NeE8BKCUqC32KcWrZHK9HoM/RrEulwfpbVYq02sMqv\n znXxQKRZm8uJS1Rqxp7Bvled0trQBowpeE6daZruPshXlKBnZ03sOLCvRSBKn84NijSv+FhSlLB\n kmfa80eLtNVLZp2fYZKQ5+SeLggHfZDtNeHrIhvQ0l2sltZGKQRoW6nYwil6a/tLPEgjRFBL7Wo\n vv3jkiOCoUsbY1MTtAzD8Eov1+J7BbSCKYSX4ejszMykHqJImMUwudfJoGgw8+MuCanHL/JGSRm\n QzVgqP5E5zXrwZ6I9eJ4z6vf8kVNT1A==",
        "X-Google-Smtp-Source": "\n AGHT+IHgVQLtLr784qKCB8oJhaquzIVKmAvlcuQ2x9ZtLECH/NvJj/rXRrHq0/H7oLW9z/KSQbq08Q==",
        "X-Received": "by 2002:a05:6000:490c:b0:3a4:d02e:84af with SMTP id\n ffacd0b85a97d-3b60e5531d6mr6569830f8f.58.1752835751145;\n Fri, 18 Jul 2025 03:49:11 -0700 (PDT)",
        "From": "Jerome Forissier <jerome.forissier@linaro.org>",
        "To": "U-Boot mailing list <u-boot@lists.denx.de>",
        "Cc": "Jerome Forissier <jerome.forissier@linaro.org>,\n E Shattow <e@freeshell.de>,\n Adriano Cordova <adrianox@gmail.com>,\n Heinrich Schuchardt <xypron.glpk@gmx.de>,\n Ibai Erkiaga <ibai.erkiaga-elorza@amd.com>,\n Ilias Apalodimas <ilias.apalodimas@linaro.org>,\n Joe Hershberger <joe.hershberger@ni.com>,\n Marek Vasut <marek.vasut+renesas@mailbox.org>,\n Martyn Welch <martyn.welch@collabora.com>,\n Mattijs Korpershoek <mkorpershoek@kernel.org>,\n Michal Simek <michal.simek@amd.com>,\n Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>,\n Ramon Fried <rfried.dev@gmail.com>, Simon Glass <sjg@chromium.org>,\n Sughosh Ganu <sughosh.ganu@linaro.org>, Tim Harvey <tharvey@gateworks.com>,\n Tom Rini <trini@konsulko.com>",
        "Subject": "[PATCH] net: introduce CONFIG_DNS",
        "Date": "Fri, 18 Jul 2025 12:48:48 +0200",
        "Message-ID": "<20250718104852.724720-1-jerome.forissier@linaro.org>",
        "X-Mailer": "git-send-email 2.43.0",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.39",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>",
        "List-Post": "<mailto:u-boot@lists.denx.de>",
        "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>",
        "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "Errors-To": "u-boot-bounces@lists.denx.de",
        "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>",
        "X-Virus-Scanned": "clamav-milter 0.103.8 at phobos.denx.de",
        "X-Virus-Status": "Clean"
    },
    "content": "Introduce the DNS Kconfig symbol so that various network commands may\nuse host names without the dns command (CMD_DNS) being selected.\n\nSigned-off-by: Jerome Forissier <jerome.forissier@linaro.org>\nCC: E Shattow <e@freeshell.de>\n---\n\n cmd/Kconfig            |   2 +-\n cmd/lwip/dns.c         | 108 ---------------------------------------\n doc/usage/cmd/sntp.rst |   8 +--\n doc/usage/cmd/wget.rst |   2 +-\n include/net-legacy.h   |   2 +-\n net/Kconfig            |   8 ++-\n net/Makefile           |   2 +-\n net/lwip/Makefile      |   1 +\n net/lwip/dns.c         | 113 +++++++++++++++++++++++++++++++++++++++++\n net/lwip/net-lwip.c    |   6 +--\n net/net.c              |  10 ++--\n net/wget.c             |   2 +-\n 12 files changed, 138 insertions(+), 126 deletions(-)\n create mode 100644 net/lwip/dns.c",
    "diff": "diff --git a/cmd/Kconfig b/cmd/Kconfig\nindex b3b5be1ea79..7a9c4ddb215 100644\n--- a/cmd/Kconfig\n+++ b/cmd/Kconfig\n@@ -2110,7 +2110,7 @@ config CMD_DHCP\n \n config CMD_DNS\n \tbool \"dns\"\n-\tselect PROT_DNS_LWIP if NET_LWIP\n+\tselect DNS\n \thelp\n \t  Lookup the IP of a hostname\n \ndiff --git a/cmd/lwip/dns.c b/cmd/lwip/dns.c\nindex b5fccc7433e..3eb698b3f82 100644\n--- a/cmd/lwip/dns.c\n+++ b/cmd/lwip/dns.c\n@@ -2,115 +2,7 @@\n /* Copyright (C) 2024 Linaro Ltd. */\n \n #include <command.h>\n-#include <console.h>\n-#include <env.h>\n-#include <lwip/dns.h>\n-#include <lwip/timeouts.h>\n #include <net.h>\n-#include <time.h>\n \n U_BOOT_CMD(dns, 3, 1, do_dns, \"lookup the IP of a hostname\",\n \t   \"hostname [envvar]\");\n-\n-#define DNS_RESEND_MS 1000\n-#define DNS_TIMEOUT_MS 10000\n-\n-struct dns_cb_arg {\n-\tip_addr_t host_ipaddr;\n-\tconst char *var;\n-\tbool done;\n-};\n-\n-static void do_dns_tmr(void *arg)\n-{\n-\tdns_tmr();\n-}\n-\n-static void dns_cb(const char *name, const ip_addr_t *ipaddr, void *arg)\n-{\n-\tstruct dns_cb_arg *dns_cb_arg = arg;\n-\tchar *ipstr = ip4addr_ntoa(ipaddr);\n-\n-\tdns_cb_arg->done = true;\n-\n-\tif (!ipaddr) {\n-\t\tprintf(\"DNS: host not found\\n\");\n-\t\tdns_cb_arg->host_ipaddr.addr = 0;\n-\t\treturn;\n-\t}\n-\n-\tdns_cb_arg->host_ipaddr.addr = ipaddr->addr;\n-\n-\tif (dns_cb_arg->var)\n-\t\tenv_set(dns_cb_arg->var, ipstr);\n-}\n-\n-static int dns_loop(struct udevice *udev, const char *name, const char *var)\n-{\n-\tstruct dns_cb_arg dns_cb_arg = { };\n-\tstruct netif *netif;\n-\tip_addr_t ipaddr;\n-\tulong start;\n-\tint ret;\n-\n-\tdns_cb_arg.var = var;\n-\n-\tnetif = net_lwip_new_netif(udev);\n-\tif (!netif)\n-\t\treturn CMD_RET_FAILURE;\n-\n-\tif (net_lwip_dns_init()) {\n-\t\tnet_lwip_remove_netif(netif);\n-\t\treturn CMD_RET_FAILURE;\n-\t}\n-\n-\tdns_cb_arg.done = false;\n-\n-\tret = dns_gethostbyname(name, &ipaddr, dns_cb, &dns_cb_arg);\n-\n-\tif (ret == ERR_OK) {\n-\t\tdns_cb(name, &ipaddr, &dns_cb_arg);\n-\t} else if (ret == ERR_INPROGRESS) {\n-\t\tstart = get_timer(0);\n-\t\tsys_timeout(DNS_RESEND_MS, do_dns_tmr, NULL);\n-\t\tdo {\n-\t\t\tnet_lwip_rx(udev, netif);\n-\t\t\tif (dns_cb_arg.done)\n-\t\t\t\tbreak;\n-\t\t\tif (ctrlc()) {\n-\t\t\t\tprintf(\"\\nAbort\\n\");\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t} while (get_timer(start) < DNS_TIMEOUT_MS);\n-\t\tsys_untimeout(do_dns_tmr, NULL);\n-\t}\n-\n-\tnet_lwip_remove_netif(netif);\n-\n-\tif (dns_cb_arg.done && dns_cb_arg.host_ipaddr.addr != 0) {\n-\t\tif (!var)\n-\t\t\tprintf(\"%s\\n\", ipaddr_ntoa(&ipaddr));\n-\t\treturn CMD_RET_SUCCESS;\n-\t}\n-\n-\treturn CMD_RET_FAILURE;\n-}\n-\n-int do_dns(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])\n-{\n-\tchar *name;\n-\tchar *var = NULL;\n-\n-\tif (argc == 1 || argc > 3)\n-\t\treturn CMD_RET_USAGE;\n-\n-\tname = argv[1];\n-\n-\tif (argc == 3)\n-\t\tvar = argv[2];\n-\n-\tif (net_lwip_eth_start() < 0)\n-\t\treturn CMD_RET_FAILURE;\n-\n-\treturn dns_loop(eth_get_dev(), name, var);\n-}\ndiff --git a/doc/usage/cmd/sntp.rst b/doc/usage/cmd/sntp.rst\nindex d97f83053f7..2046828130d 100644\n--- a/doc/usage/cmd/sntp.rst\n+++ b/doc/usage/cmd/sntp.rst\n@@ -12,7 +12,7 @@ Synopsis\n ::\n \n     sntp [serverip]\n-    sntp [servername]  # NET_LWIP=y && CMD_DNS=y only\n+    sntp [servername]  # NET_LWIP=y && DNS=y only\n \n \n Description\n@@ -27,8 +27,8 @@ The address of the NTP server does not need to be given if the DHCP server\n provides one. The legacy network stack (`CONFIG_NET=y`) can only use the\n first NTP server provided in the `ntp-servers` DHCP option.\n \n-When the network stack is lwIP (`CONFIG_NET_LWIP=y`) and the dns command\n-is enabled (`CONFIG_CMD_DNS=y`), then the sntp command accepts a server\n+When the network stack is lwIP (`CONFIG_NET_LWIP=y`) and DNS resolution\n+is enabled (`CONFIG_DNS=y`), then the sntp command accepts a server\n name as an argument.\n \n The network time is sent as UTC. So, if you want to set the RTC to any local\n@@ -61,7 +61,7 @@ Examples\n     => date\n     Date: 2025-06-16 (Monday)    Time: 17:19:57\n \n-With `CONFIG_NET_LWIP=y` and `CONFIG_CMD_DNS=y`:\n+With `CONFIG_NET_LWIP=y` and `CONFIG_DNS=y`:\n \n ::\n \ndiff --git a/doc/usage/cmd/wget.rst b/doc/usage/cmd/wget.rst\nindex 06df2842549..8feda0248b2 100644\n--- a/doc/usage/cmd/wget.rst\n+++ b/doc/usage/cmd/wget.rst\n@@ -38,7 +38,7 @@ address\n     memory address for the data downloaded\n \n host\n-    IP address (or host name if `CONFIG_CMD_DNS` is enabled) of the HTTP\n+    IP address (or host name if `CONFIG_DNS` is enabled) of the HTTP\n     server, defaults to the value of environment variable *serverip*.\n \n path\ndiff --git a/include/net-legacy.h b/include/net-legacy.h\nindex a7dbcec1506..7ba5148a75a 100644\n--- a/include/net-legacy.h\n+++ b/include/net-legacy.h\n@@ -316,7 +316,7 @@ extern u32\tnet_boot_file_size;\n /* Boot file size in blocks as reported by the DHCP server */\n extern u32\tnet_boot_file_expected_size_in_blocks;\n \n-#if defined(CONFIG_CMD_DNS)\n+#if defined(CONFIG_DNS)\n extern char *net_dns_resolve;\t\t/* The host to resolve  */\n extern char *net_dns_env_var;\t\t/* the env var to put the ip into */\n #endif\ndiff --git a/net/Kconfig b/net/Kconfig\nindex 24508026200..40ec6bbce76 100644\n--- a/net/Kconfig\n+++ b/net/Kconfig\n@@ -244,11 +244,17 @@ config NET_RANDOM_ETHADDR\n \t  generated. It will be saved to the appropriate environment variable,\n \t  too.\n \n+config DNS\n+\tbool \"Enable DNS resolutions\"\n+\tselect PROT_DNS_LWIP if NET_LWIP\n+\thelp\n+\t  Selecting this will allow the network stack to use server names\n+\t  in addition to IP addresses.\n+\n config WGET\n \tbool \"Enable wget\"\n \tselect PROT_TCP if NET\n \tselect PROT_TCP_LWIP if NET_LWIP\n-\tselect PROT_DNS_LWIP if NET_LWIP\n \thelp\n \t  Selecting this will enable wget, an interface to send HTTP requests\n \t  via the network stack.\ndiff --git a/net/Makefile b/net/Makefile\nindex d63f62b7c8a..468820186cf 100644\n--- a/net/Makefile\n+++ b/net/Makefile\n@@ -10,7 +10,7 @@ ifeq ($(CONFIG_NET),y)\n obj-$(CONFIG_NET)      += arp.o\n obj-$(CONFIG_CMD_BOOTP) += bootp.o\n obj-$(CONFIG_CMD_CDP)  += cdp.o\n-obj-$(CONFIG_CMD_DNS)  += dns.o\n+obj-$(CONFIG_DNS)  += dns.o\n obj-$(CONFIG_CMD_LINK_LOCAL) += link_local.o\n obj-$(CONFIG_IPV6)     += ndisc.o\n obj-$(CONFIG_$(PHASE_)DM_ETH) += net.o\ndiff --git a/net/lwip/Makefile b/net/lwip/Makefile\nindex 97299d9b542..90d3300bd12 100644\n--- a/net/lwip/Makefile\n+++ b/net/lwip/Makefile\n@@ -2,6 +2,7 @@ ccflags-y += -I$(srctree)/lib/lwip/lwip/src/include -I$(srctree)/lib/lwip/u-boot\n \n obj-$(CONFIG_$(PHASE_)DM_ETH) += net-lwip.o\n obj-$(CONFIG_CMD_DHCP) += dhcp.o\n+obj-$(CONFIG_DNS) += dns.o\n obj-$(CONFIG_CMD_TFTPBOOT) += tftp.o\n obj-$(CONFIG_WGET) += wget.o\n \ndiff --git a/net/lwip/dns.c b/net/lwip/dns.c\nnew file mode 100644\nindex 00000000000..9964003195f\n--- /dev/null\n+++ b/net/lwip/dns.c\n@@ -0,0 +1,113 @@\n+// SPDX-License-Identifier: GPL-2.0+\n+/* Copyright (C) 2024 Linaro Ltd. */\n+\n+#include <command.h>\n+#include <console.h>\n+#include <env.h>\n+#include <lwip/dns.h>\n+#include <lwip/timeouts.h>\n+#include <net.h>\n+#include <time.h>\n+\n+#define DNS_RESEND_MS 1000\n+#define DNS_TIMEOUT_MS 10000\n+\n+struct dns_cb_arg {\n+\tip_addr_t host_ipaddr;\n+\tconst char *var;\n+\tbool done;\n+};\n+\n+static void do_dns_tmr(void *arg)\n+{\n+\tdns_tmr();\n+}\n+\n+static void dns_cb(const char *name, const ip_addr_t *ipaddr, void *arg)\n+{\n+\tstruct dns_cb_arg *dns_cb_arg = arg;\n+\tchar *ipstr = ip4addr_ntoa(ipaddr);\n+\n+\tdns_cb_arg->done = true;\n+\n+\tif (!ipaddr) {\n+\t\tprintf(\"DNS: host not found\\n\");\n+\t\tdns_cb_arg->host_ipaddr.addr = 0;\n+\t\treturn;\n+\t}\n+\n+\tdns_cb_arg->host_ipaddr.addr = ipaddr->addr;\n+\n+\tif (dns_cb_arg->var)\n+\t\tenv_set(dns_cb_arg->var, ipstr);\n+}\n+\n+static int dns_loop(struct udevice *udev, const char *name, const char *var)\n+{\n+\tstruct dns_cb_arg dns_cb_arg = { };\n+\tstruct netif *netif;\n+\tip_addr_t ipaddr;\n+\tulong start;\n+\tint ret;\n+\n+\tdns_cb_arg.var = var;\n+\n+\tnetif = net_lwip_new_netif(udev);\n+\tif (!netif)\n+\t\treturn CMD_RET_FAILURE;\n+\n+\tif (net_lwip_dns_init()) {\n+\t\tnet_lwip_remove_netif(netif);\n+\t\treturn CMD_RET_FAILURE;\n+\t}\n+\n+\tdns_cb_arg.done = false;\n+\n+\tret = dns_gethostbyname(name, &ipaddr, dns_cb, &dns_cb_arg);\n+\n+\tif (ret == ERR_OK) {\n+\t\tdns_cb(name, &ipaddr, &dns_cb_arg);\n+\t} else if (ret == ERR_INPROGRESS) {\n+\t\tstart = get_timer(0);\n+\t\tsys_timeout(DNS_RESEND_MS, do_dns_tmr, NULL);\n+\t\tdo {\n+\t\t\tnet_lwip_rx(udev, netif);\n+\t\t\tif (dns_cb_arg.done)\n+\t\t\t\tbreak;\n+\t\t\tif (ctrlc()) {\n+\t\t\t\tprintf(\"\\nAbort\\n\");\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t} while (get_timer(start) < DNS_TIMEOUT_MS);\n+\t\tsys_untimeout(do_dns_tmr, NULL);\n+\t}\n+\n+\tnet_lwip_remove_netif(netif);\n+\n+\tif (dns_cb_arg.done && dns_cb_arg.host_ipaddr.addr != 0) {\n+\t\tif (!var)\n+\t\t\tprintf(\"%s\\n\", ipaddr_ntoa(&ipaddr));\n+\t\treturn CMD_RET_SUCCESS;\n+\t}\n+\n+\treturn CMD_RET_FAILURE;\n+}\n+\n+int do_dns(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])\n+{\n+\tchar *name;\n+\tchar *var = NULL;\n+\n+\tif (argc == 1 || argc > 3)\n+\t\treturn CMD_RET_USAGE;\n+\n+\tname = argv[1];\n+\n+\tif (argc == 3)\n+\t\tvar = argv[2];\n+\n+\tif (net_lwip_eth_start() < 0)\n+\t\treturn CMD_RET_FAILURE;\n+\n+\treturn dns_loop(eth_get_dev(), name, var);\n+}\ndiff --git a/net/lwip/net-lwip.c b/net/lwip/net-lwip.c\nindex 3918d57d7e5..7069e56065f 100644\n--- a/net/lwip/net-lwip.c\n+++ b/net/lwip/net-lwip.c\n@@ -147,7 +147,7 @@ static int get_udev_ipv4_info(struct udevice *dev, ip4_addr_t *ip,\n  */\n int net_lwip_dns_init(void)\n {\n-#if CONFIG_IS_ENABLED(CMD_DNS)\n+#if CONFIG_IS_ENABLED(DNS)\n \tbool has_server = false;\n \tip_addr_t ns;\n \tchar *nsenv;\n@@ -369,7 +369,7 @@ int net_lwip_rx(struct udevice *udev, struct netif *netif)\n  */\n int net_lwip_dns_resolve(char *name_or_ip, ip_addr_t *ip)\n {\n-#if defined(CONFIG_CMD_DNS)\n+#if defined(CONFIG_DNS)\n \tchar *var = \"_dnsres\";\n \tchar *argv[] = { \"dns\", name_or_ip, var, NULL };\n \tint argc = ARRAY_SIZE(argv) - 1;\n@@ -378,7 +378,7 @@ int net_lwip_dns_resolve(char *name_or_ip, ip_addr_t *ip)\n \tif (ipaddr_aton(name_or_ip, ip))\n \t\treturn 0;\n \n-#if defined(CONFIG_CMD_DNS)\n+#if defined(CONFIG_DNS)\n \tif (do_dns(NULL, 0, argc, argv) != CMD_RET_SUCCESS)\n \t\treturn -1;\n \ndiff --git a/net/net.c b/net/net.c\nindex 5219367e391..382a27e0a77 100644\n--- a/net/net.c\n+++ b/net/net.c\n@@ -115,7 +115,7 @@\n #include \"bootp.h\"\n #include \"cdp.h\"\n #include \"dhcpv6.h\"\n-#if defined(CONFIG_CMD_DNS)\n+#if defined(CONFIG_DNS)\n #include \"dns.h\"\n #endif\n #include \"link_local.h\"\n@@ -288,7 +288,7 @@ static int on_vlan(const char *name, const char *value, enum env_op op,\n }\n U_BOOT_ENV_CALLBACK(vlan, on_vlan);\n \n-#if defined(CONFIG_CMD_DNS)\n+#if defined(CONFIG_DNS)\n static int on_dnsip(const char *name, const char *value, enum env_op op,\n \tint flags)\n {\n@@ -582,7 +582,7 @@ restart:\n \t\t\tnc_start();\n \t\t\tbreak;\n #endif\n-#if defined(CONFIG_CMD_DNS)\n+#if defined(CONFIG_DNS)\n \t\tcase DNS:\n \t\t\tdns_start();\n \t\t\tbreak;\n@@ -1507,7 +1507,7 @@ static int net_check_prereq(enum proto_t protocol)\n \t\t}\n \t\tgoto common;\n #endif\n-#if defined(CONFIG_CMD_DNS)\n+#if defined(CONFIG_DNS)\n \tcase DNS:\n \t\tif (net_dns_server.s_addr == 0) {\n \t\t\tputs(\"*** ERROR: DNS server address not given\\n\");\n@@ -1540,7 +1540,7 @@ static int net_check_prereq(enum proto_t protocol)\n \t\t\treturn 1;\n \t\t}\n #if\tdefined(CONFIG_CMD_PING) || \\\n-\tdefined(CONFIG_CMD_DNS) || defined(CONFIG_PROT_UDP)\n+\tdefined(CONFIG_DNS) || defined(CONFIG_PROT_UDP)\n common:\n #endif\n \t\t/* Fall through */\ndiff --git a/net/wget.c b/net/wget.c\nindex 3c0fff488eb..e65ce15ccb3 100644\n--- a/net/wget.c\n+++ b/net/wget.c\n@@ -393,7 +393,7 @@ int wget_do_request(ulong dst_addr, char *uri)\n \tif (string_to_ip(host_name).s_addr) {\n \t\ts = host_name;\n \t} else {\n-#if IS_ENABLED(CONFIG_CMD_DNS)\n+#if IS_ENABLED(CONFIG_DNS)\n \t\tnet_dns_resolve = host_name;\n \t\tnet_dns_env_var = \"httpserverip\";\n \t\tif (net_loop(DNS) < 0) {\n",
    "prefixes": []
}