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
Unknown Object (File)
Thu, Nov 7, 5:04 PM
Unknown Object (File)
Oct 4 2024, 4:18 AM
Unknown Object (File)
Sep 22 2024, 9:21 AM
Unknown Object (File)
Sep 21 2024, 12:30 PM
Unknown Object (File)
Sep 7 2024, 12:55 PM
Unknown Object (File)
Sep 4 2024, 2:04 PM
Unknown Object (File)
Aug 18 2024, 3:24 PM
Unknown Object (File)
Aug 16 2024, 9:27 PM
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.