Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #75 from gfanton/fix/netlink-android
Browse files Browse the repository at this point in the history
Use specific netlink families for android
  • Loading branch information
Stebalien authored Aug 30, 2019
2 parents 61a9a79 + 86748ad commit 17543aa
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ require (
github.com/vishvananda/netlink v1.0.0
github.com/vishvananda/netns v0.0.0-20190625233234-7109fa855b0f // indirect
github.com/whyrusleeping/mafmt v1.2.8
golang.org/x/sys v0.0.0-20190526052359-791d8a0f4d09
)
10 changes: 10 additions & 0 deletions netlink_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// +build linux

package libp2pquic

import "golang.org/x/sys/unix"

// We just need netlink_route here.
// note: We should avoid the use of netlink_xfrm or netlink_netfilter has it is
// not allowed by Android in his base policy.
var SupportedNlFamilies = []int{unix.NETLINK_ROUTE}
8 changes: 8 additions & 0 deletions netlink_other.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// +build !linux

package libp2pquic

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

// nl.SupportedNlFamilies is the default netlink families used by the netlink package
var SupportedNlFamilies = nl.SupportedNlFamilies
2 changes: 1 addition & 1 deletion reuse.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type reuse struct {

func newReuse() (*reuse, error) {
// On non-Linux systems, this will return ErrNotImplemented.
handle, err := netlink.NewHandle()
handle, err := netlink.NewHandle(SupportedNlFamilies...)
if err == netlink.ErrNotImplemented {
handle = nil
} else if err != nil {
Expand Down

0 comments on commit 17543aa

Please sign in to comment.