Deleted Added
full compact
40c40
< * $FreeBSD: head/sys/netgraph/ng_ether.c 121816 2003-10-31 18:32:15Z brooks $
---
> * $FreeBSD: head/sys/netgraph/ng_ether.c 123600 2003-12-17 12:40:34Z ru $
112,124d111
< /* Parse type for an Ethernet address */
< static ng_parse_t ng_enaddr_parse;
< static ng_unparse_t ng_enaddr_unparse;
< const struct ng_parse_type ng_ether_enaddr_type = {
< NULL,
< NULL,
< NULL,
< ng_enaddr_parse,
< ng_enaddr_unparse,
< NULL, /* no such thing as a "default" EN address */
< 0
< };
<
146c133
< &ng_ether_enaddr_type
---
> &ng_parse_enaddr_type
152c139
< &ng_ether_enaddr_type,
---
> &ng_parse_enaddr_type,
656,697d642
< static int
< ng_enaddr_parse(const struct ng_parse_type *type,
< const char *s, int *const off, const u_char *const start,
< u_char *const buf, int *const buflen)
< {
< char *eptr;
< u_long val;
< int i;
<
< if (*buflen < ETHER_ADDR_LEN)
< return (ERANGE);
< for (i = 0; i < ETHER_ADDR_LEN; i++) {
< val = strtoul(s + *off, &eptr, 16);
< if (val > 0xff || eptr == s + *off)
< return (EINVAL);
< buf[i] = (u_char)val;
< *off = (eptr - s);
< if (i < ETHER_ADDR_LEN - 1) {
< if (*eptr != ':')
< return (EINVAL);
< (*off)++;
< }
< }
< *buflen = ETHER_ADDR_LEN;
< return (0);
< }
<
< static int
< ng_enaddr_unparse(const struct ng_parse_type *type,
< const u_char *data, int *off, char *cbuf, int cbuflen)
< {
< int len;
<
< len = snprintf(cbuf, cbuflen, "%02x:%02x:%02x:%02x:%02x:%02x",
< data[*off], data[*off + 1], data[*off + 2],
< data[*off + 3], data[*off + 4], data[*off + 5]);
< if (len >= cbuflen)
< return (ERANGE);
< *off += ETHER_ADDR_LEN;
< return (0);
< }
<