From 72e783660b61782ea4a27201aedbd47d7f181a95 Mon Sep 17 00:00:00 2001 From: Matt Layher Date: Wed, 18 Nov 2020 15:19:39 -0500 Subject: [PATCH 1/4] go.mod: bump x/ dependencies for MPLS constants Signed-off-by: Matt Layher --- go.mod | 3 ++- go.sum | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 9e5e712..e4adbbb 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,6 @@ go 1.12 require ( github.com/google/go-cmp v0.5.3 github.com/mdlayher/netlink v1.1.1 - golang.org/x/sys v0.0.0-20201101102859-da207088b7d1 + golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect + golang.org/x/sys v0.0.0-20201118182958-a01c418693c7 ) diff --git a/go.sum b/go.sum index 05b7933..e30d544 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,7 @@ github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/jsimonetti/rtnetlink v0.0.0-20190606172950-9527aa82566a/go.mod h1:Oz+70psSo5OFh8DBl0Zv2ACw7Esh6pPUphlvZG9x7uw= github.com/jsimonetti/rtnetlink v0.0.0-20200117123717-f846d4f6c1f4/go.mod h1:WGuG/smIU4J/54PblvSbh+xvCZmpJnFgr3ds6Z55XMQ= @@ -24,6 +25,8 @@ golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjut golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb h1:mUVeFHoDKis5nxCAzoAi7E8Ghb86EXh/RK6wtvJIqRY= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190411185658-b44545bcd369/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -35,8 +38,8 @@ golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634 h1:bNEHhJCnrwMKNMmOx3yAynp5vs5/gRy+XWFtZFu7NBM= golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201101102859-da207088b7d1 h1:a/mKvvZr9Jcc8oKfcmgzyp7OwF73JPWsQLvH1z2Kxck= -golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201118182958-a01c418693c7 h1:Z991aAXPjz0tLnj74pVXW3eWJ5lHMIBvbRfMq4M2jHA= +golang.org/x/sys v0.0.0-20201118182958-a01c418693c7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From 057ddd1f37f818ec894f21380084cd70e1bbaf43 Mon Sep 17 00:00:00 2001 From: Matt Layher Date: Wed, 18 Nov 2020 15:26:31 -0500 Subject: [PATCH 2/4] rtnetlink: implement MPLSNextHop encoding and decoding Signed-off-by: Matt Layher --- internal/unix/types_linux.go | 5 ++ route.go | 126 +++++++++++++++++++++++++++++++++-- route_test.go | 90 +++++++++++++++++++++++++ 3 files changed, 216 insertions(+), 5 deletions(-) diff --git a/internal/unix/types_linux.go b/internal/unix/types_linux.go index 52b1a7d..9c747ad 100644 --- a/internal/unix/types_linux.go +++ b/internal/unix/types_linux.go @@ -65,6 +65,9 @@ const ( IFLA_XDP_FLAGS = linux.IFLA_XDP_FLAGS IFLA_XDP_PROG_ID = linux.IFLA_XDP_PROG_ID IFLA_XDP_EXPECTED_FD = linux.IFLA_XDP_EXPECTED_FD + LWTUNNEL_ENCAP_MPLS = linux.LWTUNNEL_ENCAP_MPLS + MPLS_IPTUNNEL_DST = linux.MPLS_IPTUNNEL_DST + MPLS_IPTUNNEL_TTL = linux.MPLS_IPTUNNEL_TTL NDA_UNSPEC = linux.NDA_UNSPEC NDA_DST = linux.NDA_DST NDA_LLADDR = linux.NDA_LLADDR @@ -72,6 +75,8 @@ const ( NDA_IFINDEX = linux.NDA_IFINDEX RTA_UNSPEC = linux.RTA_UNSPEC RTA_DST = linux.RTA_DST + RTA_ENCAP = linux.RTA_ENCAP + RTA_ENCAP_TYPE = linux.RTA_ENCAP_TYPE RTA_PREFSRC = linux.RTA_PREFSRC RTA_GATEWAY = linux.RTA_GATEWAY RTA_OIF = linux.RTA_OIF diff --git a/route.go b/route.go index 7be1885..4eaf2f0 100644 --- a/route.go +++ b/route.go @@ -1,6 +1,7 @@ package rtnetlink import ( + "encoding/binary" "errors" "net" "unsafe" @@ -348,8 +349,9 @@ type RTNextHop struct { // NextHop wraps struct rtnexthop to provide access to nested attributes type NextHop struct { - Hop RTNextHop // a rtnexthop struct - Gateway net.IP // that struct's nested Gateway attribute + Hop RTNextHop // a rtnexthop struct + Gateway net.IP // that struct's nested Gateway attribute + MPLS []MPLSNextHop // Any MPLS next hops for a route. } func (a *RouteAttributes) encodeMultipath() ([]byte, error) { @@ -359,11 +361,18 @@ func (a *RouteAttributes) encodeMultipath() ([]byte, error) { // compute the length of each (rtnexthop, attributes) pair. ae := netlink.NewAttributeEncoder() - if a.Gateway != nil { + if nh.Gateway != nil { // TODO(mdlayher): more validation. ae.Bytes(unix.RTA_GATEWAY, nh.Gateway) } + if len(nh.MPLS) > 0 { + // TODO(mdlayher): validation over different encapsulation types, + // and ensure that only one can be set. + ae.Uint16(unix.RTA_ENCAP_TYPE, unix.LWTUNNEL_ENCAP_MPLS) + ae.Nested(unix.RTA_ENCAP, nh.encodeEncap) + } + ab, err := ae.Encode() if err != nil { return nil, err @@ -417,16 +426,26 @@ func (a *RouteAttributes) parseMultipath(b []byte) error { return mpp.Err() } -// rtnexthop payload is at least one nested attribute RTA_GATEWAY -// possibly others? +// decode decodes netlink attribute values into a NextHop. func (nh *NextHop) decode(ad *netlink.AttributeDecoder) error { if ad == nil { // Invalid decoder, do nothing. return nil } + // If encapsulation is present, we won't know how to deal with it until we + // identify the right type and then later parse the nested attribute bytes. + var ( + encapType uint16 + encapBuf []byte + ) + for ad.Next() { switch ad.Type() { + case unix.RTA_ENCAP: + encapBuf = ad.Bytes() + case unix.RTA_ENCAP_TYPE: + encapType = ad.Uint16() case unix.RTA_GATEWAY: l := len(ad.Bytes()) if l != 4 && l != 16 { @@ -437,6 +456,103 @@ func (nh *NextHop) decode(ad *netlink.AttributeDecoder) error { } } + if err := ad.Err(); err != nil { + return err + } + + if encapType != 0 && encapBuf != nil { + // Found encapsulation, start decoding it from the buffer. + return nh.decodeEncap(encapType, encapBuf) + } + + return nil +} + +// An MPLSNextHop is a route next hop using MPLS encapsulation. +type MPLSNextHop struct { + Label int + TrafficClass int + BottomOfStack bool + TTL uint8 +} + +// TODO(mdlayher): MPLSNextHop TTL vs MPLS_IPTUNNEL_TTL. What's the difference? + +// encodeEncap encodes netlink attribute values related to encapsulation from +// a NextHop. +func (nh *NextHop) encodeEncap(ae *netlink.AttributeEncoder) error { + // TODO: this only handles MPLS encapsulation as that is all we support. + + // Allocate enough space for an MPLS label stack. + var ( + i int + b = make([]byte, 4*len(nh.MPLS)) + ) + + for _, mnh := range nh.MPLS { + // Pack the following: + // - label: 20 bits + // - traffic class: 3 bits + // - bottom-of-stack: 1 bit + // - TTL: 8 bits + binary.BigEndian.PutUint32(b[i:i+4], uint32(mnh.Label)<<12) + + b[i+2] |= byte(mnh.TrafficClass) << 1 + + if mnh.BottomOfStack { + b[i+2] |= 1 + } + + b[i+3] = mnh.TTL + + // Advance in the buffer to begin storing the next label. + i += 4 + } + + // Finally store the output bytes. + ae.Bytes(unix.MPLS_IPTUNNEL_DST, b) + return nil +} + +// decodeEncap decodes netlink attribute values related to encapsulation into a +// NextHop. +func (nh *NextHop) decodeEncap(typ uint16, b []byte) error { + if typ != unix.LWTUNNEL_ENCAP_MPLS { + // TODO: handle other encapsulation types as needed. + return nil + } + + // MPLS labels are stored as big endian bytes. + ad, err := netlink.NewAttributeDecoder(b) + if err != nil { + return err + } + + for ad.Next() { + switch ad.Type() { + case unix.MPLS_IPTUNNEL_DST: + // Every 4 bytes stores another MPLS label, so make sure the stored + // bytes are divisible by exactly 4. + b := ad.Bytes() + if len(b)%4 != 0 { + return errInvalidRouteMessageAttr + } + + for i := 0; i < len(b); i += 4 { + n := binary.BigEndian.Uint32(b[i : i+4]) + + // For reference, see: + // https://en.wikipedia.org/wiki/Multiprotocol_Label_Switching#Operation + nh.MPLS = append(nh.MPLS, MPLSNextHop{ + Label: int(n) >> 12, + TrafficClass: int(n & 0xe00 >> 9), + BottomOfStack: n&0x100 != 0, + TTL: uint8(n & 0xff), + }) + } + } + } + return ad.Err() } diff --git a/route_test.go b/route_test.go index 77b315c..d68c1fd 100644 --- a/route_test.go +++ b/route_test.go @@ -204,6 +204,96 @@ func TestRouteMessageMarshalUnmarshalBinary(t *testing.T) { } } +func TestRouteMessageMarshalRoundTrip(t *testing.T) { + skipBigEndian(t) + + // The above tests begin with unmarshaling raw bytes and are more + // comprehensive, but due to the complexity of nested route message + // attributes and structures, it has become rather difficult to maintain + // over time. These tests will focus on a subset of that functionality to + // ensure that marshaling and unmarshaling perform symmetrical operations + // given a proper Go type as input, rather than raw bytes. + + tests := []struct { + name string + m *RouteMessage + }{ + { + name: "multipath MPLS", + m: &RouteMessage{ + Attributes: RouteAttributes{ + Multipath: []NextHop{ + { + Hop: RTNextHop{ + Length: 48, + IfIndex: 1, + }, + Gateway: net.IPv4(10, 0, 0, 2), + MPLS: []MPLSNextHop{{ + Label: 1, + TrafficClass: 1, + BottomOfStack: true, + TTL: 1, + }}, + }, + { + Hop: RTNextHop{ + Length: 52, + IfIndex: 2, + }, + Gateway: net.IPv4(10, 0, 0, 3), + MPLS: []MPLSNextHop{ + { + Label: 1, + TrafficClass: 1, + TTL: 1, + }, + { + Label: 2, + TrafficClass: 2, + BottomOfStack: true, + TTL: 2, + }, + }, + }, + }, + }, + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // First do a marshaling and unmarshaling round trip to ensure + // the inputs and outputs are identical. + b1, err := tt.m.MarshalBinary() + if err != nil { + t.Fatalf("failed to marshal test message: %v", err) + } + + var m RouteMessage + if err := m.UnmarshalBinary(b1); err != nil { + t.Fatalf("failed to unmarshal: %v", err) + } + + if diff := cmp.Diff(tt.m, &m); diff != "" { + t.Fatalf("unexpected RouteMessage after round-trip (-want +got):\n%s", diff) + } + + // Then compare the results of the first marshaled bytes against + // the newly marshaled bytes. + b2, err := m.MarshalBinary() + if err != nil { + t.Fatalf("failed to marshal parsed message: %v", err) + } + + if diff := cmp.Diff(b1, b2); diff != "" { + t.Fatalf("unexpected final raw byte output (-want +got):\n%s", diff) + } + }) + } +} + func TestRouteMessageUnmarshalBinaryErrors(t *testing.T) { skipBigEndian(t) From 56a462940019e1600ef605b2636177effdb87fc3 Mon Sep 17 00:00:00 2001 From: Matt Layher Date: Wed, 18 Nov 2020 15:26:52 -0500 Subject: [PATCH 3/4] rtnetlink/testdata: add more go-fuzz corpus files from route message fuzzing Signed-off-by: Matt Layher --- .../015234b16d15fc9a8d0087ebcbabf42ed76c0812-38 | Bin 0 -> 564 bytes .../049f49dc2b6c163d5faf1ded2c621fd1a28c9747-38 | Bin 0 -> 564 bytes .../082652416315336b5ba00681f7a743ccbbcbdd71-39 | Bin 0 -> 564 bytes .../1820dbf6107ca7b5c9a0467c4d9303de5d983334-36 | Bin 0 -> 564 bytes .../22050367926486cb43405d88b376404852959eb0-37 | Bin 0 -> 564 bytes .../2b10146eb2804173932f2f25df49dcde84bd5422-39 | Bin 0 -> 564 bytes .../2bf9c12550df885e9b2f0066bdaa24d693ba358b-38 | Bin 0 -> 564 bytes .../2e9520c3b8fd2b783473a53ce62ed06a80684085-39 | Bin 0 -> 564 bytes .../3dc09ec53e9c6aaee007fa6d1bc15e94fffbc71d-40 | Bin 0 -> 564 bytes .../5171ca7f61ac7a502d3d95b7939f6484604d76a4-36 | Bin 0 -> 572 bytes .../579d7e8d1b834c1665bf8d262f3db3ef0d15f768-41 | Bin 0 -> 564 bytes .../57c84d561021cf943fbe5f8e16fb4779a0f28565-39 | Bin 0 -> 564 bytes .../62b920726253e633e85f93860b81a7cbb9a9d2d2-44 | Bin 0 -> 564 bytes .../6e7731a90348ac8f9a9b796a36b0d0b69626c649-40 | Bin 0 -> 564 bytes .../793b71b44e38d3dd13bac21a7122660593abe93e-40 | Bin 0 -> 564 bytes .../7c9c703ad40808292786df199ad7b19c9e62ef41-37 | Bin 0 -> 564 bytes .../7d3d6e6c965f90001b7c070c3b0a13b6eaf7a7b2-38 | Bin 0 -> 564 bytes .../897184d5d21106fd90c7fb106e3b6bc2a82cc747-42 | Bin 0 -> 564 bytes .../8b3a1a36b36ef5bc3b65aec5ac39b6147bdd7827-36 | Bin 0 -> 564 bytes .../8c17bb9286605de46b6821387afce1ec5deb05eb-43 | Bin 0 -> 564 bytes .../8f433f0523d2446a2d89543e110eb2e4d9c32574-45 | Bin 0 -> 564 bytes .../91be8558028512ff8b8347a5cb2f1fc3d638d2a5-37 | Bin 0 -> 564 bytes .../92d4fec98c3d3bfa639ee7b8eef2cc053ce28371-40 | Bin 0 -> 564 bytes .../9995561d583953138ccfd0e503281ceb1ce41303-43 | Bin 0 -> 564 bytes .../a19f5e2491ee591b9b56a677774959ba11cc3904-41 | Bin 0 -> 564 bytes .../ae8252330686905fb5ca04487bcce1495d049916-39 | Bin 0 -> 564 bytes .../ba740bcd54cbcd72e1ee257b491e12b0393688f7-37 | Bin 0 -> 572 bytes .../bf2de846441c88778157887d19dd31dcfec04275-41 | Bin 0 -> 564 bytes .../c786db5f13f18bdf03cdf0a0960633d80228f1ba-45 | Bin 0 -> 564 bytes .../c9fa1541d79005ea684b524b509412ac99bf0922-37 | Bin 0 -> 564 bytes .../ce8e84d605fbd5e56c4228047ebb0df33d419f9a-44 | Bin 0 -> 564 bytes .../d90dbd3bc30144653fa216693e1da2371b75e35c-37 | Bin 0 -> 572 bytes .../e9f13f887905c098392e3e07bb1c1e0dec1adb72-42 | Bin 0 -> 564 bytes .../f1a6fc940fa8898d872272a80983757b5c0d7022-43 | Bin 0 -> 564 bytes .../fe9fabd89fb613484e6ba2c4cf7126497ec94718-36 | Bin 0 -> 564 bytes 35 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 testdata/corpus/015234b16d15fc9a8d0087ebcbabf42ed76c0812-38 create mode 100644 testdata/corpus/049f49dc2b6c163d5faf1ded2c621fd1a28c9747-38 create mode 100644 testdata/corpus/082652416315336b5ba00681f7a743ccbbcbdd71-39 create mode 100644 testdata/corpus/1820dbf6107ca7b5c9a0467c4d9303de5d983334-36 create mode 100644 testdata/corpus/22050367926486cb43405d88b376404852959eb0-37 create mode 100644 testdata/corpus/2b10146eb2804173932f2f25df49dcde84bd5422-39 create mode 100644 testdata/corpus/2bf9c12550df885e9b2f0066bdaa24d693ba358b-38 create mode 100644 testdata/corpus/2e9520c3b8fd2b783473a53ce62ed06a80684085-39 create mode 100644 testdata/corpus/3dc09ec53e9c6aaee007fa6d1bc15e94fffbc71d-40 create mode 100644 testdata/corpus/5171ca7f61ac7a502d3d95b7939f6484604d76a4-36 create mode 100644 testdata/corpus/579d7e8d1b834c1665bf8d262f3db3ef0d15f768-41 create mode 100644 testdata/corpus/57c84d561021cf943fbe5f8e16fb4779a0f28565-39 create mode 100644 testdata/corpus/62b920726253e633e85f93860b81a7cbb9a9d2d2-44 create mode 100644 testdata/corpus/6e7731a90348ac8f9a9b796a36b0d0b69626c649-40 create mode 100644 testdata/corpus/793b71b44e38d3dd13bac21a7122660593abe93e-40 create mode 100644 testdata/corpus/7c9c703ad40808292786df199ad7b19c9e62ef41-37 create mode 100644 testdata/corpus/7d3d6e6c965f90001b7c070c3b0a13b6eaf7a7b2-38 create mode 100644 testdata/corpus/897184d5d21106fd90c7fb106e3b6bc2a82cc747-42 create mode 100644 testdata/corpus/8b3a1a36b36ef5bc3b65aec5ac39b6147bdd7827-36 create mode 100644 testdata/corpus/8c17bb9286605de46b6821387afce1ec5deb05eb-43 create mode 100644 testdata/corpus/8f433f0523d2446a2d89543e110eb2e4d9c32574-45 create mode 100644 testdata/corpus/91be8558028512ff8b8347a5cb2f1fc3d638d2a5-37 create mode 100644 testdata/corpus/92d4fec98c3d3bfa639ee7b8eef2cc053ce28371-40 create mode 100644 testdata/corpus/9995561d583953138ccfd0e503281ceb1ce41303-43 create mode 100644 testdata/corpus/a19f5e2491ee591b9b56a677774959ba11cc3904-41 create mode 100644 testdata/corpus/ae8252330686905fb5ca04487bcce1495d049916-39 create mode 100644 testdata/corpus/ba740bcd54cbcd72e1ee257b491e12b0393688f7-37 create mode 100644 testdata/corpus/bf2de846441c88778157887d19dd31dcfec04275-41 create mode 100644 testdata/corpus/c786db5f13f18bdf03cdf0a0960633d80228f1ba-45 create mode 100644 testdata/corpus/c9fa1541d79005ea684b524b509412ac99bf0922-37 create mode 100644 testdata/corpus/ce8e84d605fbd5e56c4228047ebb0df33d419f9a-44 create mode 100644 testdata/corpus/d90dbd3bc30144653fa216693e1da2371b75e35c-37 create mode 100644 testdata/corpus/e9f13f887905c098392e3e07bb1c1e0dec1adb72-42 create mode 100644 testdata/corpus/f1a6fc940fa8898d872272a80983757b5c0d7022-43 create mode 100644 testdata/corpus/fe9fabd89fb613484e6ba2c4cf7126497ec94718-36 diff --git a/testdata/corpus/015234b16d15fc9a8d0087ebcbabf42ed76c0812-38 b/testdata/corpus/015234b16d15fc9a8d0087ebcbabf42ed76c0812-38 new file mode 100644 index 0000000000000000000000000000000000000000..52ac62515cc5f11f25609a657f55639a7fdeaa5f GIT binary patch literal 564 zcmaFM)L8fb|C?8r8Rj@@FmW=dFj+Bx00#prh;kHRU}Xfc1sDvFXqNvU803-o5P3ER zQ8aa|3@=dhA;TI3Vdm^QQogAcT1ltJMIPD=2CJ literal 0 HcmV?d00001 diff --git a/testdata/corpus/082652416315336b5ba00681f7a743ccbbcbdd71-39 b/testdata/corpus/082652416315336b5ba00681f7a743ccbbcbdd71-39 new file mode 100644 index 0000000000000000000000000000000000000000..8cfaa680a7b9ad9e60408cc527041665a1004290 GIT binary patch literal 564 zcmaFM)L8fb|C?8r8Rj@@FmW=dFj+Bx00#prh;kHRU}Xfc1sDvFXqNvU803-o5P3ER zQ3gg7b*v08(D*QO;Nr~4=Azp}zJ6ThvoOeS2Kfg_W4IsFpV-t{VATh=56!=Dab|4c hXaEmaxH_Erv4;~}A2=Mv;O4=?8Aij^;WD2DaR6NcDy#qi literal 0 HcmV?d00001 diff --git a/testdata/corpus/1820dbf6107ca7b5c9a0467c4d9303de5d983334-36 b/testdata/corpus/1820dbf6107ca7b5c9a0467c4d9303de5d983334-36 new file mode 100644 index 0000000000000000000000000000000000000000..dfe5553ea3861d6b076c23cda7e7b741a8aa2d83 GIT binary patch literal 564 zcmb1Q_+R(`|C?8r8Rj@@FmW=dFjz5w00#r>|9S=nM-c{AMj)F(fWZKTW?_&=;iJpL z_%G1(VTd!MnhTSM(d6of>q9di=581bvj-PVtU9=TX#RzZqqzg!KDas(^~3d1YCbM| Hv4{fz0+J~m literal 0 HcmV?d00001 diff --git a/testdata/corpus/22050367926486cb43405d88b376404852959eb0-37 b/testdata/corpus/22050367926486cb43405d88b376404852959eb0-37 new file mode 100644 index 0000000000000000000000000000000000000000..34f1dc4d7269b6d1206b2aae0020a90c915afbf1 GIT binary patch literal 564 zcmaFM)L8fb|C?8r8Rj@@FmW=dFj+Bx00#prh;kHRU}Xfc1sDvFXqNvU803-o5P3ER zQ8aa|3@=dhA-=!)Su$BiRc8uD2;B literal 0 HcmV?d00001 diff --git a/testdata/corpus/2b10146eb2804173932f2f25df49dcde84bd5422-39 b/testdata/corpus/2b10146eb2804173932f2f25df49dcde84bd5422-39 new file mode 100644 index 0000000000000000000000000000000000000000..16b1d049871bb7da36eef2e551dc0a8bd7dc4c9c GIT binary patch literal 564 zcmaFM)L8fb|C?8r8Rj@@FmW=dFj+Bx00#prh;kHRU}Xfc1sDvFXqNvU803-o5P3ER zQ3gg7b*v08(D*QO;Nr~4=Azp}zJ6ThvoOeS2Kfg_W4IsFpV-t{VATh=56!=Dab|4c lXaEmaxH_Erv4;~}A2=MvfKkQ>jyqU5!)UlVT;`J?4gf@BDr^7% literal 0 HcmV?d00001 diff --git a/testdata/corpus/2bf9c12550df885e9b2f0066bdaa24d693ba358b-38 b/testdata/corpus/2bf9c12550df885e9b2f0066bdaa24d693ba358b-38 new file mode 100644 index 0000000000000000000000000000000000000000..b0952714978f028ad20c5ecab19fbd1696c1ab84 GIT binary patch literal 564 zcmb1Q_+R(`|C?8r8Rj@@FmW=dFjz5w00)B@h;kHRU}fZBU}X?sFhHSM801m-=<+cB z3p9Ng;>FjS+N1~(mK3Km!5l83n-M#JpEMZ?sIq1lhF9%vr}3j-6-EigZ! jx(km6VNR% lKcTt{mwRCPL4J6_@P7Z^I3TVgO)nv{VRpdP;R;KF;sCx+E6o4^ literal 0 HcmV?d00001 diff --git a/testdata/corpus/5171ca7f61ac7a502d3d95b7939f6484604d76a4-36 b/testdata/corpus/5171ca7f61ac7a502d3d95b7939f6484604d76a4-36 new file mode 100644 index 0000000000000000000000000000000000000000..1fcc726286c71c2ea2f0806f0edde91bbbd8b54f GIT binary patch literal 572 zcmb1Q_+R(`|C?8r8Rj@@FmW=dFjz4#FbFVkFt7q?21gMFRz?t8fWZKTW?_&=;iJpL z_%G1(VTd!MnhTSM(WK}%KyoKsADa0vcf)9yJ-BF)It8G)!Z`c^(+9T?O&w5N0UUm4 j?ttlo(RlPj!Wpig10~$y`rz`|!xOF!(|suBk>VZzowz7E literal 0 HcmV?d00001 diff --git a/testdata/corpus/579d7e8d1b834c1665bf8d262f3db3ef0d15f768-41 b/testdata/corpus/579d7e8d1b834c1665bf8d262f3db3ef0d15f768-41 new file mode 100644 index 0000000000000000000000000000000000000000..56aa1fbd1ee2a830504ae50831c9f00a7bc243e4 GIT binary patch literal 564 zcmaFM)L8fb|C?8r8Rj@@FmW=dFflN2Fc>hhF^DpVFt9RmFt9QR0Qm@-<^Kl;c_cnq zo*kqfRUIqC3lx0_bKv64$mSyCVdlWqp_v00$DtpWJPXv_FdAkLh$iHIZ1UL5L4*^+ sKXCVe{lNeaC%8B>D^~jGP6b&F0H@R_k^lez literal 0 HcmV?d00001 diff --git a/testdata/corpus/57c84d561021cf943fbe5f8e16fb4779a0f28565-39 b/testdata/corpus/57c84d561021cf943fbe5f8e16fb4779a0f28565-39 new file mode 100644 index 0000000000000000000000000000000000000000..d66a4318cf5138714e0b0ee1ac53d44a8220a1ec GIT binary patch literal 564 zcmaFM)L8fb|C?8r8Rj@@FmW=dFflN2Ft9QJfujfmD;L4FIE@D0lz> literal 0 HcmV?d00001 diff --git a/testdata/corpus/62b920726253e633e85f93860b81a7cbb9a9d2d2-44 b/testdata/corpus/62b920726253e633e85f93860b81a7cbb9a9d2d2-44 new file mode 100644 index 0000000000000000000000000000000000000000..f99b00b94f0e408ec1518260b276adc8581bc334 GIT binary patch literal 564 zcmaFM)L8fb|C?8r8Rj@@FmW=dFj+Bx00#prh;kHRU}Xfc1sDvFXqNvU801;e#n~7{ z85mL2u`;|si!&pei*66Hesd)Ik;HN6$7MbXgZyTYyMZ){c`$dO)0pZku literal 0 HcmV?d00001 diff --git a/testdata/corpus/6e7731a90348ac8f9a9b796a36b0d0b69626c649-40 b/testdata/corpus/6e7731a90348ac8f9a9b796a36b0d0b69626c649-40 new file mode 100644 index 0000000000000000000000000000000000000000..ae4a05765a07d8057202a0c10729c0ab7acf3201 GIT binary patch literal 564 zcmaFM)L8fb|C?8r8Rj@@FmW=dFj+Bx00#prh;kHRU}Xfc1sDvFXqNvU803-o5P3ER zQ3gg7b*v08(D*QO;Nr~4=Azp}zJ6ThvoOeS2Kfg_W4IsFpV-t{VATh=56!=Dab|4c lXaEmaxH_Erv4;~}A2=MvfKkQ-jyqU5!)UlVT;`J?4gf^ODs2D& literal 0 HcmV?d00001 diff --git a/testdata/corpus/793b71b44e38d3dd13bac21a7122660593abe93e-40 b/testdata/corpus/793b71b44e38d3dd13bac21a7122660593abe93e-40 new file mode 100644 index 0000000000000000000000000000000000000000..fbff56c8f24e6cb491bb3f066f9647c2e4fe1d3d GIT binary patch literal 564 zcmaFM)L8fb|C?8r8Rj@@FmW=dFj+Bx00#prh;kHRU}Xfc1sDvFXqNvU803-o5P3ER zQ3gg7b*v08(D*QO;Nr~4=Azp}zJ6ThvoOeS2Kfg_W4IsFpV-t{VATh=56!=Dab|4c jXaEmaxH_Erv4;~}A21wQ8N}e`!NM6v!`0z3p9FCLTgob_ literal 0 HcmV?d00001 diff --git a/testdata/corpus/7c9c703ad40808292786df199ad7b19c9e62ef41-37 b/testdata/corpus/7c9c703ad40808292786df199ad7b19c9e62ef41-37 new file mode 100644 index 0000000000000000000000000000000000000000..3292cb89ca502c655951a686f7253e15f8ba0324 GIT binary patch literal 564 zcmb1Q_+R(`|C?8r8Rj@@FmW=dFjz5w00#prh;kHRU}Xfc1sDwAv;dIL!XOXlqst@n zUm)p&i9^Jo<}oA8g~=n+*z|+s;o>;-ENVveoap)%`kHvhHc!TT5|sm=ncKDd2o x{)LM(vkG8_qX9fz;p%Ye#~w~_eZX+cU=RaF8520}(ER~dhs%5vaYnrH1^|KDD&GJA literal 0 HcmV?d00001 diff --git a/testdata/corpus/8b3a1a36b36ef5bc3b65aec5ac39b6147bdd7827-36 b/testdata/corpus/8b3a1a36b36ef5bc3b65aec5ac39b6147bdd7827-36 new file mode 100644 index 0000000000000000000000000000000000000000..d0ca030a43d55f186adbae0a48278c4b779937fd GIT binary patch literal 564 zcmaFM)L8fb|C?8r8Rj@@FmW=dFj+Bx00#prh;kHRU}Xfc1sDvFXqNvU803-oFnLil zb*v08Q1rpnA&E01n~RW#*+;H^xIQ%VS)lHQ(J*^((Zs5Q+lS^~xHvPma5R927hD}q V{n*0^t`E(h=>CDL!(~1R;sB2qDe?dS literal 0 HcmV?d00001 diff --git a/testdata/corpus/8c17bb9286605de46b6821387afce1ec5deb05eb-43 b/testdata/corpus/8c17bb9286605de46b6821387afce1ec5deb05eb-43 new file mode 100644 index 0000000000000000000000000000000000000000..251c045fabba3e86188d181bfb888c8e4fe992e4 GIT binary patch literal 564 zcmaFM)L8fb|C?8r8Rj@@FmW=dFj+Bx00#prh;kHRU}Xfc1sDvFXqNvU803-o5P3ER zQ3gg7b*v08(D*QO;Nr~4=Azq!tlu2PK0^9&$+IxXZwC1XNTZksa~C>|sm=ncKDd2o z{)LM(vkG8_qX9fz;p%Ye#~w~_eZX+cU=RaF8520}(ER~dhs%5i!&pei*66Hesd)Ik;HN6$7MbXgZyTYyMZ){c`$dO)0pZku;0(uEZq|b3KfP*@KIQsS`u9A6-4rJ_Z&BCZJnjenNE@ hF89F90r}wt!~6YvpEhvpaJ#Q|@SE2aPd literal 0 HcmV?d00001 diff --git a/testdata/corpus/92d4fec98c3d3bfa639ee7b8eef2cc053ce28371-40 b/testdata/corpus/92d4fec98c3d3bfa639ee7b8eef2cc053ce28371-40 new file mode 100644 index 0000000000000000000000000000000000000000..f905ce35867e5d45394185365a85cfd718179b3b GIT binary patch literal 564 zcmaFM)L8fb|C?8r8Rj@@FmW=dFflN2Fc>hhF^DpVFt9RmFt9QR0Qm@-<^Kl;c_cnW z9;6;s9V^2N6nzMD;Nr~4<|5=_=D^jVnFANcp&yq#3)I~(8fFiOCggr>^4QElgcHI) oaQA@y!2k~@xHvPma5lhHM`}2*Vuml8KLl_DAuMR%PDHjE0I@VEegFUf literal 0 HcmV?d00001 diff --git a/testdata/corpus/9995561d583953138ccfd0e503281ceb1ce41303-43 b/testdata/corpus/9995561d583953138ccfd0e503281ceb1ce41303-43 new file mode 100644 index 0000000000000000000000000000000000000000..809d65a9a8c6030154428f6d0eebbeea30b8ff92 GIT binary patch literal 564 zcmaFM)L8fb|C?8r8Rj@@FmW=dFj+Bx00#prh;kHRU}Xfc1sDvFXqNvU803-o5P3ER zQ3gg7b*v08(D*QO;Nr~4=Azq!tlu2PK0^9&$+IxXZwC1XNTZksa~C>|sm=ncKDd2o z{)LM(vkG8_qX9fz;p%Ye#~w~_eZX+cU=RaF8520}(ER~dhs%5i!&pei*66Hesd)Ik;HN6$8J6Y&>!-fLGEV3;(m1hK-HnxE5KlZ z#)r5cZXcR|;o{7!0+{9-z{3@;4yS(X;q>C8KEyr1aL8Z~14bDmIPPHK45P7|&xj*_ K(8U>1+z9{y;w#kv literal 0 HcmV?d00001 diff --git a/testdata/corpus/c9fa1541d79005ea684b524b509412ac99bf0922-37 b/testdata/corpus/c9fa1541d79005ea684b524b509412ac99bf0922-37 new file mode 100644 index 0000000000000000000000000000000000000000..252a41dbfa416e7a1cda43f46551f7efd6efe469 GIT binary patch literal 564 zcmaFM)L8fb|C?8r8Rj@@FmW=dFj+Bx00#prh;kHRU}Xfc1sDvFXqNvU803-o5P3ER zQ8aa|3@=dhArS9K_(}q5B7}4ww5#5C;H~4JrWu literal 0 HcmV?d00001 diff --git a/testdata/corpus/ce8e84d605fbd5e56c4228047ebb0df33d419f9a-44 b/testdata/corpus/ce8e84d605fbd5e56c4228047ebb0df33d419f9a-44 new file mode 100644 index 0000000000000000000000000000000000000000..2155d4bcd9370f679e323af81f943a4f83a7936c GIT binary patch literal 564 zcmaFM)L8fb|C?8r8Rj@@FmW=dFj+Bx00#prh;kHRU}Xfc1sDvFXqNvU801;e#n~7{ z85mL2u`;|si!&pei*66Hesd)Ik;HN6$8J6Y&>!-fLGEV3;(m1hK-HnxE5KlZ z#)r5cZXcR|;o{7!0+{9-z{3@;4yS(X;q>C8KEyr1aL8Z~14bDWIPPHK45P7|&xj*_ K(8U>1+z9{zL@U++ literal 0 HcmV?d00001 diff --git a/testdata/corpus/d90dbd3bc30144653fa216693e1da2371b75e35c-37 b/testdata/corpus/d90dbd3bc30144653fa216693e1da2371b75e35c-37 new file mode 100644 index 0000000000000000000000000000000000000000..f94f2623912fa319b04133011e9bfba1f83816ed GIT binary patch literal 572 zcmb1Q_+R(`|C?8r8Rj@@FmW=dFjz4#FbFVkFt7q?21gMFRz?t8fWZKTW?_(r@;Ok% z(bc^`(+87>i!-B|3zLV@aCK@%LFn7afm_4{?kU9mRK4CQb(bdE4 zLsJJ7R{)0}k~^`5CpP^c|GZ#;hA&({YIwu-!R4`sCtMwp`yl2MuO8%XxH&-k09lwQ AIsgCw literal 0 HcmV?d00001 diff --git a/testdata/corpus/e9f13f887905c098392e3e07bb1c1e0dec1adb72-42 b/testdata/corpus/e9f13f887905c098392e3e07bb1c1e0dec1adb72-42 new file mode 100644 index 0000000000000000000000000000000000000000..f4b095e12656f27b30b2ba2672176d64ae9f9834 GIT binary patch literal 564 zcmb1Q_+R(`|C?8r8Rj@@FmW=dFjz5w00)B@h;kGG(i{w|3<3-WjL0+#gFFf!T^`1N zfu;{boEc~?)Ff7*T@YK)X`)QQ;!3zakS$2^FxSIqn5%HnFm*6@;Zg^*kAa1O31}D0 lPpJ0dau3WrkQ-kxyx+e!4v6bW(@V%~m>qC+XfZ>)H~`UyE7<@5 literal 0 HcmV?d00001 diff --git a/testdata/corpus/f1a6fc940fa8898d872272a80983757b5c0d7022-43 b/testdata/corpus/f1a6fc940fa8898d872272a80983757b5c0d7022-43 new file mode 100644 index 0000000000000000000000000000000000000000..26c907d0797c5c57d79bf5b76fbd483b6cc7f356 GIT binary patch literal 564 zcmaFM)L8fb|C?8r8Rj@@FmW=dFj+Bx00#prh;kHRU}Xfc1sDvFXqNvU801;e#n~7{ z85mL2u`;|si!&pei*66Hesd)Ik;HN6$7MbXgZyTYyMZ){c`$dO)0pZkusTaDe#>t`3*`NDv1Ai$^K& literal 0 HcmV?d00001 From beb2a7965b1cec926d54a93db8a188f34723f4fc Mon Sep 17 00:00:00 2001 From: Matt Layher Date: Wed, 18 Nov 2020 15:30:48 -0500 Subject: [PATCH 4/4] internal/unix: fix Mac build Signed-off-by: Matt Layher --- internal/unix/types_other.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/unix/types_other.go b/internal/unix/types_other.go index 76f1bf4..3fbd62b 100644 --- a/internal/unix/types_other.go +++ b/internal/unix/types_other.go @@ -61,6 +61,9 @@ const ( IFLA_XDP_FLAGS = 0x3 IFLA_XDP_PROG_ID = 0x4 IFLA_XDP_EXPECTED_FD = 0x8 + LWTUNNEL_ENCAP_MPLS = 0x1 + MPLS_IPTUNNEL_DST = 0x1 + MPLS_IPTUNNEL_TTL = 0x2 NDA_UNSPEC = 0x0 NDA_DST = 0x1 NDA_LLADDR = 0x2 @@ -68,6 +71,8 @@ const ( NDA_IFINDEX = 0x8 RTA_UNSPEC = 0x0 RTA_DST = 0x1 + RTA_ENCAP = 0x16 + RTA_ENCAP_TYPE = 0x15 RTA_PREFSRC = 0x7 RTA_GATEWAY = 0x5 RTA_OIF = 0x4