]> xenbits.xensource.com Git - unikraft/libs/lwip.git/commitdiff
Print network device hardware address
authorSimon Kuenzer <simon.kuenzer@neclab.eu>
Tue, 12 Oct 2021 15:22:01 +0000 (17:22 +0200)
committerUnikraft <monkey@unikraft.io>
Mon, 28 Mar 2022 18:33:46 +0000 (18:33 +0000)
During network device initialization, print the hardware
address of the network device to the info kernel console.
This should simplify first-level of diagnosis.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Approved-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #10

init.c

diff --git a/init.c b/init.c
index 584c0a545cac606b26dee2a8c8a7f25964456448..3e054d4a7760ddc00c044db6c6eb93116892c57b 100644 (file)
--- a/init.c
+++ b/init.c
@@ -253,6 +253,14 @@ no_conf:
                        continue;
                }
 
+               /* Print hardware address */
+               if (nf->hwaddr_len == 6) {
+                       uk_pr_info("%c%c%u: Hardware address: %02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8"\n",
+                                  nf->name[0], nf->name[1], nf->num,
+                                  nf->hwaddr[0], nf->hwaddr[1], nf->hwaddr[2],
+                                  nf->hwaddr[3], nf->hwaddr[4], nf->hwaddr[5]);
+               }
+
                /* Declare the first network device as default interface */
                if (is_first_nf) {
                        uk_pr_info("%c%c%u: Set as default interface\n",