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

rule: Rule.Type to allow adding/listing unreachable (RTN_UNREACHABLE)… #1006

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

oxtoacart
Copy link
Contributor

… rules

Updates #710

oxtoacart added a commit to tailscale/netlink that referenced this pull request Aug 22, 2024
This allows Tailscale to use this module while we wait for upstream PR to be merged.
See vishvananda#1006

Updates vishvananda#710

Signed-off-by: Percy Wegmann <percy@tailscale.com>
oxtoacart added a commit to tailscale/netlink that referenced this pull request Aug 22, 2024
This allows Tailscale to use this module while we wait for upstream PR to be merged.
See vishvananda#1006

Updates tailscale/tailscale#12298

Signed-off-by: Percy Wegmann <percy@tailscale.com>
oxtoacart added a commit to tailscale/tailscale that referenced this pull request Aug 22, 2024
…equire vishvananda/netlink

After the upstream PR is merged, we can point directly at github.com/vishvananda/netlink
and retire github.com/tailscale/netlink.

See vishvananda/netlink#1006

Updates #12298

Signed-off-by: Percy Wegmann <percy@tailscale.com>
@oxtoacart oxtoacart force-pushed the percy/issue12298 branch 2 times, most recently from 6ccfaba to 07d06f6 Compare August 22, 2024 19:48
oxtoacart added a commit to tailscale/netlink that referenced this pull request Aug 22, 2024
This allows Tailscale to use this module while we wait for upstream PR to be merged.
See vishvananda#1006

Updates tailscale/tailscale#12298

Signed-off-by: Percy Wegmann <percy@tailscale.com>
oxtoacart added a commit to tailscale/tailscale that referenced this pull request Aug 22, 2024
…equire vishvananda/netlink

After the upstream PR is merged, we can point directly at github.com/vishvananda/netlink
and retire github.com/tailscale/netlink.

See vishvananda/netlink#1006

Updates #12298

Signed-off-by: Percy Wegmann <percy@tailscale.com>
rule.go Outdated
// Type is the unix.RTN_* rule type, such as RTN_UNICAST
// or RTN_UNREACHABLE.
// When adding a new rule, zero means automatic.
// Only supported on Linux.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why does this element need all this explanation while all other ones don't?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm happy to remove it if you prefer, it just seemed like useful documentation for any consumer of this new field.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes let's remove it, unless it deviates from iproute2.
Assumption is who uses this library is familiar with iproute2 and can always look for reference uses there and check kernek code as well. Also you are adding UT which shows an example, which is great.
Thank you for your contribution.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment removed.

rule_linux.go Outdated
case unix.RTN_UNICAST:
return ""
case unix.RTN_LOCAL:
return " local"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure about having the leading space in the string. Let's have the print function add that. Not a big deal if we have a trailing space in the route entry when type == RTN_UNSPEC

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Note that on Mac, we will always have a trailing space.

rule.go Outdated
@@ -41,8 +42,8 @@ func (r Rule) String() string {
to = r.Dst.String()
}

return fmt.Sprintf("ip rule %d: from %s to %s table %d",
r.Priority, from, to, r.Table)
return fmt.Sprintf("ip rule %d: from %s to %s table %d%s",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am referring to this stringification of the IP Rule put a space here please

@oxtoacart oxtoacart force-pushed the percy/issue12298 branch 2 times, most recently from 33bee70 to 5d7411d Compare August 22, 2024 22:24
oxtoacart added a commit to tailscale/tailscale that referenced this pull request Aug 22, 2024
…equire vishvananda/netlink

After the upstream PR is merged, we can point directly at github.com/vishvananda/netlink
and retire github.com/tailscale/netlink.

See vishvananda/netlink#1006

Updates #12298

Signed-off-by: Percy Wegmann <percy@tailscale.com>
…BLE) rules

Updates vishvananda#710

Co-authored-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Signed-off-by: Percy Wegmann <percy@tailscale.com>
@aboch
Copy link
Collaborator

aboch commented Aug 23, 2024

LGTM

@aboch aboch merged commit 5b0b9d8 into vishvananda:main Aug 23, 2024
2 checks passed
@oxtoacart
Copy link
Contributor Author

Thanks for the review @aboch !

@oxtoacart oxtoacart deleted the percy/issue12298 branch August 23, 2024 19:13
Asutorufa pushed a commit to Asutorufa/tailscale that referenced this pull request Aug 23, 2024
…equire vishvananda/netlink

After the upstream PR is merged, we can point directly at github.com/vishvananda/netlink
and retire github.com/tailscale/netlink.

See vishvananda/netlink#1006

Updates tailscale#12298

Signed-off-by: Percy Wegmann <percy@tailscale.com>
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.

2 participants