-
Notifications
You must be signed in to change notification settings - Fork 26
Query routes via routesocket #57
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
Query routes via routesocket #57
Conversation
A newer version of x/net required to appropriately query route socket.
53db2cc to
0d3e888
Compare
|
This does look generally nicer / less invasive than the current strategy, thanks for the PR. |
0d3e888 to
49c4ec3
Compare
14f17cc to
91007f0
Compare
Mimic what `route get` does, instead of dumping the routing table and trying to determine the most specific route from the dump.
91007f0 to
02cbb33
Compare
a8f7214 to
9369077
Compare
x/net module requires [email protected]: >go mod tidy -go=1.23 >go: golang.org/x/[email protected] requires [email protected], but 1.23 is requested
9369077 to
b875106
Compare
|
@willscott any chance you can re-review |
|
Thanks for the comments, @djdv ! |
|
Thank you for the review. I will review the comments and update
accordingly.
…On Wed, Apr 2, 2025 at 5:06 PM Will ***@***.***> wrote:
Thanks for the comments, @djdv <https://github.com/djdv> !
—
Reply to this email directly, view it on GitHub
<#57 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABMJBTO3FBQ5S56XLEHKSKD2XRUPNAVCNFSM6AAAAABZQGL5VGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONZTHEZDEMBXGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
[image: willscott]*willscott* left a comment (libp2p/go-netroute#57)
<#57 (comment)>
Thanks for the comments, @djdv <https://github.com/djdv> !
—
Reply to this email directly, view it on GitHub
<#57 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABMJBTO3FBQ5S56XLEHKSKD2XRUPNAVCNFSM6AAAAABZQGL5VGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONZTHEZDEMBXGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
You're welcome. :^] I was planning to look at this for real either Friday or Saturday (if I have free time). I'm assuming some of this code is based around my original PR I'm tagged in, but just to be clear, I wanted to say explicitly that I have no official involvement with this project. So take my review remarks lightly. |
Actually the code came about because this library was used in netbird, I only noticed your PR after I had submitted mine. Upon which point I did take some inspiration for dealing with the possibility of indefinite read loops, so thank you for that. Prior to that I was developing similar applications to troubleshoot and fix some bugs in the x/net package. |
This refactor tries to employ the single responsibility principal more effectively. Certain large functions were broken down to smaller more manageable scopes. Additionally, unix error messages that are applicable for our scenario have been annotated.
f691123 to
c1f0108
Compare
Please enter the commit message for your changes. Lines starting
Co-authored-by: djdv <[email protected]>
…to query_routes_via_routesocket * origin/query_routes_via_routesocket: Update netroute_bsd.go
djdv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for a different OS than I use, so I could not test executing it, but I did read netroute_bsd.go and it uses the same routing protocol.
The code is very nice and makes sense to me. 👍
Only some minor/negligible remarks.
Ahh, makes sense. The code looked familiar while I was reading it, and we're both targeting similar APIs after all. Related to |
I wonder if you vendor and enable the build for illumos if it would work, the route socket doesn't change much from one unix os to another: |
|
@willscott any further thought to this PR? |
I'm sure something can be done to make it work on Solaris/Illumos, however- |
|
Sorry for my slow response, and sorry to hear that @djdv ! I do wonder if the route socket method here also is worth using in the linux case - it seems like it should work as well there as in BSD-derived cases? I think i'm okay with merging this and doing the linux part in a followup, but will ideally wait on a next release until both are in the same place. I'm optimistic that the linux one can directly use this implementation even. |
|
Let's do the linux in a follow up, it will be some work because Linux has moved the routing IPC to netlink socket, but it should be doable: |
On Unix systems, this module currently dumps and caches the complete routing table. Afterwards, when a user submits a query to a specific destination it walks the table looking for the most applicable route found in the cache.
If you compare this functionality to
route getit is good, but not exact. Would it not be better to do almost exactly whatroute getdoes?This patch is an attempt at just that. If uses the AF_ROUTE socket to formalate route get messages and parses the output. Until recently this would not have been possible due to bugs in the x/net/route package. I have fixed said bugs, so this approach is very feasible.
closes #56