profile
viewpoint

vishvananda/netlink 1166

Simple netlink library for go.

aboch/docker 1

Docker - the open-source application container engine

aboch/socketplane 1

SocketPlane - Multi-Host Container Networking

aboch/libnetwork_new 0

networking for containers

aboch/linux 0

Spotify's Linux kernel for Debian-based systems

aboch/netlink 0

Simple netlink library for go.

aboch/swarmkit 0

A toolkit for orchestrating distributed systems at any scale. It includes primitives for node discovery, raft-based consensus, task scheduling and more.

push eventvishvananda/netlink

Antonio Ojea

commit sha bca67dfc8220b44ef582c9da4e9172bf1c9ec973

conntrack filter by port and protocol Add a new method to the ConntrackFilter to be able to filter conntrack entries by Layer 4 protocol and source and destination port. Signed-off-by: Antonio Ojea <aojea@redhat.com>

view details

push time in 10 days

PR merged vishvananda/netlink

conntrack filter by protocol and port

Add a new method to the ConntrackFilter to be able to filter conntrack entries by Layer 4 protocol and ports

+222 -60

4 comments

2 changed files

aojea

pr closed time in 10 days

pull request commentvishvananda/netlink

conntrack filter by protocol and port

LGTM

aojea

comment created time in 10 days

Pull request review commentvishvananda/netlink

conntrack filter by protocol and port

 func (f *ConntrackFilter) AddIP(tp ConntrackFilterType, ip net.IP) error { 	return nil } +// AddPort adds a Port to the conntrack filter if the Layer 4 protocol allows it+func (f *ConntrackFilter) AddPort(tp ConntrackFilterType, port uint16) error {+	switch f.protoFilter {+	// TCP, UDP, DCCP, SCTP, UDPLite+	case 6, 17, 33, 132, 136:+	default:+		return errors.New("Filter attribute not available without a Layer 4 protocol")

Also change [..] without a Layer 4 protocol => [...] without a valid Layer 4 protocol either "valid" or "supported", you choose

aojea

comment created time in 10 days

Pull request review commentvishvananda/netlink

conntrack filter by protocol and port

 func (f *ConntrackFilter) AddIP(tp ConntrackFilterType, ip net.IP) error { 	return nil } +// AddPort adds a Port to the conntrack filter if the Layer 4 protocol allows it+func (f *ConntrackFilter) AddPort(tp ConntrackFilterType, port uint16) error {+	switch f.protoFilter {+	// TCP, UDP, DCCP, SCTP, UDPLite+	case 6, 17, 33, 132, 136:+	default:+		return errors.New("Filter attribute not available without a Layer 4 protocol")

Please have error msg also print the protoFilter value.

aojea

comment created time in 10 days

push eventvishvananda/netlink

Oleg Senin

commit sha cf66001890388205fa46cba77a24a7586aae0c1c

Add filtering in NeighListExecute

view details

push time in a month

pull request commentvishvananda/netlink

Add filtering in NeighListExecute

LGTM

RealFatCat

comment created time in a month

push eventvishvananda/netlink

Dmitrii Okunev

commit sha dc0e1b988c576e51c08712dc2a431ab3a2f2aaf1

feature: Add wireguard link type Added type "Wireguard" which implements link type "wireguard". See also https://www.wireguard.com/ Signed-off-by: Dmitrii Okunev <xaionaro@fb.com>

view details

push time in a month

PR merged vishvananda/netlink

Reviewers
Added wireguard link type
[xaionaro@void netlink]$ go test ./... -count=1
ok      github.com/vishvananda/netlink  0.013s
ok      github.com/vishvananda/netlink/nl       4.073s
+31 -0

5 comments

3 changed files

xaionaro

pr closed time in a month

Pull request review commentvishvananda/netlink

Add SocketDiagTCPInfo with some constants and structs to get tcp_info…

