]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
cmd: bdinfo: Fix showing correct IP address based on current device
authorMichal Simek <michal.simek@amd.com>
Tue, 29 Jul 2025 07:12:54 +0000 (09:12 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 5 Aug 2025 00:23:16 +0000 (18:23 -0600)
Use the same logic as is used for MAC address where bdi shows mac address
for current device where index (idx) is used to point to correct IP address
which is read and show.

Signed-off-by: Michal Simek <michal.simek@amd.com>
cmd/bdinfo.c

index ae9e1923eacff41a35be9164cbbc5bedf30a07af..20c8c97f0cd1e5f8f18af03e9ad1a199d3e92f4b 100644 (file)
@@ -46,6 +46,7 @@ void bdinfo_print_num_ll(const char *name, unsigned long long value)
 static void print_eth(void)
 {
        const int idx = eth_get_dev_index();
+       char ipstr[] = "ipaddr\0\0";
        uchar enetaddr[6];
        char name[10];
        int ret;
@@ -62,7 +63,11 @@ static void print_eth(void)
                printf("%-12s= (not set)\n", name);
        else
                printf("%-12s= %pM\n", name, enetaddr);
-       printf("IP addr     = %s\n", env_get("ipaddr"));
+
+       if (idx > 0)
+               sprintf(ipstr, "ipaddr%d", idx);
+
+       printf("IP addr     = %s\n", env_get(ipstr));
 }
 
 void bdinfo_print_mhz(const char *name, unsigned long hz)