Page MenuHomeFreeBSD

ddb(4): Add 'show route <dest>' and 'show routetable [<af>]'
ClosedPublic

Authored by cem on Sep 3 2019, 5:32 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 29, 4:59 PM
Unknown Object (File)
Feb 23 2024, 9:10 AM
Unknown Object (File)
Jan 23 2024, 2:47 PM
Unknown Object (File)
Jan 17 2024, 11:08 AM
Unknown Object (File)
Jan 10 2024, 9:35 AM
Unknown Object (File)
Dec 24 2023, 7:14 PM
Unknown Object (File)
Dec 17 2023, 4:48 PM
Unknown Object (File)
Dec 12 2023, 12:37 AM
Subscribers

Details

Summary

These commands show the route resolved for a specified destination, or
print out the entire routing table for a given address family (or all
families, if none is explicitly provided).

Test Plan
db> show route 192.168.0.SSS
Looking up route to destination '192.168.0.SSS'
dst <192.168.0.0> gateway <on link> netmask <255.255.255.0> ifp <on link> ifa <192.168.0.CCC> flags UP,PINNED
db> show route 8.8.8.8
Looking up route to destination '8.8.8.8'
dst <0.0.0.0> gateway <192.168.0.GGG> netmask <0.0.0.0> ifp <on link> ifa <192.168.0.CCC> flags UP,GATEWAY,STATIC

db> show route fe80::2
Looking up route to destination 'fe80::2'
dst <fe80::> gateway <::1> netmask <ffc0::> ifp <on link> ifa <::1> flags UP,GATEWAY,REJECT,STATIC
db> show route ::1
Looking up route to destination '::1'
dst <::1> gateway <on link> netmask <NULL> ifp <on link> ifa <::1> flags UP,HOST,PINNED,LOCAL


db> show routetable
Route table for AF 2 (INET):
dst <0.0.0.0> gateway <192.168.0.GGG> netmask <0.0.0.0> ifp <on link> ifa <192.168.0.CCC> flags UP,GATEWAY,STATIC
dst <127.0.0.1> gateway <on link> netmask <NULL> ifp <on link> ifa <127.0.0.1> flags UP,HOST,PINNED,LOCAL
dst <192.168.0.0> gateway <on link> netmask <255.255.255.0> ifp <on link> ifa <192.168.0.CCC> flags UP,PINNED
dst <192.168.0.CCC> gateway <on link> netmask <NULL> ifp <on link> ifa <127.0.0.1> flags UP,HOST,STATIC,PINNED

Route table for AF 28 (INET6):
dst <::> gateway <::1> netmask <ffff:ffff:ffff:ffff:ffff:ffff::> ifp <on link> ifa <::1> flags UP,GATEWAY,REJECT,STATIC
dst <::1> gateway <on link> netmask <NULL> ifp <on link> ifa <::1> flags UP,HOST,PINNED,LOCAL
dst <::ffff:0.0.0.0> gateway <::1> netmask <ffff:ffff:ffff:ffff:ffff:ffff::> ifp <on link> ifa <::1> flags UP,GATEWAY,REJECT,STATIC
dst <fe80::> gateway <::1> netmask <ffc0::> ifp <on link> ifa <::1> flags UP,GATEWAY,REJECT,STATIC
dst <fe80:2::> gateway <on link> netmask <ffff:ffff:ffff:ffff::> ifp <on link> ifa <fe80:2::1> flags UP
dst <fe80:2::1> gateway <on link> netmask <NULL> ifp <on link> ifa <fe80:2::1> flags UP,HOST,STATIC,PINNED,LOCAL
dst <ff02::> gateway <::1> netmask <ffff::> ifp <on link> ifa <::1> flags UP,GATEWAY,REJECT,STATIC,MULTICAST


db> show routetable 2
Route table for AF 2 (INET):
dst <0.0.0.0> gateway <192.168.0.GGG> netmask <0.0.0.0> ifp <on link> ifa <192.168.0.CCC> flags UP,GATEWAY,STATIC
dst <127.0.0.1> gateway <on link> netmask <NULL> ifp <on link> ifa <127.0.0.1> flags UP,HOST,PINNED,LOCAL
dst <192.168.0.0> gateway <on link> netmask <255.255.255.0> ifp <on link> ifa <192.168.0.CCC> flags UP,PINNED
dst <192.168.0.CCC> gateway <on link> netmask <NULL> ifp <on link> ifa <127.0.0.1> flags UP,HOST,STATIC,PINNED

Diff Detail

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

Event Timeline

Rebase on lexer changes.

Any objection in principle? Planning to review or ENOTIME? Suggestions for reviewers with free time and interest in this layer of the network stack?

In D21510#470181, @cem wrote:

Any objection in principle? Planning to review or ENOTIME? Suggestions for reviewers with free time and interest in this layer of the network stack?

I have no objection. I plan to review the pending diffs in the next day or so, but am swamped this week and not particularly qualified to review this particular one, so please don't wait on me if you're in a hurry.

I have no objection. I plan to review the pending diffs in the next day or so, but am swamped this week and not particularly qualified to review this particular one, so please don't wait on me if you're in a hurry.

Thanks. Yeah, I figure this one is fairly unobjectionable and low impact; I'd rather than your limited eyeball time on netgdb, when I can get it.

Overall LGTM

sys/net/rtsock.c
2068 ↗(On Diff #61634)

this seems a little odd/hackish to me, but not sure how better to represent this (omitting gateway for local, or something else)

sys/net/rtsock.c
2068 ↗(On Diff #61634)

Sure. It seemed clearest to me to always print something for gateway, and this is reasonable for that column in this scenario. It might be nicer to look up the specific interface represented by the AF_LINK sockaddr, but that was more complicated and this met my needs for debugging debugnet.

This revision was not accepted when it landed; it landed in state Needs Review.Sep 9 2019, 10:54 PM
This revision was automatically updated to reflect the committed changes.