+package netlink++import (+	"bytes"+	"io"+)++type TCPInfo struct {+	State                     uint8+	Ca_state                  uint8+	Retransmits               uint8+	Probes                    uint8+	Backoff                   uint8+	Options                   uint8+	Snd_wscale                uint8 // no uint4+	Rcv_wscale                uint8+	Delivery_rate_app_limited uint8+	Fastopen_client_fail      uint8+	Rto                       uint32+	Ato                       uint32+	Snd_mss                   uint32+	Rcv_mss                   uint32+	Unacked                   uint32+	Sacked                    uint32+	Lost                      uint32+	Retrans                   uint32+	Fackets                   uint32+	Last_data_sent            uint32+	Last_ack_sent             uint32+	Last_data_recv            uint32+	Last_ack_recv             uint32+	Pmtu                      uint32+	Rcv_ssthresh              uint32+	Rtt                       uint32+	Rttvar                    uint32+	Snd_ssthresh              uint32+	Snd_cwnd                  uint32+	Advmss                    uint32+	Reordering                uint32+	Rcv_rtt                   uint32+	Rcv_space                 uint32+	Total_retrans             uint32+	Pacing_rate               uint64+	Max_pacing_rate           uint64+	Bytes_acked               uint64 /* RFC4898 tcpEStatsAppHCThruOctetsAcked */+	Bytes_received            uint64 /* RFC4898 tcpEStatsAppHCThruOctetsReceived */+	Segs_out                  uint32 /* RFC4898 tcpEStatsPerfSegsOut */+	Segs_in                   uint32 /* RFC4898 tcpEStatsPerfSegsIn */+	Notsent_bytes             uint32+	Min_rtt                   uint32+	Data_segs_in              uint32 /* RFC4898 tcpEStatsDataSegsIn */+	Data_segs_out             uint32 /* RFC4898 tcpEStatsDataSegsOut */+	Delivery_rate             uint64+	Busy_time                 uint64 /* Time (usec) busy sending data */+	Rwnd_limited              uint64 /* Time (usec) limited by receive window */+	Sndbuf_limited            uint64 /* Time (usec) limited by send buffer */+	Delivered                 uint32+	Delivered_ce              uint32+	Bytes_sent                uint64 /* RFC4898 tcpEStatsPerfHCDataOctetsOut */+	Bytes_retrans             uint64 /* RFC4898 tcpEStatsPerfOctetsRetrans */+	Dsack_dups                uint32 /* RFC4898 tcpEStatsStackDSACKDups */+	Reord_seen                uint32 /* reordering events seen */+	Rcv_ooopack               uint32 /* Out-of-order packets received */+	Snd_wnd                   uint32 /* peer's advertised receive window after * scaling (bytes) */+}++func checkDeserErr(err error) error {+	if err == io.EOF {+		return nil+	}+	return err+}++func (t *TCPInfo) deserialize(b []byte) error {+	var err error+	rb := bytes.NewBuffer(b)++	t.State, err = rb.ReadByte()+	if err != nil {+		return checkDeserErr(err)+	}++	t.Ca_state, err = rb.ReadByte()+	if err != nil {+		return checkDeserErr(err)+	}++	t.Retransmits, err = rb.ReadByte()+	if err != nil {+		return checkDeserErr(err)+	}++	t.Probes, err = rb.ReadByte()+	if err != nil {+		return checkDeserErr(err)+	}++	t.Backoff, err = rb.ReadByte()+	if err != nil {+		return checkDeserErr(err)+	}+	t.Options, err = rb.ReadByte()+	if err != nil {+		return checkDeserErr(err)+	}++	scales, err := rb.ReadByte()+	if err != nil {+		return checkDeserErr(err)+	}+	t.Snd_wscale = scales >> 4  // first 4 bits+	t.Rcv_wscale = scales & 0xf // last 4 bits++	rateLimAndFastOpen, err := rb.ReadByte()+	if err != nil {+		return checkDeserErr(err)+	}+	t.Delivery_rate_app_limited = rateLimAndFastOpen >> 7   // get first bit+	t.Fastopen_client_fail = rateLimAndFastOpen >> 5 & 0b11 // get next two bits

image

RealFatCat

comment created time in a month

pull request commentvishvananda/netlink

Add SocketDiagTCPInfo with some constants and structs to get tcp_info…

Is it feasible to add a UT for this ?

RealFatCat

comment created time in a month

Pull request review commentvishvananda/netlink

Add SocketDiagTCPInfo with some constants and structs to get tcp_info…

 func SocketGet(local, remote net.Addr) (*Socket, error) { 	} 	return sock, nil }++// SocketDiagTCPInfo requests INET_DIAG_INFO for TCP protocol for specified family type.+func SocketDiagTCPInfo(family uint8) ([]*InetDiagTCPInfoResp, error) {+	s, err := nl.Subscribe(unix.NETLINK_INET_DIAG)+	if err != nil {+		return nil, err+	}+	defer s.Close()++	req := nl.NewNetlinkRequest(nl.SOCK_DIAG_BY_FAMILY, unix.NLM_F_DUMP)+	req.AddData(&socketRequest{+		Family:   family,+		Protocol: unix.IPPROTO_TCP,+		Ext:      INET_DIAG_INFO,+		States:   uint32(0xfff), // All TCP states

