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

Getting version errors while ucing tc-redirect-tap #98

Open
AvaterClasher opened this issue Nov 28, 2024 · 4 comments
Open

Getting version errors while ucing tc-redirect-tap #98

AvaterClasher opened this issue Nov 28, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@AvaterClasher
Copy link

I am trying to setup a go project with firecrackers-go-sdk so for networking
I tried using cni version: v1.0.0 first for the plugin that gave me this error :

Failed handler "fcinit.SetupNetwork": failure when invoking CNI: failed to delete pre-existing CNI network {NetworkName:fcnet NetworkConfig:<nil> IfName:veth0 VMIfName: Args:[] BinPath:[/opt/cni/bin] ConfDir:/etc/cni/conf.d CacheDir:/var/lib/cni/b390d0c4-efd4-442b-96fe-d18af3c459af containerID:b390d0c4-efd4-442b-96fe-d18af3c459af netNSPath:/var/run/netns/b390d0c4-efd4-442b-96fe-d18af3c459af Force:false}: failed to delete CNI network list "fcnet": plugin type="tc-redirect-tap" failed (delete): incompatible CNI versions; config is "1.0.0", plugin supports ["0.3.0" "0.3.1" "0.4.0" "1.1.0"] 

So I tried changing the version to the suggedted v0.4.0 and that gives me this error now:

Failed handler "fcinit.SetupNetwork": failure when invoking CNI: failed to create CNI network: plugin type="tc-redirect-tap" failed (add): unsupported CNI result version "1.1.0"

The thing is here i am using this fcnet.conflist instead:

{
  "name": "fcnet",
  "cniVersion": "0.4.0",
  "plugins": [
    {
      "type": "ptp",
      "ipMasq": true,
      "ipam": {
        "type": "host-local",
        "subnet": "192.168.127.0/24",
        "resolvConf": "/etc/resolv.conf"
      }
    },
    {
      "type": "tc-redirect-tap"
    }
  ]
}

How should this be setup then ?

@austinvazquez
Copy link
Contributor

@AvaterClasher, thanks for reporting the issue. This sounds like a bug to me as tc-redirect-tap does support version 1.0.0. I believe this is caused by the supported version logic depending on CNI version.CurrentVersion function which is currently returning 1.1.0 and missing 1.0.0 has broken the chain. I have opened a PR to fix the issue if you can please take a look.

@austinvazquez austinvazquez added the bug Something isn't working label Nov 29, 2024
@AvaterClasher
Copy link
Author

AvaterClasher commented Nov 30, 2024

@austinvazquez Hello, I tested the plugin with the fix you did but I am still getting the same error. I think I did everything correctly cloned your repo, checked out to your branch, rebuilt the plugin and put it in my cni/bin.
This is the repo I used for checking if its spawning if it helps. Repo. In the repo the rootfs.ext4 should go in the rootfs folder.

This is the current error. ->

2024/11/30 13:31:00 Attempting to spawn a Firecracker VM...
WARN[0001] Failed handler "fcinit.SetupNetwork": failure when invoking CNI: failed to create CNI network: plugin type="tc-redirect-tap" failed (add): unsupported CNI result version "1.1.0" 
2024/11/30 13:31:02 Failed to spawn Firecracker VM: failed to start machine: failure when invoking CNI: failed to create CNI network: plugin type="tc-redirect-tap" failed (add): unsupported CNI result version "1.1.0"

And the current conf ->

{
  "name": "fcnet",
  "cniVersion": "1.0.0",
  "plugins": [
    {
      "type": "ptp",
      "ipMasq": true,
      "ipam": {
        "type": "host-local",
        "subnet": "192.168.127.0/24",
        "resolvConf": "/etc/resolv.conf"
      }
    },
    {
      "type": "tc-redirect-tap"
    }
  ]
}

Another thing I noticed is that if I change the version to 1.1.0 the error changes to this ->

2024/11/30 14:01:00 Attempting to spawn a Firecracker VM...
WARN[0001] Failed handler "fcinit.SetupNetwork": failure when invoking CNI: failed to create CNI network: plugin type="ptp" failed (add): unsupported CNI result version "1.1.0" 
2024/11/30 14:01:01 Failed to spawn Firecracker VM: failed to start machine: failure when invoking CNI: failed to create CNI network: plugin type="ptp" failed (add): unsupported CNI result version "1.1.0"

So for the tc-redirect-tap plugin atleast v1.1.0 doesnt cause any problems.

@Kern--
Copy link
Contributor

Kern-- commented Dec 24, 2024

Hi @AvaterClasher

That later ptp issue looks like you might be using an older version of the ptp plugin. Looks like the standard cni plugins go support for CNI 1.1.0 in v1.6.0. Can you confirm that you are up to date?

You can confirm with /opt/cni/bin/ptp version - it should report up to 1.1.0.

For the earlier issue, I wonder if there's something weird happening because firecracker-go-sdk is using CNI 1.0.1 to exec the plugins. If you still want to try CNI 1.0.0, can you try building against the firecracker-go-sdk main branch?

@AvaterClasher
Copy link
Author

Hi @Kern--
Checked the ptp version it indeed reports upto 1.1.0.
Will try out what you suggested with the firecracker-go-sdk.

Another thing I tried out was hacking the tc-redirect-tap a little bit.

So I found out that this line was giving out the version to be v1.1.0. No matter what my cni version was.

return types.PrintResult(p.currentResult, p.currentResult.CNIVersion)

So I hardcoded it to v1.0.0 and it started working as expected.
https://github.com/AvaterClasher/tc-redirect-tap/blob/321e88dc7aaf3ecda6fb945b4b91aeda040fbce5/cmd/tc-redirect-tap/main.go#L69

Now I dont know much about CNI plugins to tell what was going wrong. Hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants