version 1.5.4.1, 2011/10/14 07:28:16
|
version 1.5.4.2, 2011/10/14 07:39:47
|
Line 318 io_ether_ntoa(const struct io_ether_addr *n, char * __
|
Line 318 io_ether_ntoa(const struct io_ether_addr *n, char * __
|
|
|
return a; |
return a; |
} |
} |
|
|
|
/* |
|
* io_ether_aton() Convert string to ethernet address |
|
* @a = string |
|
* @e = ethernet address structure, like struct ether_addr |
|
* return: NULL error or !=NULL ethernet address structure |
|
*/ |
|
inline struct io_ether_addr * |
|
io_ether_aton(const char *a, struct io_ether_addr *e) |
|
{ |
|
int i; |
|
u_int o0, o1, o2, o3, o4, o5; |
|
|
|
if (!a || !e) |
|
return NULL; |
|
|
|
i = sscanf(a, "%x:%x:%x:%x:%x:%x", &o0, &o1, &o2, &o3, &o4, &o5); |
|
if (i != 6) |
|
return NULL; |
|
|
|
e->ether_addr_octet[0] = o0; |
|
e->ether_addr_octet[1] = o1; |
|
e->ether_addr_octet[2] = o2; |
|
e->ether_addr_octet[3] = o3; |
|
e->ether_addr_octet[4] = o4; |
|
e->ether_addr_octet[5] = o5; |
|
|
|
return e; |
|
} |