[Toybox] [PATCH] route: support iface names > 9 char
David R. Hedges
david at thelittleman.net
Fri Sep 30 14:54:32 PDT 2016
The interface name listed by /proc/net/ipv6_route is a char
buf[IFNAMSIZ], which can be longer than 10.
Change our iface buffer to that same length, and fscanf a maximum string
of that many characters (including \0).
Also, try to more gracefully handle unexpectedly long lines from
/proc/net/ipv6_route in fscanf by matching (but not assigning) any
trailing characters before the newline, otherwise they're the starting
point for the next iteration.
Here's an ipv6_route test case that demonstrated the problem:
260777000000001f000000013f8384c0 80 00000000000000000000000000000000 00
fe800000000000006512d4c76293bf99 00000000 00000001 00000005 01050003
rmnet_data0
260777000000001f00000001d1be6a0a 80 00000000000000000000000000000000 00
fe800000000000006512d4c76293bf99 00000000 00000002 0000018d 01050003
rmnet_data0
260777000000001f00000001d83ac0c2 80 00000000000000000000000000000000 00
fe800000000000006512d4c76293bf99 00000000 00000001 00000002 01050003
rmnet_data0
toys/pending/route.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-route-support-iface-names-9-char.patch
Type: text/x-patch
Size: 2353 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20160930/0f3098b7/attachment.bin>
More information about the Toybox
mailing list