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

Use specific netlink families for android #75

Merged
merged 2 commits into from
Aug 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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