:facepalm: That's right.

RealFatCat

comment created time in a month

Pull request review commentvishvananda/netlink

Added wireguard link type

-module github.com/vishvananda/netlink+module github.com/xaionaro-go/netlink

?

xaionaro

comment created time in a month

PullRequestEvent

push eventvishvananda/netlink

Amit Nishry

commit sha 5a869a71f0cb5e722da6bd13199d034aa5a34591

Introduce RouteGetWithOptions that allows to modify the RouteGet Add support for VrfName as the RouteGetOptions Signed-off-by: Amit Nishry <amit.nishry@gmail.com>

view details

push time in a month

PR merged vishvananda/netlink

Introduce RouteGetWithOptions that allows to modify the RouteGet

Add support for VrfName as the RouteGetOptions

Signed-off-by: Amit Nishry amit.nishry@gmail.com

+34 -3

1 comment

1 changed file

amitn

pr closed time in a month

pull request commentvishvananda/netlink

Introduce RouteGetWithOptions that allows to modify the RouteGet

Having an explicit method for querying a route with options is not that bad either.

LGTM

amitn

comment created time in a month

push eventvishvananda/netlink

Ralph Schmieder

commit sha 5400e006d43d75422c9310bdf39ca99289bb09cd

make tuntap pollable

view details

push time in a month

PR merged vishvananda/netlink

make tuntap pollable

this patch allows tuntaps to be used with go1.13. It worked w/ 1.12 and before. Then failed with 1.13 resulting in read /dev/net/tun: not pollable.

The comment in the code has additional details. Thanks to @breakintheweb for the help to fix this.

See https://github.com/golang/go/issues/30426 which got exposed in go 1.13 by the fix to https://github.com/golang/go/issues/30624 .

+36 -4

3 comments

1 changed file

rschmied

pr closed time in a month

pull request commentvishvananda/netlink

make tuntap pollable

LGTM

rschmied

comment created time in a month

pull request commentvishvananda/netlink

Add LinkSetMacvlanMode

Also please squash your commits into one

jcaamano

comment created time in a month

pull request commentvishvananda/netlink

Add LinkSetMacvlanMode

Please rebase to latest and force push I remember a fix was merged for the XRFM monitoring test which failed your CI

jcaamano

comment created time in a month

pull request commentvishvananda/netlink

Add filtering in NeighListExecute

Please squash your commits into one

RealFatCat

comment created time in a month

PR merged vishvananda/netlink

Fix parsing of IFLA_IPTUN_COLLECT_METADATA

IFLA_IPTUN_COLLECT_METADATA are used as flags and therefore have no content

+1 -1

2 comments

1 changed file

lebauce

pr closed time in a month

push eventvishvananda/netlink

Sylvain Baubeau

commit sha e6be014dfaf3e7ac7537c56c7571dccaaf358435

Fix parsing of IFLA_IPTUN_COLLECT_METADATA IFLA_IPTUN_COLLECT_METADATA are used as flags and therefore have no content

view details

push time in a month

pull request commentvishvananda/netlink

Fix parsing of IFLA_IPTUN_COLLECT_METADATA

LGTM

lebauce

comment created time in a month

pull request commentvishvananda/netlink

Fix parsing of IFLA_IPTUN_COLLECT_METADATA

IFLA_IPTUN_COLLECT_METADATA are used as flags and therefore have no content

Looks like so https://elixir.bootlin.com/linux/latest/source/net/ipv4/ipip.c#L453

lebauce

comment created time in a month

