[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[openbsd] про libnet



Hello Openbsd,

  Мак в проге выдираеться вот таким способом

  #include <libnet.h>

int main(int argc, char *argv[]) {
    libnet_t *ln;
    struct ether_addr *ha = NULL;
    char ebuf[LIBNET_ERRBUF_SIZE] = "\0";

    if (!(ln = libnet_init(LIBNET_LINK_ADV, argv[1], ebuf))) {
        fprintf(stderr, "%s", ebuf);
        exit(EXIT_FAILURE);
    }

    if ((ha = (struct ether_addr *) libnet_get_hwaddr(ln)) == NULL) {
        fprintf(stderr, "%s", libnet_geterror(ln));
        exit(EXIT_FAILURE);
    }

    printf("hwaddr: %s\n", ether_ntoa(ha));

    libnet_destroy(ln);

    return 0;
}

 Но показывает какую-то фигню вместо мака интерфейса
 например вот это ca:0a:00:00:00:00

 Как нужно изменить конструкцю чтобы показывало нормальный мак
интерфейса 
-- 
Best regards,
 irix                          mailto:irix@ukr.net


-- 
To unsubscribe send a mail to openbsd+unsubscribe@uaoug.org.ua
For retrieval all messages in the archive go to http://www.uaoug.org.ua/archive/