Skip to content

Commit

Permalink
Merge pull request #4 from ivan-section-io/fix-kernel412
Browse files Browse the repository at this point in the history
Support linux kernel >=4.12
  • Loading branch information
ema authored Sep 3, 2019
2 parents 2096629 + 8c3797c commit 5445cf6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
language: go
go:
- 1.x
env:
- GO111MODULE=on
os:
- linux
sudo: required
before_install:
- go get github.com/golang/lint/golint
- go get golang.org/x/lint/golint
- go get honnef.co/go/tools/cmd/staticcheck
- go get -d ./...
script:
Expand Down
4 changes: 2 additions & 2 deletions get.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func getQdiscMsgs(c *netlink.Conn) ([]netlink.Message, error) {
Flags: netlink.Request | netlink.Dump,
Type: 38, // RTM_GETQDISC
},
Data: []byte{0},
Data: make([]byte, 20),
}

// Perform a request, receive replies, and validate the replies
Expand Down Expand Up @@ -192,7 +192,7 @@ func parseMessage(msg netlink.Message) (QdiscInfo, error) {
*/

if len(msg.Data) < 20 {
return m, fmt.Errorf("Short message, len=%d", len(msg.Data))
return m, fmt.Errorf("short message, len=%d", len(msg.Data))
}

ifaceIdx := nlenc.Uint32(msg.Data[4:8])
Expand Down
2 changes: 1 addition & 1 deletion get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestGetAndParseShort(t *testing.T) {
t.Fatalf("msgs should be nil, got '%v' instead", msgs)
}

if err.Error() != "Short message, len=4" {
if err.Error() != "short message, len=4" {
t.Fatalf("expected short message error, got '%v' instead", err)
}
}
Expand Down
7 changes: 7 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module github.com/ema/qdisc

go 1.12

require (
github.com/mdlayher/netlink v0.0.0-20180516140058-ef6039541fbb
)

0 comments on commit 5445cf6

Please sign in to comment.