Changeset 3e6bca8 in mainline for uspace/app/inet/inet.c


Ignore:
Timestamp:
2021-08-08T17:30:29Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a7f7b9c3
Parents:
b4edc96
Message:

Represent Ethernet address as a number instead of an array

Carefully document the design since this breaks the principle of least
surprise. Also add unit tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/inet/inet.c

    rb4edc96 r3e6bca8  
    3737#include <errno.h>
    3838#include <inet/addr.h>
     39#include <inet/eth_addr.h>
    3940#include <inet/inetcfg.h>
    4041#include <io/table.h>
     
    340341        inet_link_info_t linfo;
    341342        table_t *table = NULL;
     343        eth_addr_str_t saddr;
    342344
    343345        size_t count;
     
    368370                }
    369371
    370                 table_printf(table, "%02x:%02x:%02x:%02x:%02x:%02x\t"
    371                     "%s\t" "%zu\n",
    372                     linfo.mac_addr.b[0], linfo.mac_addr.b[1],
    373                     linfo.mac_addr.b[2], linfo.mac_addr.b[3],
    374                     linfo.mac_addr.b[4], linfo.mac_addr.b[5],
    375                     linfo.name, linfo.def_mtu);
     372                eth_addr_format(&linfo.mac_addr, &saddr);
     373                table_printf(table, "%s\t %s\t %zu\n", saddr.str, linfo.name,
     374                    linfo.def_mtu);
    376375
    377376                free(linfo.name);
Note: See TracChangeset for help on using the changeset viewer.