Changeset View
Changeset View
Standalone View
Standalone View
sys/netgraph/ng_parse.c
Show First 20 Lines • Show All 954 Lines • ▼ Show 20 Lines | ng_ipaddr_parse(const struct ng_parse_type *type, | ||||
u_char *const buf, int *buflen) | u_char *const buf, int *buflen) | ||||
{ | { | ||||
int i, error; | int i, error; | ||||
for (i = 0; i < 4; i++) { | for (i = 0; i < 4; i++) { | ||||
if ((error = ng_int8_parse(&ng_parse_int8_type, | if ((error = ng_int8_parse(&ng_parse_int8_type, | ||||
s, off, start, buf + i, buflen)) != 0) | s, off, start, buf + i, buflen)) != 0) | ||||
return (error); | return (error); | ||||
if (i < 3 && s[*off] != '.') | if (i < 3) { | ||||
if (s[*off] != '.') | |||||
return (EINVAL); | return (EINVAL); | ||||
(*off)++; | (*off)++; | ||||
} | |||||
} | } | ||||
*buflen = 4; | *buflen = 4; | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
ng_ipaddr_unparse(const struct ng_parse_type *type, | ng_ipaddr_unparse(const struct ng_parse_type *type, | ||||
const u_char *data, int *off, char *cbuf, int cbuflen) | const u_char *data, int *off, char *cbuf, int cbuflen) | ||||
▲ Show 20 Lines • Show All 927 Lines • Show Last 20 Lines |