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

panic on RuleList with "from 9.9.9.0/24 to 6.6.6.0/24 tun_id 55 lookup 66" #672

Closed
sigmonsays opened this issue Aug 10, 2021 · 2 comments · Fixed by #673
Closed

panic on RuleList with "from 9.9.9.0/24 to 6.6.6.0/24 tun_id 55 lookup 66" #672

sigmonsays opened this issue Aug 10, 2021 · 2 comments · Fixed by #673

Comments

@sigmonsays
Copy link
Contributor

sigmonsays commented Aug 10, 2021

add rule that breaks RuleList()

sudo ip rule add from 9.9.9.0/24 to 6.6.6.0/24 lookup 66 tun_id 55

run code to see panic


u@s1:~/junk$ go mod init example
u@s1:~/junk$ go get github.com/vishvananda/netlink@latest
u@s1:~/junk$ go run main.go
panic: runtime error: index out of range [7] with length 4

goroutine 1 [running]:
encoding/binary.littleEndian.Uint64(...)
        /usr/local/go/src/encoding/binary/binary.go:77
github.com/vishvananda/netlink.(*Handle).RuleList(0x56d670, 0x0, 0x401150, 0x0, 0x0, 0xffffffff, 0xc00008e058)
        /home/u/go/pkg/mod/github.com/vishvananda/[email protected]/rule_linux.go:207 +0x9f4
github.com/vishvananda/netlink.RuleList(...)
        /home/u/go/pkg/mod/github.com/vishvananda/[email protected]/rule_linux.go:160
main.main()
        /home/u/junk/main.go:10 +0x36
exit status 2

example code

u@s1:~/junk$ cat main.go
package main

import (
        "github.com/vishvananda/netlink"
        "github.com/vishvananda/netlink/nl"
)

func main() {

        netlink.RuleList(nl.FAMILY_ALL)

}
@sigmonsays
Copy link
Contributor Author

The issue appears to be a uint64 is expected but only 4 bytes is provided at line 232 inrule_linux.go

@sigmonsays
Copy link
Contributor Author

Created PR to fix #673

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 a pull request may close this issue.

1 participant