pull request commentvishvananda/netlink

Sittun: add Proto field

Would it be possible to add a simple UT for this ?

gdetal

comment created time in a month

push eventvishvananda/netlink

Adrian Chiris

commit sha f4f591aee8c4bb82d3a87d3a3c41bcd394111363

Add support for getting all RDMA devices in the system - Add RdmaLinkList() method that retrieves RDMA devices in the system. - Modify RdmaLinkByName() to use RdmaLinkList() to avoid code duplication. - Add unit test that demonstrates how to use RdmaLinkList() Signed-off-by: Adrian Chiris <adrianc@mellanox.com>

view details

push time in a month

PR merged vishvananda/netlink

Add support for getting all RDMA devices in the system
  • Add RdmaLinkList() method that retrieves RDMA devices in the system.

  • Modify RdmaLinkByName() to use RdmaLinkList() to avoid code duplication.

  • Add unit test that demonstrates how to use RdmaLinkList()

Signed-off-by: Adrian Chiris adrianc@mellanox.com

+44 -15

3 comments

2 changed files

adrianchiris

pr closed time in a month

pull request commentvishvananda/netlink

Add support for getting all RDMA devices in the system

LGTM

adrianchiris

comment created time in a month

push eventvishvananda/netlink

Daniel Gollub

commit sha 12f2829c35270e76ac6f68e243176a0fbefad42f

Add LinkModify support Signed-off-by: Daniel Gollub <dgollub@att.com>

view details

push time in a month

PR merged vishvananda/netlink

Add LinkModify support

Signed-off-by: Daniel Gollub dgollub@att.com

+40 -0

3 comments

2 changed files

gollub

pr closed time in a month

pull request commentvishvananda/netlink

Add LinkModify support

LGTM

gollub

comment created time in a month

Pull request review commentvishvananda/netlink

Add SocketDiagTCPInfo with some constants and structs to get tcp_info…

 func SocketGet(local, remote net.Addr) (*Socket, error) { 	} 	return sock, nil }++// SocketDiagTCPInfo requests INET_DIAG_INFO for TCP protocol for specified family type.+func SocketDiagTCPInfo(family uint8) ([]*InetDiagTCPInfoResp, error) {+	s, err := nl.Subscribe(unix.NETLINK_INET_DIAG)+	if err != nil {+		return nil, err+	}+	defer s.Close()++	req := nl.NewNetlinkRequest(nl.SOCK_DIAG_BY_FAMILY, unix.NLM_F_DUMP)+	req.AddData(&socketRequest{+		Family:   family,+		Protocol: unix.IPPROTO_TCP,+		Ext:      INET_DIAG_INFO,+		States:   uint32(0xfff), // All TCP states

looking at https://elixir.bootlin.com/linux/latest/source/include/net/tcp_states.h If this is a mask,does it need to be 0xfff or 0xf is enough ?

RealFatCat

comment created time in a month

pull request commentvishvananda/netlink

Allow placing veth peer into a namespace

Thanks. Please add a UT for this as well.

const86

comment created time in a month

push eventvishvananda/netlink

Chris Tarazi

commit sha 564132f7872cfe0c7adc666e9e1015c38caa27bb

Implement RuleListFiltered This commit adds the ability to list rules in a filtered manner, similar to RouteListFiltered. Signed-off-by: Chris Tarazi <tarazichris@gmail.com>

view details

push time in a month

PR merged vishvananda/netlink

Add ability to list rules in a filtered manner

This commit adds the ability to list rules in a filtered manner, similar to RouteListFiltered.

This was needed on the Cilium project and an implementation similar to this has been made in that codebase internally. This is an effort to upstream that functionality. Open to any feedback on the approach or in general :).

+353 -17

1 comment

3 changed files

christarazi

pr closed time in a month

pull request commentvishvananda/netlink

Add ability to list rules in a filtered manner

LGTM

christarazi

comment created time in a month

Pull request review commentvishvananda/netlink

