Skip to content

Conversation

@stephanreiter
Copy link

@stephanreiter stephanreiter commented Jun 26, 2025

This adds an implementation of Rule.Equal (and RulePortRange.Equal, RuleUIDRange.Equal) which allows us to compare two Rule objects.

It fixes #1094

@stephanreiter
Copy link
Author

stephanreiter commented Jun 26, 2025

Seeing this failure:

=== RUN   TestXfrmStateWithPcpunumWithoutSADir
    xfrm_state_linux_test.go:257: invalid argument: SA_PCPU only supported with SA_DIR
--- FAIL: TestXfrmStateWithPcpunumWithoutSADir (0.00s)

Seems to have been present in other recent PRs, so apparently not introduced here.

stephanreiter pushed a commit to stephanreiter/netlink that referenced this pull request Jun 29, 2025
When reading rules, makes sure to populate the type field of Rule.
Also adds a l3mdev flag to Rule, reads it when listing rules,
sets it when updating rules, and makes sure it is taken into
account when comparing rules using Equal as introduced in vishvananda#1095.
@tklauser
Copy link
Contributor

Seeing this failure:

=== RUN   TestXfrmStateWithPcpunumWithoutSADir
    xfrm_state_linux_test.go:257: invalid argument: SA_PCPU only supported with SA_DIR
--- FAIL: TestXfrmStateWithPcpunumWithoutSADir (0.00s)

This should be fixed now that #1106 is merged. Could you please rebase your branch and try again?

stephanreiter pushed a commit to stephanreiter/netlink that referenced this pull request Jul 22, 2025
When reading rules, makes sure to populate the type field of Rule.
Also adds a l3mdev flag to Rule, reads it when listing rules,
sets it when updating rules, and makes sure it is taken into
account when comparing rules using Equal as introduced in vishvananda#1095.
This adds an implementation of Rule.Equal
(and RulePortRange.Equal, RuleUIDRange.Equal)
which allows us to compare two Rule objects.
stephanreiter pushed a commit to stephanreiter/netlink that referenced this pull request Jul 22, 2025
When reading rules, makes sure to populate the type field of Rule.
Also adds a l3mdev flag to Rule, reads it when listing rules,
sets it when updating rules, and makes sure it is taken into
account when comparing rules using Equal as introduced in vishvananda#1095.
@stephanreiter
Copy link
Author

Thank you for letting me know. All green now.

stephanreiter pushed a commit to stephanreiter/netlink that referenced this pull request Jul 22, 2025
When reading rules, makes sure to populate the type field of Rule.
Also adds a l3mdev flag to Rule, reads it when listing rules,
sets it when updating rules, and makes sure it is taken into
account when comparing rules using Equal as introduced in vishvananda#1095.
stephanreiter pushed a commit to stephanreiter/netlink that referenced this pull request Jul 22, 2025
When reading rules, makes sure to populate the type field of Rule.
Also adds a l3mdev flag to Rule, reads it when listing rules,
sets it when updating rules, and makes sure it is taken into
account when comparing rules using Equal as introduced in vishvananda#1095.
stephanreiter pushed a commit to stephanreiter/netlink that referenced this pull request Jul 22, 2025
When reading rules, makes sure to populate the type field of Rule.
Also adds a l3mdev flag to Rule, reads it when listing rules,
sets it when updating rules, and makes sure it is taken into
account when comparing rules using Equal as introduced in vishvananda#1095.
stephanreiter pushed a commit to stephanreiter/netlink that referenced this pull request Jul 22, 2025
When reading rules, makes sure to populate the type field of Rule.
Also adds a l3mdev flag to Rule, reads it when listing rules,
sets it when updating rules, and makes sure it is taken into
account when comparing rules using Equal as introduced in vishvananda#1095.
stephanreiter pushed a commit to stephanreiter/netlink that referenced this pull request Jul 22, 2025
When reading rules, makes sure to populate the type field of Rule.
Also adds a l3mdev flag to Rule, reads it when listing rules,
sets it when updating rules, and makes sure it is taken into
account when comparing rules using Equal as introduced in vishvananda#1095.
stephanreiter pushed a commit to stephanreiter/netlink that referenced this pull request Jul 22, 2025
When reading rules, makes sure to populate the type field of Rule.
Also adds a l3mdev flag to Rule, reads it when listing rules,
sets it when updating rules, and makes sure it is taken into
account when comparing rules using Equal as introduced in vishvananda#1095.
stephanreiter pushed a commit to stephanreiter/netlink that referenced this pull request Jul 22, 2025
When reading rules, makes sure to populate the type field of Rule.
Note that an unspecified type is interpreted as UNICAST, for example,
when adding a rule. To make sure that a rule with unspecified type,
which was just added, compares equal to that rule being read back,
we we update Rule.Equal to treat unspecified and UNICAST types as equal.

Also adds a l3mdev flag to Rule, reads it when listing rules,
sets it when updating rules, and makes sure it is taken into
account when comparing rules using Equal as introduced in vishvananda#1095.
Copy link
Contributor

@tklauser tklauser left a comment

Choose a reason for hiding this comment

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

LGTM

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.

There is no Rule.Equal function

3 participants