The Wayback Machine - https://web.archive.org/web/20201225235427/https://github.com/u-root/u-root/issues/1369
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ip route show: show pretty routes #1369

Open
hugelgupf opened this issue Sep 20, 2019 · 22 comments
Open

ip route show: show pretty routes #1369

hugelgupf opened this issue Sep 20, 2019 · 22 comments

Comments

@hugelgupf
Copy link
Member

@hugelgupf hugelgupf commented Sep 20, 2019

It's a bit of a pain to have to interpret these yourself:

ip: Iface       Destination     Gateway         Flags   RefCnt  Use     Metric  Mask            MTU     Window  IRTT                    
eth0    00000000        0100A8C0        0003    0       0       0       00000000        0       0       0
eth0    0000A8C0        00000000        0001    0       0       0       00FFFFFF        0       0       0            
eth0    0100A8C0        00000000        0005    0       0       0       FFFFFFFF        0       0       0

versus on real system:

default via 100.97.23.254 dev enp0s31f6 proto dhcp metric 100 
100.97.22.0/23 dev enp0s31f6 proto kernel scope link src 100.97.22.161 metric 100 
192.168.9.0/24 dev docker0 proto kernel scope link src 192.168.9.1 linkdown 

we can do something inbetween. at least display the IPs correctly, and decipher the flags.

@10000TB
Copy link
Contributor

@10000TB 10000TB commented Sep 26, 2019

seems like a change around fmt printing ?

@hugelgupf
Copy link
Member Author

@hugelgupf hugelgupf commented Sep 26, 2019

Pretty much, except we don't even parse the info in the first place:

b, err := ioutil.ReadFile(path)
@10000TB
Copy link
Contributor

@10000TB 10000TB commented Sep 26, 2019

I'd be interested in taking this for fun ... seems a good start for newbie

/assign xuehaohu ?

@insomniacslk
Copy link
Contributor

@insomniacslk insomniacslk commented Sep 29, 2019

we have some working code for this, will ask my colleague to clean it up. IIRC Marcello also had some code for this, I'll ping him on Slack so we don't duplicate work

@insomniacslk
Copy link
Contributor

@insomniacslk insomniacslk commented Sep 29, 2019

as an additional note, we are moving away from vishvananda/netlink in favour of jsimonetti/rtnetlink/rtnl (safer, smaller)

@sylv-io
Copy link
Contributor

@sylv-io sylv-io commented Sep 29, 2019

yeah i already started to work on it. #1354
But as @insomniacslk mentioned, we want to move to jsimonetti/rtnetlink/rtnl.
Right not it does not support all necessary attributes. So we need to work on it first.

There will be a WIP PR soon with the current progress 👍

@hugelgupf
Copy link
Member Author

@hugelgupf hugelgupf commented Sep 29, 2019

Make it two PRs. Showing the route has nothing to do with changing the netlink lib.

@insomniacslk
Copy link
Contributor

@insomniacslk insomniacslk commented Sep 29, 2019

I need this for a demo next week, and my colleague's work is only for IPv6 routes, so I went ahead and created #1379 . However this is based on /proc/net/route like the original code, which does not provide as much information as rtnetlink. A better PR can come later

@insomniacslk
Copy link
Contributor

@insomniacslk insomniacslk commented Sep 29, 2019

@insomniacslk
Copy link
Contributor

@insomniacslk insomniacslk commented Sep 29, 2019

I didn't reload the browser and didn't see @hugelgupf 's and @sylvblck 's replies until now. How about #1379 as a stop-gap until @sylvblck 's change is completed?

@insomniacslk
Copy link
Contributor

@insomniacslk insomniacslk commented Sep 29, 2019

a quick chat with @sylvblck and looked at #1354 and my PR doesn't make sense anymore :) I'll close my PR in favour of reopening #1354

@sylv-io
Copy link
Contributor

@sylv-io sylv-io commented Sep 29, 2019

I rebased and reopened #1354 👍 it's working fine on my test setup

@10000TB
Copy link
Contributor

@10000TB 10000TB commented Oct 1, 2019

@sylvblck mind sharing some local test setup ? - I can pick up the ipv6 implementation since it is related to my current work

@hugelgupf
Copy link
Member Author

@hugelgupf hugelgupf commented Oct 1, 2019

I think the local test setup is... run it on your friendly local Linux machine (e.g. run it on your workstation and compare to system's ip route show...)

for the moment.

@10000TB
Copy link
Contributor

@10000TB 10000TB commented Oct 1, 2019

ah.. ok! - ideally we like them be the same right ? at least the values if not the printing format

@sylv-io
Copy link
Contributor

@sylv-io sylv-io commented Oct 1, 2019

@10000TB I'm using libvirt with direct kernel boot for each vm.
In this way it is possible to define host and network per xml file with virt-manager or by hand (for the specific use-case) and interact by using virtsh. Still not done with the setup but it may be worth for a blog post 😄

@10000TB
Copy link
Contributor

@10000TB 10000TB commented Oct 2, 2019

i ill be interested in checkout out the post to come

not familiar with the libvirt - but sounds like you are starting vms per configs, and run ip cmd within vms to verify if they match what is in configs

if setup is checked in repo, it would be super helpful

@10000TB
Copy link
Contributor

@10000TB 10000TB commented Oct 2, 2019

Trying to find inspiration for ipv6 implementation, so far I found this https://github.com/shemminger/iproute2/blob/master/ip/iproute.c#L1691 - still reading and digesting

but meanwhile want to post it here and see if more experienced people have any other suggestion

@hugelgupf
Copy link
Member Author

@hugelgupf hugelgupf commented Oct 3, 2019

Actually, I think @sylvblck's patchset is probably better inspiration for v6 than the C code: you should be able to call netlink.RouteList with family FAMILY_V6. Probably an easier thread to pull on than that C code.

@sylv-io
Copy link
Contributor

@sylv-io sylv-io commented Oct 3, 2019

btw @10000TB I wrote basic support to show IPv6 routes on my PR #1354, but there are still a lot of work to do. ( e.g. a better approach to format a route entry, add IPv6 route preference -> pref, entries where you add mtu ...)

@10000TB
Copy link
Contributor

@10000TB 10000TB commented Oct 18, 2019

noted

@10000TB
Copy link
Contributor

@10000TB 10000TB commented Feb 14, 2020

being dead on this for so long, trying to recollect and pick up original promises as I am coming back to work on network boot stuff ...

Fair to close this issue ? per #1354

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.