diff options
author | Michal Simek <michal.simek@amd.com> | 2025-07-29 09:12:54 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-08-04 18:23:16 -0600 |
commit | fcac9bfbbd20216ecf6a79c2fa239bda1bff77ef (patch) | |
tree | 4bfaec42201f8bbe4514b8cee56c4f76a9833c95 /cmd | |
parent | c03d7a48018c8caefefc9b2cbd46f393798eece3 (diff) |
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 <michal.simek@amd.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/bdinfo.c | 7 |
1 files changed, 6 insertions, 1 deletions
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) |