aboutsummaryrefslogtreecommitdiff
path: root/networking/libiproute/ll_proto.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/libiproute/ll_proto.c')
-rw-r--r--networking/libiproute/ll_proto.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/networking/libiproute/ll_proto.c b/networking/libiproute/ll_proto.c
index b8268732e..a93493538 100644
--- a/networking/libiproute/ll_proto.c
+++ b/networking/libiproute/ll_proto.c
@@ -115,13 +115,15 @@ int ll_proto_a2n(unsigned short *id, char *buf)
unsigned i;
for (i = 0; i < ARRAY_SIZE(llproto_names); i++) {
if (strcasecmp(llproto_names[i].name, buf) == 0) {
- *id = htons(llproto_names[i].id);
- return 0;
+ i = llproto_names[i].id;
+ goto good;
}
}
- if (get_u16(id, buf, 0))
+ i = bb_strtou(buf, NULL, 0);
+ if (errno || i > 0xffff)
return -1;
- *id = htons(*id);
+ good:
+ *id = htons(i);
return 0;
}