Page MenuHomeFreeBSD

Simplify address parsing in DDB show route command.
ClosedPublic

Authored by melifaro on May 2 2020, 8:59 AM.
Tags
None
Referenced Files
F82186121: D24662.id71270.diff
Fri, Apr 26, 6:43 AM
F82151752: D24662.id71368.diff
Thu, Apr 25, 11:53 PM
F82151747: D24662.id.diff
Thu, Apr 25, 11:53 PM
Unknown Object (File)
Thu, Apr 25, 1:55 PM
Unknown Object (File)
Thu, Apr 25, 6:09 AM
Unknown Object (File)
Jan 17 2024, 7:20 PM
Unknown Object (File)
Dec 20 2023, 8:03 AM
Unknown Object (File)
Dec 12 2023, 2:58 AM
Subscribers

Details

Summary

Use db_get_line() to overcome parser limitation.

Test Plan
show route
Usage: 'show route <address>'
Currently accepts only IPv4 and IPv6 addresses
db> show route 1.1.1.1
Looking up route to destination '1.1.1.1'
dst <0.0.0.0> gateway <172.16.107.2> netmask <0.0.0.0> ifp <on link> ifa <172.16.107.128> flags UP,GATEWAY, STATIC
db> show route 172.16.167.3
Looking up route to destination '172.16.187.3'
dst <172.16.107.6> gateway <on link> netmask <255.255.255.0> ifp <on link> ifa <1?2.16.107.128> flags UP,PINNED
db> show route ::
Looking up route to destination '::'
dst <::> gateway <::1> netmask <ffff:ffff:ffff :ffff:ffff :ffff::> ifp <on link> ifa <::1> flags UP,GATEWAY,REJECT, STATIC
show route 1::1
Looking up route to destination '1::1'
dst <::> gateway <fe86:3: :925c:44ff:fe5b:1c5b> netmask <::> ifp <on link> ifa <fe8@:3: :26c:29ff :fed4b:dbb0> flags UP,GATEWAY
show route qqq
Usage: 'show route <address>’
Currently accepts only IPv4 and IPv6 addresses
db> show route a
Usage: ‘show route <address>’
Currently accepts only IPv4 and IPv6 addresses
db> show route a::
Looking up route to destination 'a::'
dst <::> gateway <fe86:3: :925c:44ff:fe5b:1c5b> netmask <::> ifp <on link> ifa <fe80:3: :26c:29ff :fed4b:dbb0> flags UP,GATEWAY
db>

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

donner added inline comments.
sys/net/route/route_ddb.c
241–242 ↗(On Diff #71270)

This is only for printing a canonized address?

sys/net/route/route_ddb.c
241–242 ↗(On Diff #71270)

Yes.

donner added inline comments.
sys/net/route/route_ddb.c
222–225 ↗(On Diff #71270)

You are not handling all types of whitespace (i.e. \t); is inet_pton able to ignore this itself?

This revision is now accepted and ready to land.May 3 2020, 12:45 AM
sys/net/route/route_ddb.c
222–225 ↗(On Diff #71270)

No, inet_pton doesn't handle it. I've updated the implementation to use isspace(), though I'm not sure if '\t' is even supported by our debugger.