diff options
Diffstat (limited to 'networking/libiproute/ll_proto.c')
-rw-r--r-- | networking/libiproute/ll_proto.c | 10 |
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) | |||
115 | unsigned i; | 115 | unsigned i; |
116 | for (i = 0; i < ARRAY_SIZE(llproto_names); i++) { | 116 | for (i = 0; i < ARRAY_SIZE(llproto_names); i++) { |
117 | if (strcasecmp(llproto_names[i].name, buf) == 0) { | 117 | if (strcasecmp(llproto_names[i].name, buf) == 0) { |
118 | *id = htons(llproto_names[i].id); | 118 | i = llproto_names[i].id; |
119 | return 0; | 119 | goto good; |
120 | } | 120 | } |
121 | } | 121 | } |
122 | if (get_u16(id, buf, 0)) | 122 | i = bb_strtou(buf, NULL, 0); |
123 | if (errno || i > 0xffff) | ||
123 | return -1; | 124 | return -1; |
124 | *id = htons(*id); | 125 | good: |
126 | *id = htons(i); | ||
125 | return 0; | 127 | return 0; |
126 | } | 128 | } |
127 | 129 | ||