From fcac9bfbbd20216ecf6a79c2fa239bda1bff77ef Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Tue, 29 Jul 2025 09:12:54 +0200 Subject: [PATCH] cmd: bdinfo: Fix showing correct IP address based on current device 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 --- cmd/bdinfo.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index ae9e1923eac..20c8c97f0cd 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -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) -- 2.47.2