#include #include static struct ether_addr a; struct ether_addr *ether_aton_r (const char *x, struct ether_addr *p_a) { for (int ii = 0; ii < 6; ii++) { unsigned long int n; if (ii != 0) { if (x[0] != ':') return 0; /* bad format */ else x++; } n = strtoul (x, &x, 16); if (n > 0xFF) return 0; /* bad byte */ (*p_a).ether_addr_octet[ii] = n; } if (x[0] != 0) return 0; /* bad format */ return p_a; } struct ether_addr *ether_aton (const char *x) { return ether_aton_r (x, &a); }