Skip to content

Fix merge problem#48515

Merged
robmry merged 1 commit intomoby:masterfrom
robmry:wsl2_nlwrap_merge_conflict
Sep 17, 2024
Merged

Fix merge problem#48515
robmry merged 1 commit intomoby:masterfrom
robmry:wsl2_nlwrap_merge_conflict

Conversation

@robmry
Copy link
Contributor

@robmry robmry commented Sep 17, 2024

- What I did

Commit f9c0103 (WSL2 mirrored-mode loopback) uses netlink funcs that were removed/wrapped by commit 00bf437.

(The vishvananda/netlink import was removed from setup_ip_tables_linux.go, but was still used in the merged WSL2 code.)

- How I did it

Fix the merged code.

- How to verify it

It compiles.

- Description for the changelog

n/a

@robmry robmry added area/networking Networking kind/bugfix PR's that fix bugs labels Sep 17, 2024
@robmry robmry added this to the 28.0.0 milestone Sep 17, 2024
@robmry robmry self-assigned this Sep 17, 2024
@robmry robmry requested a review from akerouanton September 17, 2024 09:26
Commit f9c0103 (WSL2 mirrored-mode loopback) uses netlink funcs
that were removed/wrapped by commit 00bf437.

Signed-off-by: Rob Murray <[email protected]>
@robmry robmry force-pushed the wsl2_nlwrap_merge_conflict branch from adae955 to 333cfa6 Compare September 17, 2024 09:38
@robmry robmry requested a review from thaJeztah September 17, 2024 09:59
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

}
if _, err := netlink.LinkByName("loopback0"); err != nil {
if _, err := nlwrap.LinkByName("loopback0"); err != nil {
if !errors.As(err, &netlink.LinkNotFoundError{}) {
Copy link
Member

Choose a reason for hiding this comment

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

Definitely not for this PR, but we could even consider that (internal) package to return errdefs types I guess (in this case a errdefs.NotFound).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The nlwrap package currently only wraps the minimum number of vishvananda/netlink functions ... only some of the underlying functions can return ErrDumpInterrupted, and only the few of those we actually use are wrapped. Methods on nlwrap.Handle that don't have replacements in nlwrap end up as direct calls to the vishvananda/netlink method. The idea is that the caller doesn't need to care whether the specific method is wrapped.

If we wanted to modify error types, I think we'd need to wrap all of the Handle methods and their package-level equivalents (or all of the ones we use), and keep it all in-step with the netlink package. That sounds like a bit of a headache!

Copy link
Member

Choose a reason for hiding this comment

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

Ah, yeah, that makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/networking Networking kind/bugfix PR's that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants