1 /* vi: set sw=4 ts=4: */
5 //kbuild:lib-$(CONFIG_ARP) += in_ether.o
6 //kbuild:lib-$(CONFIG_IFCONFIG) += in_ether.o
7 //kbuild:lib-$(CONFIG_IFENSLAVE) += in_ether.o
10 #include <net/if_arp.h>
11 #include <net/ethernet.h>
13 /* Convert Ethernet address from "XX[:]XX[:]XX[:]XX[:]XX[:]XX" to sockaddr.
14 * Return nonzero on error.
16 int FAST_FUNC in_ether(const char *bufp, struct sockaddr *sap)
23 sap->sa_family = ARPHRD_ETHER;
24 ptr = (char *) sap->sa_data;
29 /* We might get a semicolon here */
36 if (((unsigned char)(c - '0')) <= 9) {
38 } else if ((unsigned char)((c|0x20) - 'a') <= 5) {
39 c = (unsigned char)((c|0x20) - 'a') + 10;
41 if (j && (c == ':' || c == '\0'))
42 /* One-digit byte: __:X:__ */
55 /* Error if we aren't at end of string */