-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
usbip: fix default snippetIpAddress command #522
base: main
Are you sure you want to change the base?
usbip: fix default snippetIpAddress command #522
Conversation
Seems it is still brittle when connected to VPN with multiple routes or any other case where you have multiple routes. This solves it for me: "$(ip route list | sed -nE 's/(default)? via (.*) dev .*/\\2/p' | head -n1)"; |
Networking mode NAT
Networking mode mirrored
Networking mode mirrored + wslvpnkit
|
Is there any reason not to always grab the default route? |
ec9a1aa
to
5fdf3c2
Compare
modules/usbip.nix
Outdated
@@ -21,7 +21,7 @@ in | |||
|
|||
snippetIpAddress = lib.mkOption { | |||
type = lib.types.str; | |||
default = "$(ip route list | sed -nE 's/(default)? via (.*) dev eth0 proto kernel/\2/p')"; | |||
default = "$(ip route list | sed -nE 's/(default)? via (.*) dev .*/\\2/p' | head -n1)"; |
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.
I think we want to keep the eth0 and so on and just add the wildcard after it
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.
What about the head -n1
, otherwise you risk getting multiple matches, which won't work
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.
Any reason to keep it at eth0 by the way? If not wsl-vpnkit would work out of the box.
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.
@SuperSandro2000 Pinging in case you didn't see my follow-up questions.
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.
What about the
head -n1
, otherwise you risk getting multiple matches, which won't work
yeah, lets add that.
Any reason to keep it at eth0 by the way? If not wsl-vpnkit would work out of the box.
Thats the default interface WSL uses.
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.
@SuperSandro2000 I adjusted it per your request. I am still not sure what the drawback is to not specify eth0 as it will work in all the cases (both when on eth0 or when using wsl-vpnkit which is not using eth0). Instead of when you do specify it, those users won't have it working out of the box, but will have to adjust this configuration (which is not a big deal, but still).
The nix string escaping was wrong so the `\` got lost. I also discovered that this fails if having multiple routes. This should make it more robust and default to the first match (which is usually the default route).
5fdf3c2
to
5d68316
Compare
This fixes some bugs that I discovered in the default command.
The nix string escaping was wrong so the
\
got lost and when I tested this the command had a trailing space that made it fail still.Also this didn't work when I was using network-mode mirrored since it includes metric in the output:
This also adds a target so you can batch restart the services. This is handy when having multiple YubiKeys and or switching between VPN. Perhaps there could even be some auto-restart thing. Will have to think about if that is a hack or not.