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

net/netutil: add function to check rp_filter value #5703

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

andrew-d
Copy link
Member

@andrew-d andrew-d commented Sep 20, 2022

Updates #4432

Signed-off-by: Andrew Dunham andrew@du.nham.ca
Change-Id: Ifc332a5747fc1feffdbb87437308cf8ecb21b0b0

@andrew-d
Copy link
Member Author

This is what it looks like on my local machine:

$ sudo curl -fsS --unix-socket /tmp/tailscaled.usermode.sock http://localhost/localapi/v0/check-ip-forwarding | jq -r .Warning
IPv6 forwarding is disabled.
Subnet routes and exit nodes may not work correctly.
See https://tailscale.com/kb/1104/enable-ip-forwarding/
Interface docker0 has strict reverse-path filtering enabled
Subnet routes and exit nodes may not work correctly.

@andrew-d
Copy link
Member Author

I'm no expert on this, but I think this may not be sufficient; we may want to actually run this on all calls to tailscale up, not just when we're advertising an exit node (which is when we currently check IP forwarding). Thoughts? I can pull this out into a new local endpoint without too much difficulty, if so?

Copy link
Member

@danderson danderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got an example of a network setup where RPF breaks exit nodes? It's one of the few configurations I can think of where RPF strictness shouldn't matter.

net/netutil/ip_forward.go Outdated Show resolved Hide resolved
@andrew-d
Copy link
Member Author

@danderson - I think this is me being bad at reading comprehension; strict rp_filter breaks clients, not exit nodes. Pushed a change to have this run on all calls to tailscale up instead; thoughts?

Copy link
Contributor

@ramyfication ramyfication left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cc'ing me on this PR. I'm not familiar enough with this to give a proper review, but I've left some minor comments.

net/netutil/ip_forward.go Outdated Show resolved Hide resolved
net/netutil/ip_forward.go Outdated Show resolved Hide resolved
ipn/localapi/localapi.go Outdated Show resolved Hide resolved
net/netutil/ip_forward.go Show resolved Hide resolved
@ncfavier
Copy link

ncfavier commented Oct 14, 2022

This would also need to check for an iptables or nftables rule invoking the rpfilter netfilter module; AFAICT the rp_filter sysctl is deprecated.

There is hope of fixing the underlying problem so that we don't need a warning though, see discussions in #3310 (comment) and #4432.

@andrew-d andrew-d changed the title ipn/ipnlocal: show warnings about reverse path filtering net/netutil: add function to check rp_filter value Dec 19, 2023
@andrew-d
Copy link
Member Author

Force-pushed over this to just implement the "check for rp_filter" functionality, and will defer using it to another PR.

@andrew-d andrew-d requested review from knyar and removed request for danderson and JayWStapleton December 19, 2023 22:36
Updates #4432

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: Ifc332a5747fc1feffdbb87437308cf8ecb21b0b0
@andrew-d andrew-d merged commit 09136e5 into main Dec 20, 2023
46 checks passed
@andrew-d andrew-d deleted the andrew/rp-filter-check branch December 20, 2023 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants