cni
cni copied to clipboard
fix 714-plugin add netns validation reinforcement
fix-714: https://github.com/containernetworking/plugins/issues/714
Is something like this? Need your review. :) @squeed
Coverage increased (+0.02%) to 72.228% when pulling c31383f95b58c7cfebe3383d3c11366b3a8a57ca on Poor12:fix-714 into 8dba3824fbfdf9fe69e72cd2f2330c06303e2a84 on containernetworking:main.
@Poor12 surprise: this doesn't build on Windows :). We'll need to stub out the function with build flags.
@Poor12 surprise: this doesn't build on Windows :). We'll need to stub out the function with build flags.
I am not familiar with this. Could you do me a favor?Thanks a lot.
I am not familiar with this. Could you do me a favor?Thanks a lot.
# github.com/vishvananda/netns
Error: C:\Users\runneradmin\go\pkg\mod\github.com\vishvananda\[email protected]\netns.go:28:13: undefined: unix.Stat_t
Error: C:\Users\runneradmin\go\pkg\mod\github.com\vishvananda\[email protected]\netns.go:29:12: undefined: unix.Fstat
Error: C:\Users\runneradmin\go\pkg\mod\github.com\vishvananda\[email protected]\netns.go:32:12: undefined: unix.Fstat
Error: C:\Users\runneradmin\go\pkg\mod\github.com\vishvananda\[email protected]\netns.go:43:8: undefined: unix.Stat_t
Error: C:\Users\runneradmin\go\pkg\mod\github.com\vishvananda\[email protected]\netns.go:44:12: undefined: unix.Fstat
Error: C:\Users\runneradmin\go\pkg\mod\github.com\vishvananda\[email protected]\netns.go:56:8: undefined: unix.Stat_t
Error: C:\Users\runneradmin\go\pkg\mod\github.com\vishvananda\[email protected]\netns.go:57:12: undefined: unix.Fstat
Error: C:\Users\runneradmin\go\pkg\mod\github.com\vishvananda\[email protected]\netns.go:71:12: undefined: unix.Close
That just means that because the netlink library and Unix stuff doesn't work on Windows, you need to move that code to a different file. Here's what you do.
- Make a new file called netns_linux.go and put getCurrentNS(), getCurrentThreadNetNSPath(), and checkNetNS() into that.
- Make a new file called netns_windows.go and stub out the checkNetNS() function there like:
func checkNetNS(nsPath string) (bool, *types.Error) {
return false, nil
}
Files with _
Thanks for informing this. I have not seen _windows files before. And Happy Labor Day :) @dcbw
/cc @squeed @dcbw
Is there any progress about this issue?
Excuse me, several months ago I started a issue about https://github.com/containernetworking/plugins/issues/714 and have proposed a tentative solution but got very few replies lately. Actually our productive environment has had this problem for a while and we really hope to fix this problem in the community in order to avoid the problem of upstream and downstream inconsistencies caused by our private modification.
But during several months waiting for a response from the community, I have several confusion about this problem.
- Do we still need to fix this problem?Or we don't think it's a problem?
- Is there a more reasonable solution for this problem?
cc @squeed @dcbw @mars1024 @matthewdupre @mccv1r0 @MikeZappa87 @jellonek Really sorry if disturbing you.