--- libelwix/example/test_n2.c 2016/05/14 12:45:03 1.3.48.1 +++ libelwix/example/test_n2.c 2016/05/14 13:12:43 1.3.48.2 @@ -12,6 +12,8 @@ main(int argc, char **argv) struct in_addr a; netaddr_t n, *n0; inaddr_t t; + ether_addr_t ea; + char str[BUFSIZ]; a.s_addr = E_CIDRMASK(8); printf("/8 = %08X %08x\n", a.s_addr, htonl(a.s_addr)); @@ -74,7 +76,16 @@ main(int argc, char **argv) } printf("Address is %s port is %u\n", AIT_GET_STR(&v), e_n2port(&addr)); - AIT_FREE_VAL(&v); + + if (argc < 3) + return 0; + + val = ait_allocVar(); + AIT_SET_STR(val, argv[2]); + if (!e_ether_addr(AIT_GET_STR(val), &ea)) + printf("MAC address of iface=%s is %s\n", AIT_GET_STR(val), e_ether_ntoa(&ea, str, sizeof str)); + ait_freeVar(&val); + return 0; }