Add ability to list rules in a filtered manner

 func TestRuleAddDel(t *testing.T) { 		t.Fatal("Rule not removed properly") 	} }++func TestRuleListFiltered(t *testing.T) {+	skipUnlessRoot(t)+	defer setUpNetlinkTest(t)()++	t.Run("IPv4", testRuleListFilteredIPv4)+	t.Run("IPv6", testRuleListFilteredIPv6)+}++func testRuleListFilteredIPv4(t *testing.T) {+	srcNet := &net.IPNet{IP: net.IPv4(172, 16, 0, 1), Mask: net.CIDRMask(16, 32)}+	dstNet := &net.IPNet{IP: net.IPv4(172, 16, 1, 1), Mask: net.CIDRMask(24, 32)}+	runRuleListFiltered(t, FAMILY_V4, srcNet, dstNet)+}++func testRuleListFilteredIPv6(t *testing.T) {+	ip1 := net.ParseIP("fd56:6b58:db28:2913::")+	ip2 := net.ParseIP("fde9:379f:3b35:6635::")++	srcNet := &net.IPNet{IP: ip1, Mask: net.CIDRMask(64, 128)}+	dstNet := &net.IPNet{IP: ip2, Mask: net.CIDRMask(96, 128)}+	runRuleListFiltered(t, FAMILY_V6, srcNet, dstNet)+}++func runRuleListFiltered(t *testing.T, family int, srcNet, dstNet *net.IPNet) {+	defaultRules, _ := RuleList(family)++	tests := []struct {

:+1:

christarazi

comment created time in a month

push eventvishvananda/netlink

Alex Forster

commit sha 27f2b32dc625fec41ecdd71ed48bb2d5feaa2f54

Configure numrxqueues/numtxqueues on veth peer (fixes #536)

view details

push time in a month

issue closedvishvananda/netlink

NumRxQueues/NumTxQueues is not configured on veth peer

It does not appear possible to correctly configure the number of rx/tx queues on a veth pair.

When creating a veth pair like so:

link := nl.Veth{
	LinkAttrs: nl.LinkAttrs{
		Name:  "outer0",
		NumRxQueues: 16,
		NumTxQueues: 16,
	},
	PeerName: "inner0",
}

I would expect the outcome to be equivalent to the following ip command:

ip link add outer0 numrxqueues 16 numtxqueues 16 type veth peer inner0 numrxqueues 16 numtxqueues 16

However, this library actually performs the equivalent of the following ip command:

ip link add outer0 numrxqueues 16 numtxqueues 16 type veth peer inner0

The problem seems to be here, where the NumRxQueues/NumTxQueues attributes are not applied to the veth peer interface:

https://github.com/vishvananda/netlink/blob/5f2fc868c2d0841565778edda0e0ea2843a49431/link_linux.go#L1277-L1290

closed time in a month

alexforster

pull request commentvishvananda/netlink

Configure numrxqueues/numtxqueues on veth peer (fixes #536)

Thanks for adding the UT.

LGTM

alexforster

comment created time in a month

pull request commentvishvananda/netlink

Add LinkModify support

Please also add a UT for this.

gollub

comment created time in a month

push eventvishvananda/netlink

Martynas Pumputis

commit sha 96dce1cb9fbe0014e14ca5f20f31db0f3eb3f21b

Add LinkIndex to Addr struct Currently, it's cumbersome to get a link by an IP addr - one needs to list all links and then call AddrList() for each of them. Considering that ifindex is already available to to the parseAddr() helper function, we can expose it to a user via the newly added Addr.LinkIndex field. This makes the retrieving link by IP addr much more simple. Signed-off-by: Martynas Pumputis <m@lambda.lt>

view details

push time in a month

PR merged vishvananda/netlink

Add LinkIndex to Addr struct

Currently, it's cumbersome to get a link by an IP addr - one needs to list all links and then call AddrList() for each of them.

Considering that ifindex is already available to to the parseAddr() helper function, we can expose it to a user via the newly added Addr.LinkIndex field. This makes the retrieving link by IP addr much more simple.

+12 -7

2 comments

3 changed files

brb

pr closed time in a month

pull request commentvishvananda/netlink

Add LinkIndex to Addr struct

LGTM

brb

comment created time in a month

fork aboch/linux

Spotify's Linux kernel for Debian-based systems

fork in 2 months

pull request commentvishvananda/netns

Use golang.org/x/sys/unix instead of syscall

LGTM

tklauser

comment created time in 3 months

more