Skip to content
Snippets Groups Projects
Commit 97186a9c authored by Dmitry Shmidt's avatar Dmitry Shmidt
Browse files

netcfg: Add MAC address to interface dump


Change-Id: I52b3336a66224c9ae19a4c80cc706890742d4130
Signed-off-by: default avatarDmitry Shmidt <dimitrysh@google.com>
parent 08cdb756
Branches
Tags
No related merge requests found
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <errno.h> #include <errno.h>
#include <dirent.h> #include <dirent.h>
#include <netinet/ether.h> #include <netinet/ether.h>
#include <netinet/if_ether.h>
#include <netutils/ifc.h> #include <netutils/ifc.h>
#include <netutils/dhcp.h> #include <netutils/dhcp.h>
...@@ -50,6 +51,7 @@ void usage(void) ...@@ -50,6 +51,7 @@ void usage(void)
int dump_interface(const char *name) int dump_interface(const char *name)
{ {
unsigned addr, mask, flags; unsigned addr, mask, flags;
unsigned char hwbuf[ETH_ALEN];
if(ifc_get_info(name, &addr, &mask, &flags)) { if(ifc_get_info(name, &addr, &mask, &flags)) {
return 0; return 0;
...@@ -58,7 +60,15 @@ int dump_interface(const char *name) ...@@ -58,7 +60,15 @@ int dump_interface(const char *name)
printf("%-8s %s ", name, flags & 1 ? "UP " : "DOWN"); printf("%-8s %s ", name, flags & 1 ? "UP " : "DOWN");
printf("%-16s", ipaddr(addr)); printf("%-16s", ipaddr(addr));
printf("%-16s", ipaddr(mask)); printf("%-16s", ipaddr(mask));
printf("0x%08x\n", flags); printf("0x%08x ", flags);
if (!ifc_get_hwaddr(name, hwbuf)) {
int i;
for(i=0; i < (ETH_ALEN-1); i++)
printf("%02x:", hwbuf[i]);
printf("%02x\n", hwbuf[i]);
} else {
printf("\n");
}
return 0; return 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment