diff --git a/.gitignore b/.gitignore index bb99a56915e4f0f56746244dbb3affd0ee20712a..c97ea2a6069695630909b3884565f91629e3965e 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,8 @@ # 'go build' binary bio-rd +examples/bgp +examples/bmp # bazel directories /bazel-* diff --git a/protocols/bgp/packet/decoder.go b/protocols/bgp/packet/decoder.go index 494b1f39bebedbe6058b62d19daba23c62cc6a43..a6f226e49150210b4e3b781a30c571d18b191048 100644 --- a/protocols/bgp/packet/decoder.go +++ b/protocols/bgp/packet/decoder.go @@ -49,7 +49,7 @@ func decodeUpdateMsg(buf *bytes.Buffer, l uint16, opt *DecodeOptions) (*BGPUpdat return msg, err } - msg.WithdrawnRoutes, err = decodeNLRIs(buf, uint16(msg.WithdrawnRoutesLen)) + msg.WithdrawnRoutes, err = decodeNLRIs(buf, uint16(msg.WithdrawnRoutesLen), IPv4AFI) if err != nil { return msg, err } @@ -66,7 +66,7 @@ func decodeUpdateMsg(buf *bytes.Buffer, l uint16, opt *DecodeOptions) (*BGPUpdat nlriLen := uint16(l) - 4 - uint16(msg.TotalPathAttrLen) - uint16(msg.WithdrawnRoutesLen) if nlriLen > 0 { - msg.NLRI, err = decodeNLRIs(buf, nlriLen) + msg.NLRI, err = decodeNLRIs(buf, nlriLen, IPv4AFI) if err != nil { return msg, err } diff --git a/protocols/bgp/packet/decoder_test.go b/protocols/bgp/packet/decoder_test.go index d76507bc74c0fdc6be67bf2cec98ee3d0bbba23a..db29eb84a0c7d1995b21044cf9407196ed8828b2 100644 --- a/protocols/bgp/packet/decoder_test.go +++ b/protocols/bgp/packet/decoder_test.go @@ -6,12 +6,10 @@ import ( "strconv" "testing" - "github.com/bio-routing/bio-rd/net" + bnet "github.com/bio-routing/bio-rd/net" "github.com/bio-routing/bio-rd/protocols/bgp/types" "github.com/stretchr/testify/assert" "github.com/taktv6/tflow2/convert" - - bnet "github.com/bio-routing/bio-rd/net" ) type test struct { @@ -211,11 +209,9 @@ func TestDecode(t *testing.T) { Body: &BGPUpdate{ WithdrawnRoutesLen: 5, WithdrawnRoutes: &NLRI{ - IP: strAddr("10.0.0.0"), - Pfxlen: 8, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(10, 0, 0, 0), 8), Next: &NLRI{ - IP: strAddr("192.168.0.0"), - Pfxlen: 16, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 0), 16), }, }, }, @@ -431,11 +427,9 @@ func TestDecodeUpdateMsg(t *testing.T) { expected: &BGPUpdate{ WithdrawnRoutesLen: 5, WithdrawnRoutes: &NLRI{ - IP: strAddr("10.0.0.0"), - Pfxlen: 8, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(10, 0, 0, 0), 8), Next: &NLRI{ - IP: strAddr("192.168.0.0"), - Pfxlen: 16, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 0), 16), }, }, }, @@ -457,11 +451,9 @@ func TestDecodeUpdateMsg(t *testing.T) { expected: &BGPUpdate{ WithdrawnRoutesLen: 5, WithdrawnRoutes: &NLRI{ - IP: strAddr("10.0.0.0"), - Pfxlen: 8, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(10, 0, 0, 0), 8), Next: &NLRI{ - IP: strAddr("192.168.0.0"), - Pfxlen: 16, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 0), 16), }, }, TotalPathAttrLen: 5, @@ -499,11 +491,9 @@ func TestDecodeUpdateMsg(t *testing.T) { expected: &BGPUpdate{ WithdrawnRoutesLen: 5, WithdrawnRoutes: &NLRI{ - IP: strAddr("10.0.0.0"), - Pfxlen: 8, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(10, 0, 0, 0), 8), Next: &NLRI{ - IP: strAddr("192.168.0.0"), - Pfxlen: 16, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 0), 16), }, }, TotalPathAttrLen: 14, @@ -602,11 +592,9 @@ func TestDecodeUpdateMsg(t *testing.T) { expected: &BGPUpdate{ WithdrawnRoutesLen: 5, WithdrawnRoutes: &NLRI{ - IP: strAddr("10.0.0.0"), - Pfxlen: 8, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(10, 0, 0, 0), 8), Next: &NLRI{ - IP: strAddr("192.168.0.0"), - Pfxlen: 16, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 0), 16), }, }, TotalPathAttrLen: 20, @@ -677,11 +665,9 @@ func TestDecodeUpdateMsg(t *testing.T) { expected: &BGPUpdate{ WithdrawnRoutesLen: 5, WithdrawnRoutes: &NLRI{ - IP: strAddr("10.0.0.0"), - Pfxlen: 8, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(10, 0, 0, 0), 8), Next: &NLRI{ - IP: strAddr("192.168.0.0"), - Pfxlen: 16, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 0), 16), }, }, TotalPathAttrLen: 27, @@ -768,11 +754,9 @@ func TestDecodeUpdateMsg(t *testing.T) { expected: &BGPUpdate{ WithdrawnRoutesLen: 5, WithdrawnRoutes: &NLRI{ - IP: strAddr("10.0.0.0"), - Pfxlen: 8, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(10, 0, 0, 0), 8), Next: &NLRI{ - IP: strAddr("192.168.0.0"), - Pfxlen: 16, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 0), 16), }, }, TotalPathAttrLen: 34, @@ -872,11 +856,9 @@ func TestDecodeUpdateMsg(t *testing.T) { expected: &BGPUpdate{ WithdrawnRoutesLen: 5, WithdrawnRoutes: &NLRI{ - IP: strAddr("10.0.0.0"), - Pfxlen: 8, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(10, 0, 0, 0), 8), Next: &NLRI{ - IP: strAddr("192.168.0.0"), - Pfxlen: 16, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 0), 16), }, }, TotalPathAttrLen: 41, @@ -988,11 +970,9 @@ func TestDecodeUpdateMsg(t *testing.T) { expected: &BGPUpdate{ WithdrawnRoutesLen: 5, WithdrawnRoutes: &NLRI{ - IP: strAddr("10.0.0.0"), - Pfxlen: 8, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(10, 0, 0, 0), 8), Next: &NLRI{ - IP: strAddr("192.168.0.0"), - Pfxlen: 16, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 0), 16), }, }, TotalPathAttrLen: 44, @@ -1120,11 +1100,9 @@ func TestDecodeUpdateMsg(t *testing.T) { expected: &BGPUpdate{ WithdrawnRoutesLen: 5, WithdrawnRoutes: &NLRI{ - IP: strAddr("10.0.0.0"), - Pfxlen: 8, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(10, 0, 0, 0), 8), Next: &NLRI{ - IP: strAddr("192.168.0.0"), - Pfxlen: 16, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 0), 16), }, }, TotalPathAttrLen: 53, @@ -1199,7 +1177,7 @@ func TestDecodeUpdateMsg(t *testing.T) { TypeCode: 7, Value: types.Aggregator{ ASN: uint16(258), - Address: strAddr("10.11.12.13"), + Address: bnet.IPv4FromOctets(10, 11, 12, 13).ToUint32(), }, }, }, @@ -1209,8 +1187,7 @@ func TestDecodeUpdateMsg(t *testing.T) { }, }, NLRI: &NLRI{ - Pfxlen: 8, - IP: strAddr("11.0.0.0"), + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(11, 0, 0, 0), 8), }, }, }, @@ -1292,11 +1269,9 @@ func TestDecodeUpdateMsg(t *testing.T) { expected: &BGPUpdate{ WithdrawnRoutesLen: 5, WithdrawnRoutes: &NLRI{ - IP: strAddr("10.0.0.0"), - Pfxlen: 8, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(10, 0, 0, 0), 8), Next: &NLRI{ - IP: strAddr("192.168.0.0"), - Pfxlen: 16, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 0), 16), }, }, TotalPathAttrLen: 16, @@ -1820,8 +1795,3 @@ func TestDecodeAddPathCapability(t *testing.T) { assert.Equal(t, test.expected, cap) } } - -func strAddr(s string) uint32 { - ret, _ := net.StrToAddr(s) - return ret -} diff --git a/protocols/bgp/packet/mp_reach_nlri.go b/protocols/bgp/packet/mp_reach_nlri.go index b08edca7a83d3d794b6411df58b8f8f85866a3f5..513bf5d40265adcca1e00e4186752139eddcd126 100644 --- a/protocols/bgp/packet/mp_reach_nlri.go +++ b/protocols/bgp/packet/mp_reach_nlri.go @@ -4,19 +4,17 @@ import ( "bytes" "fmt" - "github.com/taktv6/tflow2/convert" - bnet "github.com/bio-routing/bio-rd/net" "github.com/bio-routing/bio-rd/util/decode" + "github.com/taktv6/tflow2/convert" ) -// MultiProtocolReachNLRI represents network layer reachability information for one prefix of an IP address family (rfc4760) +// MultiProtocolReachNLRI represents network layer reachability information for an IP address family (rfc4760) type MultiProtocolReachNLRI struct { - AFI uint16 - SAFI uint8 - NextHop bnet.IP - Prefixes []bnet.Prefix - PathID uint32 + AFI uint16 + SAFI uint8 + NextHop bnet.IP + NLRI *NLRI } func (n *MultiProtocolReachNLRI) serialize(buf *bytes.Buffer, opt *EncodeOptions) uint16 { @@ -28,11 +26,13 @@ func (n *MultiProtocolReachNLRI) serialize(buf *bytes.Buffer, opt *EncodeOptions tempBuf.WriteByte(uint8(len(nextHop))) tempBuf.Write(nextHop) tempBuf.WriteByte(0) // RESERVED - for _, pfx := range n.Prefixes { + + for cur := n.NLRI; cur != nil; cur = cur.Next { if opt.UseAddPath { - tempBuf.Write(convert.Uint32Byte(n.PathID)) + n.NLRI.serializeAddPath(tempBuf) + } else { + n.NLRI.serialize(tempBuf) } - tempBuf.Write(serializePrefix(pfx)) } buf.Write(tempBuf.Bytes()) @@ -73,34 +73,18 @@ func deserializeMultiProtocolReachNLRI(b []byte) (MultiProtocolReachNLRI, error) } budget -= int(nextHopLength) - n.Prefixes = make([]bnet.Prefix, 0) if budget == 0 { return n, nil } variable = variable[1+nextHopLength:] // 1 <- RESERVED field - idx := uint16(0) - for idx < uint16(len(variable)) { - pfxLen := variable[idx] - numBytes := uint16(BytesInAddr(pfxLen)) - idx++ - - r := uint16(len(variable)) - idx - if r < numBytes { - return MultiProtocolReachNLRI{}, fmt.Errorf("expected %d bytes for NLRI, only %d remaining", numBytes, r) - } - - start := idx - end := idx + numBytes - pfx, err := deserializePrefix(variable[start:end], pfxLen, n.AFI) - if err != nil { - return MultiProtocolReachNLRI{}, err - } - n.Prefixes = append(n.Prefixes, pfx) - - idx = idx + numBytes + buf := bytes.NewBuffer(variable) + nlri, err := decodeNLRIs(buf, uint16(buf.Len()), n.AFI) + if err != nil { + return MultiProtocolReachNLRI{}, err } + n.NLRI = nlri return n, nil } diff --git a/protocols/bgp/packet/mp_reach_nlri_test.go b/protocols/bgp/packet/mp_reach_nlri_test.go index cb6e5b544333d76f3244c8ef6895acb40783f149..a4878cf7d161c03fa0947d238f2203707e6c369d 100644 --- a/protocols/bgp/packet/mp_reach_nlri_test.go +++ b/protocols/bgp/packet/mp_reach_nlri_test.go @@ -21,8 +21,8 @@ func TestSerializeMultiProtocolReachNLRI(t *testing.T) { AFI: IPv6AFI, SAFI: UnicastSAFI, NextHop: bnet.IPv6FromBlocks(0x2001, 0x678, 0x1e0, 0, 0, 0, 0, 0x2), - Prefixes: []bnet.Prefix{ - bnet.NewPfx(bnet.IPv6FromBlocks(0x2600, 0x6, 0xff05, 0, 0, 0, 0, 0), 48), + NLRI: &NLRI{ + Prefix: bnet.NewPfx(bnet.IPv6FromBlocks(0x2600, 0x6, 0xff05, 0, 0, 0, 0, 0), 48), }, }, expected: []byte{ @@ -39,10 +39,10 @@ func TestSerializeMultiProtocolReachNLRI(t *testing.T) { AFI: IPv6AFI, SAFI: UnicastSAFI, NextHop: bnet.IPv6FromBlocks(0x2001, 0x678, 0x1e0, 0, 0, 0, 0, 0x2), - Prefixes: []bnet.Prefix{ - bnet.NewPfx(bnet.IPv6FromBlocks(0x2600, 0x6, 0xff05, 0, 0, 0, 0, 0), 48), + NLRI: &NLRI{ + Prefix: bnet.NewPfx(bnet.IPv6FromBlocks(0x2600, 0x6, 0xff05, 0, 0, 0, 0, 0), 48), + PathIdentifier: 100, }, - PathID: 100, }, expected: []byte{ 0x00, 0x02, // AFI diff --git a/protocols/bgp/packet/nlri.go b/protocols/bgp/packet/nlri.go index c11b47bf8191a2f57b595cc6b6e9b78ff3d3fe6e..9406c776d2dcadd66f96a4bd71220a6466d2ce31 100644 --- a/protocols/bgp/packet/nlri.go +++ b/protocols/bgp/packet/nlri.go @@ -4,20 +4,18 @@ import ( "bytes" "fmt" "math" - "net" - "github.com/bio-routing/bio-rd/util/decode" + bnet "github.com/bio-routing/bio-rd/net" "github.com/taktv6/tflow2/convert" ) type NLRI struct { PathIdentifier uint32 - IP uint32 - Pfxlen uint8 + Prefix bnet.Prefix Next *NLRI } -func decodeNLRIs(buf *bytes.Buffer, length uint16) (*NLRI, error) { +func decodeNLRIs(buf *bytes.Buffer, length uint16, afi uint16) (*NLRI, error) { var ret *NLRI var eol *NLRI var nlri *NLRI @@ -26,7 +24,7 @@ func decodeNLRIs(buf *bytes.Buffer, length uint16) (*NLRI, error) { p := uint16(0) for p < length { - nlri, consumed, err = decodeNLRI(buf) + nlri, consumed, err = decodeNLRI(buf, afi) if err != nil { return nil, fmt.Errorf("Unable to decode NLRI: %v", err) } @@ -45,53 +43,48 @@ func decodeNLRIs(buf *bytes.Buffer, length uint16) (*NLRI, error) { return ret, nil } -func decodeNLRI(buf *bytes.Buffer) (*NLRI, uint8, error) { - var addr [4]byte +func decodeNLRI(buf *bytes.Buffer, afi uint16) (*NLRI, uint8, error) { nlri := &NLRI{} - err := decode.Decode(buf, []interface{}{&nlri.Pfxlen}) + consumed := uint8(0) + pfxLen, err := buf.ReadByte() if err != nil { - return nil, 0, err + return nil, consumed, err } + consumed++ - toCopy := uint8(math.Ceil(float64(nlri.Pfxlen) / float64(OctetLen))) - for i := uint8(0); i < net.IPv4len%OctetLen; i++ { - if i < toCopy { - err := decode.Decode(buf, []interface{}{&addr[i]}) - if err != nil { - return nil, 0, err - } - } else { - addr[i] = 0 - } + numBytes := uint8(BytesInAddr(pfxLen)) + bytes := make([]byte, numBytes) + + r, err := buf.Read(bytes) + consumed += uint8(r) + if r < int(numBytes) { + return nil, consumed, fmt.Errorf("expected %d bytes for NLRI, only %d remaining", numBytes, r) + } + + pfx, err := deserializePrefix(bytes, pfxLen, afi) + if err != nil { + return nil, consumed, err } - nlri.IP = fourBytesToUint32(addr) - return nlri, toCopy + 1, nil + nlri.Prefix = pfx + + return nlri, consumed, nil } func (n *NLRI) serialize(buf *bytes.Buffer) uint8 { - a := convert.Uint32Byte(n.IP) - - addr := [4]byte{a[0], a[1], a[2], a[3]} - nBytes := BytesInAddr(n.Pfxlen) + buf.WriteByte(n.Prefix.Pfxlen()) + b := n.Prefix.Addr().Bytes() - buf.WriteByte(n.Pfxlen) - buf.Write(addr[:nBytes]) + nBytes := BytesInAddr(n.Prefix.Pfxlen()) + buf.Write(b[:nBytes]) return nBytes + 1 } func (n *NLRI) serializeAddPath(buf *bytes.Buffer) uint8 { - a := convert.Uint32Byte(n.IP) - - addr := [4]byte{a[0], a[1], a[2], a[3]} - nBytes := BytesInAddr(n.Pfxlen) - buf.Write(convert.Uint32Byte(n.PathIdentifier)) - buf.WriteByte(n.Pfxlen) - buf.Write(addr[:nBytes]) - return nBytes + 4 + return uint8(n.serialize(buf) + 4) } // BytesInAddr gets the amount of bytes needed to encode an NLRI of prefix length pfxlen diff --git a/protocols/bgp/packet/nlri_test.go b/protocols/bgp/packet/nlri_test.go index 4cefc5adb3a664564ac201a81afc5efaebe015a8..bd4f6653c5e18b905abdb67b0d4ac176b6677a16 100644 --- a/protocols/bgp/packet/nlri_test.go +++ b/protocols/bgp/packet/nlri_test.go @@ -4,6 +4,7 @@ import ( "bytes" "testing" + bnet "github.com/bio-routing/bio-rd/net" "github.com/stretchr/testify/assert" ) @@ -23,14 +24,11 @@ func TestDecodeNLRIs(t *testing.T) { }, wantFail: false, expected: &NLRI{ - IP: strAddr("192.168.0.0"), - Pfxlen: 24, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 0), 24), Next: &NLRI{ - IP: strAddr("10.0.0.0"), - Pfxlen: 8, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(10, 0, 0, 0), 8), Next: &NLRI{ - IP: strAddr("172.16.0.0"), - Pfxlen: 17, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(172, 16, 0, 0), 17), }, }, }, @@ -48,7 +46,7 @@ func TestDecodeNLRIs(t *testing.T) { for _, test := range tests { buf := bytes.NewBuffer(test.input) - res, err := decodeNLRIs(buf, uint16(len(test.input))) + res, err := decodeNLRIs(buf, uint16(len(test.input)), IPv4AFI) if test.wantFail && err == nil { t.Errorf("Expected error did not happen for test %q", test.name) @@ -76,8 +74,7 @@ func TestDecodeNLRI(t *testing.T) { }, wantFail: false, expected: &NLRI{ - IP: strAddr("192.168.0.0"), - Pfxlen: 24, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 0), 24), }, }, { @@ -87,8 +84,7 @@ func TestDecodeNLRI(t *testing.T) { }, wantFail: false, expected: &NLRI{ - IP: strAddr("192.168.0.128"), - Pfxlen: 25, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 128), 25), }, }, { @@ -114,7 +110,7 @@ func TestDecodeNLRI(t *testing.T) { for _, test := range tests { buf := bytes.NewBuffer(test.input) - res, _, err := decodeNLRI(buf) + res, _, err := decodeNLRI(buf, IPv4AFI) if test.wantFail && err == nil { t.Errorf("Expected error did not happen for test %q", test.name) @@ -178,24 +174,21 @@ func TestNLRISerialize(t *testing.T) { { name: "Test #1", nlri: &NLRI{ - IP: strAddr("1.2.3.0"), - Pfxlen: 25, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(1, 2, 3, 0), 25), }, expected: []byte{25, 1, 2, 3, 0}, }, { name: "Test #2", nlri: &NLRI{ - IP: strAddr("1.2.3.0"), - Pfxlen: 24, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(1, 2, 3, 0), 24), }, expected: []byte{24, 1, 2, 3}, }, { name: "Test #3", nlri: &NLRI{ - IP: strAddr("100.200.128.0"), - Pfxlen: 17, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(100, 200, 128, 0), 17), }, expected: []byte{17, 100, 200, 128}, }, @@ -219,8 +212,7 @@ func TestNLRIAddPathSerialize(t *testing.T) { name: "Test #1", nlri: &NLRI{ PathIdentifier: 100, - IP: strAddr("1.2.3.0"), - Pfxlen: 25, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(1, 2, 3, 0), 25), }, expected: []byte{0, 0, 0, 100, 25, 1, 2, 3, 0}, }, @@ -228,8 +220,7 @@ func TestNLRIAddPathSerialize(t *testing.T) { name: "Test #2", nlri: &NLRI{ PathIdentifier: 100, - IP: strAddr("1.2.3.0"), - Pfxlen: 24, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(1, 2, 3, 0), 24), }, expected: []byte{0, 0, 0, 100, 24, 1, 2, 3}, }, @@ -237,8 +228,7 @@ func TestNLRIAddPathSerialize(t *testing.T) { name: "Test #3", nlri: &NLRI{ PathIdentifier: 100, - IP: strAddr("100.200.128.0"), - Pfxlen: 17, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(100, 200, 128, 0), 17), }, expected: []byte{0, 0, 0, 100, 17, 100, 200, 128}, }, diff --git a/protocols/bgp/packet/path_attributes_test.go b/protocols/bgp/packet/path_attributes_test.go index 958da99b783d20121e89fe4b85c4d213891bf550..2ddc92834c5592ab5ac30d5274712a389f543be4 100644 --- a/protocols/bgp/packet/path_attributes_test.go +++ b/protocols/bgp/packet/path_attributes_test.go @@ -640,7 +640,7 @@ func TestDecodeAggregator(t *testing.T) { Length: 6, Value: types.Aggregator{ ASN: 222, - Address: strAddr("10.20.30.40"), + Address: bnet.IPv4FromOctets(10, 20, 30, 40).ToUint32(), }, }, }, @@ -928,8 +928,8 @@ func TestDecodeMultiProtocolReachNLRI(t *testing.T) { AFI: IPv6AFI, SAFI: UnicastSAFI, NextHop: bnet.IPv6FromBlocks(0x2001, 0x678, 0x1e0, 0, 0, 0, 0, 0x2), - Prefixes: []bnet.Prefix{ - bnet.NewPfx(bnet.IPv6FromBlocks(0x2600, 0x6, 0xff05, 0, 0, 0, 0, 0), 48), + NLRI: &NLRI{ + Prefix: bnet.NewPfx(bnet.IPv6FromBlocks(0x2600, 0x6, 0xff05, 0, 0, 0, 0, 0), 48), }, }, }, @@ -961,10 +961,9 @@ func TestDecodeMultiProtocolReachNLRI(t *testing.T) { expected: &PathAttribute{ Length: 21, Value: MultiProtocolReachNLRI{ - AFI: IPv6AFI, - SAFI: UnicastSAFI, - NextHop: bnet.IPv6FromBlocks(0x2001, 0x678, 0x1e0, 0, 0, 0, 0, 0x2), - Prefixes: []bnet.Prefix{}, + AFI: IPv6AFI, + SAFI: UnicastSAFI, + NextHop: bnet.IPv6FromBlocks(0x2001, 0x678, 0x1e0, 0, 0, 0, 0, 0x2), }, }, }, @@ -1485,7 +1484,7 @@ func TestSerializeAggregator(t *testing.T) { TypeCode: AggregatorAttr, Value: types.Aggregator{ ASN: 174, - Address: strAddr("10.20.30.40"), + Address: bnet.IPv4FromOctets(10, 20, 30, 40).ToUint32(), }, }, expected: []byte{ @@ -1869,8 +1868,7 @@ func TestSerialize(t *testing.T) { name: "Withdraw only", msg: &BGPUpdate{ WithdrawnRoutes: &NLRI{ - IP: strAddr("100.110.120.0"), - Pfxlen: 24, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(100, 110, 120, 0), 24), }, }, expected: []byte{ @@ -1886,8 +1884,7 @@ func TestSerialize(t *testing.T) { name: "NLRI only", msg: &BGPUpdate{ NLRI: &NLRI{ - IP: strAddr("100.110.128.0"), - Pfxlen: 17, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(100, 110, 128, 0), 17), }, }, expected: []byte{ @@ -1925,11 +1922,9 @@ func TestSerialize(t *testing.T) { name: "Full test", msg: &BGPUpdate{ WithdrawnRoutes: &NLRI{ - IP: strAddr("10.0.0.0"), - Pfxlen: 8, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(10, 0, 0, 0), 8), Next: &NLRI{ - IP: strAddr("192.168.0.0"), - Pfxlen: 16, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 0), 16), }, }, PathAttributes: &PathAttribute{ @@ -1962,7 +1957,7 @@ func TestSerialize(t *testing.T) { TypeCode: AggregatorAttr, Value: types.Aggregator{ ASN: 200, - Address: strAddr("10.20.30.40"), + Address: bnet.IPv4FromOctets(10, 20, 30, 40).ToUint32(), }, }, }, @@ -1972,11 +1967,9 @@ func TestSerialize(t *testing.T) { }, }, NLRI: &NLRI{ - IP: strAddr("8.8.8.0"), - Pfxlen: 24, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(8, 8, 8, 0), 24), Next: &NLRI{ - IP: strAddr("185.65.240.0"), - Pfxlen: 22, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(185, 65, 240, 0), 22), }, }, }, @@ -2042,8 +2035,7 @@ func TestSerialize(t *testing.T) { name: "Reflected NLRI", msg: &BGPUpdate{ NLRI: &NLRI{ - IP: strAddr("100.110.128.0"), - Pfxlen: 17, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(100, 110, 128, 0), 17), }, PathAttributes: &PathAttribute{ TypeCode: OriginatorIDAttr, @@ -2112,8 +2104,7 @@ func TestSerializeAddPath(t *testing.T) { msg: &BGPUpdate{ WithdrawnRoutes: &NLRI{ PathIdentifier: 257, - IP: strAddr("100.110.120.0"), - Pfxlen: 24, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(100, 110, 120, 0), 24), }, }, expected: []byte{ @@ -2131,8 +2122,7 @@ func TestSerializeAddPath(t *testing.T) { msg: &BGPUpdate{ NLRI: &NLRI{ PathIdentifier: 257, - IP: strAddr("100.110.128.0"), - Pfxlen: 17, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(100, 110, 128, 0), 17), }, }, expected: []byte{ @@ -2171,11 +2161,9 @@ func TestSerializeAddPath(t *testing.T) { name: "Full test", msg: &BGPUpdate{ WithdrawnRoutes: &NLRI{ - IP: strAddr("10.0.0.0"), - Pfxlen: 8, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(10, 0, 0, 0), 8), Next: &NLRI{ - IP: strAddr("192.168.0.0"), - Pfxlen: 16, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 0), 16), }, }, PathAttributes: &PathAttribute{ @@ -2208,7 +2196,7 @@ func TestSerializeAddPath(t *testing.T) { TypeCode: AggregatorAttr, Value: types.Aggregator{ ASN: 200, - Address: strAddr("10.20.30.40"), + Address: bnet.IPv4FromOctets(10, 20, 30, 40).ToUint32(), }, }, }, @@ -2218,11 +2206,9 @@ func TestSerializeAddPath(t *testing.T) { }, }, NLRI: &NLRI{ - IP: strAddr("8.8.8.0"), - Pfxlen: 24, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(8, 8, 8, 0), 24), Next: &NLRI{ - IP: strAddr("185.65.240.0"), - Pfxlen: 22, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(185, 65, 240, 0), 22), }, }, }, diff --git a/protocols/bgp/server/fsm_address_family.go b/protocols/bgp/server/fsm_address_family.go index 092572c50463ff4109efa669f798e484d218e5ee..04aa26ab9ed70662bd854cbbbea6a3425d9929d7 100644 --- a/protocols/bgp/server/fsm_address_family.go +++ b/protocols/bgp/server/fsm_address_family.go @@ -107,19 +107,16 @@ func (f *fsmAddressFamily) processUpdate(u *packet.BGPUpdate) { func (f *fsmAddressFamily) withdraws(u *packet.BGPUpdate) { for r := u.WithdrawnRoutes; r != nil; r = r.Next { - pfx := bnet.NewPfx(bnet.IPv4(r.IP), r.Pfxlen) - f.adjRIBIn.RemovePath(pfx, nil) + f.adjRIBIn.RemovePath(r.Prefix, nil) } } func (f *fsmAddressFamily) updates(u *packet.BGPUpdate) { for r := u.NLRI; r != nil; r = r.Next { - pfx := bnet.NewPfx(bnet.IPv4(r.IP), r.Pfxlen) - path := f.newRoutePath() f.processAttributes(u.PathAttributes, path) - f.adjRIBIn.AddPath(pfx, path) + f.adjRIBIn.AddPath(r.Prefix, path) } } @@ -154,8 +151,8 @@ func (f *fsmAddressFamily) multiProtocolUpdate(path *route.Path, nlri packet.Mul path.BGPPath.NextHop = nlri.NextHop - for _, pfx := range nlri.Prefixes { - f.adjRIBIn.AddPath(pfx, path) + for n := nlri.NLRI; n != nil; n = n.Next { + f.adjRIBIn.AddPath(n.Prefix, path) } } diff --git a/protocols/bgp/server/update_helper_test.go b/protocols/bgp/server/update_helper_test.go index 86a70f64d5626c4cbb38fb4eca5b793d7a548093..fee9d895b8d491599eeaf5f4e9ba560eee5dc848 100644 --- a/protocols/bgp/server/update_helper_test.go +++ b/protocols/bgp/server/update_helper_test.go @@ -6,9 +6,8 @@ import ( "io" "testing" + bnet "github.com/bio-routing/bio-rd/net" "github.com/bio-routing/bio-rd/protocols/bgp/packet" - - "github.com/bio-routing/bio-rd/net" "github.com/stretchr/testify/assert" ) @@ -49,11 +48,9 @@ func TestSerializeAndSendUpdate(t *testing.T) { testUpdate: &packet.BGPUpdate{ WithdrawnRoutesLen: 5, WithdrawnRoutes: &packet.NLRI{ - IP: strAddr("10.0.0.0"), - Pfxlen: 8, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(10, 0, 0, 0), 8), Next: &packet.NLRI{ - IP: strAddr("192.168.0.0"), - Pfxlen: 16, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 0), 16), }, }, }, @@ -79,11 +76,9 @@ func TestSerializeAndSendUpdate(t *testing.T) { testUpdate: &packet.BGPUpdate{ WithdrawnRoutesLen: 5, WithdrawnRoutes: &packet.NLRI{ - IP: strAddr("10.0.0.0"), - Pfxlen: 8, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(10, 0, 0, 0), 8), Next: &packet.NLRI{ - IP: strAddr("192.168.0.0"), - Pfxlen: 16, + Prefix: bnet.NewPfx(bnet.IPv4FromOctets(192, 168, 0, 0), 16), }, }, }, @@ -100,8 +95,3 @@ func TestSerializeAndSendUpdate(t *testing.T) { }) } } - -func strAddr(s string) uint32 { - ret, _ := net.StrToAddr(s) - return ret -} diff --git a/protocols/bgp/server/update_sender.go b/protocols/bgp/server/update_sender.go index 9e40303fc4e52aa36b3678026bf855be8992b931..87e999caca45a87a124ee1f2269db7169d0eae80 100644 --- a/protocols/bgp/server/update_sender.go +++ b/protocols/bgp/server/update_sender.go @@ -7,11 +7,10 @@ import ( "sync" "time" + bnet "github.com/bio-routing/bio-rd/net" "github.com/bio-routing/bio-rd/protocols/bgp/packet" "github.com/bio-routing/bio-rd/route" "github.com/bio-routing/bio-rd/routingtable" - - bnet "github.com/bio-routing/bio-rd/net" log "github.com/sirupsen/logrus" ) @@ -191,8 +190,7 @@ func (u *UpdateSender) bgpUpdate(pfxs []bnet.Prefix, pa *packet.PathAttribute, p for _, pfx := range pfxs { nlri = &packet.NLRI{ PathIdentifier: pathID, - IP: pfx.Addr().ToUint32(), - Pfxlen: pfx.Pfxlen(), + Prefix: pfx, Next: update.NLRI, } update.NLRI = nlri @@ -207,11 +205,10 @@ func (u *UpdateSender) bgpUpdateMultiProtocol(pfxs []bnet.Prefix, pa *packet.Pat attrs := &packet.PathAttribute{ TypeCode: packet.MultiProtocolReachNLRICode, Value: packet.MultiProtocolReachNLRI{ - AFI: u.addressFamily.afi, - SAFI: u.addressFamily.safi, - NextHop: nextHop, - Prefixes: pfxs, - PathID: pathID, + AFI: u.addressFamily.afi, + SAFI: u.addressFamily.safi, + NextHop: nextHop, + NLRI: u.nlriForPrefixes(pfxs, pathID), }, } attrs.Next = pa @@ -221,6 +218,27 @@ func (u *UpdateSender) bgpUpdateMultiProtocol(pfxs []bnet.Prefix, pa *packet.Pat } } +func (u *UpdateSender) nlriForPrefixes(pfxs []bnet.Prefix, pathID uint32) *packet.NLRI { + var prev, res *packet.NLRI + for _, pfx := range pfxs { + cur := &packet.NLRI{ + Prefix: pfx, + PathIdentifier: pathID, + } + + if res == nil { + res = cur + prev = cur + continue + } + + prev.Next = cur + prev = cur + } + + return res +} + func (u *UpdateSender) copyAttributesWithoutNextHop(pa *packet.PathAttribute) (attrs *packet.PathAttribute, nextHop bnet.IP) { var curCopy, lastCopy *packet.PathAttribute for cur := pa; cur != nil; cur = cur.Next { @@ -276,8 +294,7 @@ func (u *UpdateSender) withdrawPrefixIPv4(out io.Writer, pfx bnet.Prefix, p *rou update := &packet.BGPUpdate{ WithdrawnRoutes: &packet.NLRI{ PathIdentifier: p.BGPPath.PathIdentifier, - IP: pfx.Addr().ToUint32(), - Pfxlen: pfx.Pfxlen(), + Prefix: pfx, }, } diff --git a/vendor/github.com/FMNSSun/libhash/fletcher/BUILD.bazel b/vendor/github.com/FMNSSun/libhash/fletcher/BUILD.bazel index e06aacb2ef74f298c35c2a87de53057a84bd813b..d336f1b5fa0f70af87553e944100aa4b2e5b92a0 100644 --- a/vendor/github.com/FMNSSun/libhash/fletcher/BUILD.bazel +++ b/vendor/github.com/FMNSSun/libhash/fletcher/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["fletcher.go"], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/FMNSSun/libhash/fletcher", + importmap = "vendor/github.com/FMNSSun/libhash/fletcher", importpath = "github.com/FMNSSun/libhash/fletcher", visibility = ["//visibility:public"], ) diff --git a/vendor/github.com/Masterminds/semver/BUILD.bazel b/vendor/github.com/Masterminds/semver/BUILD.bazel index 501de4ec1a18ecb59402f7b162965c56eb7e8786..bf7d35c81e3bd31ef56f80d8d2d344275048525f 100644 --- a/vendor/github.com/Masterminds/semver/BUILD.bazel +++ b/vendor/github.com/Masterminds/semver/BUILD.bazel @@ -13,7 +13,7 @@ go_library( "union.go", "version.go", ], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/Masterminds/semver", + importmap = "vendor/github.com/Masterminds/semver", importpath = "github.com/Masterminds/semver", visibility = ["//visibility:public"], ) diff --git a/vendor/github.com/Masterminds/vcs/BUILD.bazel b/vendor/github.com/Masterminds/vcs/BUILD.bazel index 25a38e72e1c0b651fd4486751f6709322a548bef..d5544f95e2f1331450898c29a481e06792b5d39b 100644 --- a/vendor/github.com/Masterminds/vcs/BUILD.bazel +++ b/vendor/github.com/Masterminds/vcs/BUILD.bazel @@ -12,7 +12,7 @@ go_library( "vcs_local_lookup.go", "vcs_remote_lookup.go", ], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/Masterminds/vcs", + importmap = "vendor/github.com/Masterminds/vcs", importpath = "github.com/Masterminds/vcs", visibility = ["//visibility:public"], ) diff --git a/vendor/github.com/armon/go-radix/BUILD.bazel b/vendor/github.com/armon/go-radix/BUILD.bazel index 7f2d8cc3e915f7a0c611751b8241b96ebe8de8b6..e9b05f2ca2c5d8946a9a3cf1c2b89da835fe36f3 100644 --- a/vendor/github.com/armon/go-radix/BUILD.bazel +++ b/vendor/github.com/armon/go-radix/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["radix.go"], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/armon/go-radix", + importmap = "vendor/github.com/armon/go-radix", importpath = "github.com/armon/go-radix", visibility = ["//visibility:public"], ) diff --git a/vendor/github.com/boltdb/bolt/BUILD.bazel b/vendor/github.com/boltdb/bolt/BUILD.bazel index e44ac9afc0e1ddfc14210cb96827ed60647f39ca..f2b6acbede3f24e2a8688c1cc4530f7f1acfca05 100644 --- a/vendor/github.com/boltdb/bolt/BUILD.bazel +++ b/vendor/github.com/boltdb/bolt/BUILD.bazel @@ -26,7 +26,7 @@ go_library( "page.go", "tx.go", ], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/boltdb/bolt", + importmap = "vendor/github.com/boltdb/bolt", importpath = "github.com/boltdb/bolt", visibility = ["//visibility:public"], deps = select({ diff --git a/vendor/github.com/davecgh/go-spew/spew/BUILD.bazel b/vendor/github.com/davecgh/go-spew/spew/BUILD.bazel index 2923b27f4f348b1e351a825e65bfe2ae51539fe4..79e140f52c8f6480636e05ec6ab95074b4f00b1d 100644 --- a/vendor/github.com/davecgh/go-spew/spew/BUILD.bazel +++ b/vendor/github.com/davecgh/go-spew/spew/BUILD.bazel @@ -12,7 +12,7 @@ go_library( "format.go", "spew.go", ], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/davecgh/go-spew/spew", + importmap = "vendor/github.com/davecgh/go-spew/spew", importpath = "github.com/davecgh/go-spew/spew", visibility = ["//visibility:public"], ) diff --git a/vendor/github.com/go-yaml/yaml/BUILD.bazel b/vendor/github.com/go-yaml/yaml/BUILD.bazel index 5a950bd804e1e122e011eb13cb8c4582685cde91..48a837c2d7107a2e2a7b54cf16fb971361188b50 100644 --- a/vendor/github.com/go-yaml/yaml/BUILD.bazel +++ b/vendor/github.com/go-yaml/yaml/BUILD.bazel @@ -17,7 +17,7 @@ go_library( "yamlh.go", "yamlprivateh.go", ], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/go-yaml/yaml", + importmap = "vendor/github.com/go-yaml/yaml", importpath = "github.com/go-yaml/yaml", visibility = ["//visibility:public"], ) diff --git a/vendor/github.com/golang/protobuf/proto/BUILD.bazel b/vendor/github.com/golang/protobuf/proto/BUILD.bazel index 9d5aafd83380464a9f48c492698a8a01d0f5f8d6..98590c1c2793ef88a7790d37a8241c2b0d16d8e5 100644 --- a/vendor/github.com/golang/protobuf/proto/BUILD.bazel +++ b/vendor/github.com/golang/protobuf/proto/BUILD.bazel @@ -19,7 +19,7 @@ go_library( "text.go", "text_parser.go", ], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/golang/protobuf/proto", + importmap = "vendor/github.com/golang/protobuf/proto", importpath = "github.com/golang/protobuf/proto", visibility = ["//visibility:public"], ) diff --git a/vendor/github.com/jmank88/nuts/BUILD.bazel b/vendor/github.com/jmank88/nuts/BUILD.bazel index 72db5e47f7dcd7c8f03d5c429368e22ca71631be..920f2b554e5325aafe6d1eec46e28aa4a9f79771 100644 --- a/vendor/github.com/jmank88/nuts/BUILD.bazel +++ b/vendor/github.com/jmank88/nuts/BUILD.bazel @@ -8,7 +8,7 @@ go_library( "paths.go", "types.go", ], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/jmank88/nuts", + importmap = "vendor/github.com/jmank88/nuts", importpath = "github.com/jmank88/nuts", visibility = ["//visibility:public"], deps = ["//vendor/github.com/boltdb/bolt:go_default_library"], diff --git a/vendor/github.com/konsorten/go-windows-terminal-sequences/BUILD.bazel b/vendor/github.com/konsorten/go-windows-terminal-sequences/BUILD.bazel index 70328e9c3ffbdb2338dcb98e6cd84680445f6292..99cc96f8737282fc94db66fd7c548c8c3b4493c3 100644 --- a/vendor/github.com/konsorten/go-windows-terminal-sequences/BUILD.bazel +++ b/vendor/github.com/konsorten/go-windows-terminal-sequences/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["sequences.go"], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/konsorten/go-windows-terminal-sequences", + importmap = "vendor/github.com/konsorten/go-windows-terminal-sequences", importpath = "github.com/konsorten/go-windows-terminal-sequences", visibility = ["//visibility:public"], ) diff --git a/vendor/github.com/nightlyone/lockfile/BUILD.bazel b/vendor/github.com/nightlyone/lockfile/BUILD.bazel index 8b1c688bca89ed5bb9caae81fdab35cd1c912209..0a74fcf8fb203c8ffa147d183c97661a0f8faf92 100644 --- a/vendor/github.com/nightlyone/lockfile/BUILD.bazel +++ b/vendor/github.com/nightlyone/lockfile/BUILD.bazel @@ -7,7 +7,7 @@ go_library( "lockfile_unix.go", "lockfile_windows.go", ], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/nightlyone/lockfile", + importmap = "vendor/github.com/nightlyone/lockfile", importpath = "github.com/nightlyone/lockfile", visibility = ["//visibility:public"], ) diff --git a/vendor/github.com/pelletier/go-toml/BUILD.bazel b/vendor/github.com/pelletier/go-toml/BUILD.bazel index 8130328c049d880232a298fb7213cc55e10e50d7..526e4aeca6d915a4f18a420ac9de331d194e34dd 100644 --- a/vendor/github.com/pelletier/go-toml/BUILD.bazel +++ b/vendor/github.com/pelletier/go-toml/BUILD.bazel @@ -14,7 +14,7 @@ go_library( "tomltree_create.go", "tomltree_write.go", ], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/pelletier/go-toml", + importmap = "vendor/github.com/pelletier/go-toml", importpath = "github.com/pelletier/go-toml", visibility = ["//visibility:public"], ) diff --git a/vendor/github.com/pkg/errors/BUILD.bazel b/vendor/github.com/pkg/errors/BUILD.bazel index b1eb9941074b0da6982111f122d750abafa7b994..02e03382df2b88e8d286b8ee8eccb0d9ea754a28 100644 --- a/vendor/github.com/pkg/errors/BUILD.bazel +++ b/vendor/github.com/pkg/errors/BUILD.bazel @@ -6,7 +6,7 @@ go_library( "errors.go", "stack.go", ], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/pkg/errors", + importmap = "vendor/github.com/pkg/errors", importpath = "github.com/pkg/errors", visibility = ["//visibility:public"], ) diff --git a/vendor/github.com/pmezard/go-difflib/difflib/BUILD.bazel b/vendor/github.com/pmezard/go-difflib/difflib/BUILD.bazel index 8a8fca20454989179efb5cfa46a8542fc30c5845..f6d4fa72e45f482c4cb676837b518e6d5be14450 100644 --- a/vendor/github.com/pmezard/go-difflib/difflib/BUILD.bazel +++ b/vendor/github.com/pmezard/go-difflib/difflib/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["difflib.go"], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/pmezard/go-difflib/difflib", + importmap = "vendor/github.com/pmezard/go-difflib/difflib", importpath = "github.com/pmezard/go-difflib/difflib", visibility = ["//visibility:public"], ) diff --git a/vendor/github.com/q3k/goveralls/BUILD.bazel b/vendor/github.com/q3k/goveralls/BUILD.bazel index df180746db3e3d43e3b4692f17747a679186c80b..04249c71ebd3067a7084271ba6fc909d316ae87b 100644 --- a/vendor/github.com/q3k/goveralls/BUILD.bazel +++ b/vendor/github.com/q3k/goveralls/BUILD.bazel @@ -7,7 +7,7 @@ go_library( "gocover.go", "goveralls.go", ], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/q3k/goveralls", + importmap = "vendor/github.com/q3k/goveralls", importpath = "github.com/q3k/goveralls", visibility = ["//visibility:private"], deps = ["//vendor/golang.org/x/tools/cover:go_default_library"], diff --git a/vendor/github.com/sdboyer/constext/BUILD.bazel b/vendor/github.com/sdboyer/constext/BUILD.bazel index effb8ca864561db47f40692afd71632eddebf5d5..ee94b66945d935ba8431de6870cfd7947ffe3d84 100644 --- a/vendor/github.com/sdboyer/constext/BUILD.bazel +++ b/vendor/github.com/sdboyer/constext/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["constext.go"], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/sdboyer/constext", + importmap = "vendor/github.com/sdboyer/constext", importpath = "github.com/sdboyer/constext", visibility = ["//visibility:public"], ) diff --git a/vendor/github.com/sirupsen/logrus/BUILD.bazel b/vendor/github.com/sirupsen/logrus/BUILD.bazel index 2364024026a58682e58c5623f86c6f7e696227cf..b871d6ae0fb9f0e20de9605b362981bf1a69ae9d 100644 --- a/vendor/github.com/sirupsen/logrus/BUILD.bazel +++ b/vendor/github.com/sirupsen/logrus/BUILD.bazel @@ -20,7 +20,7 @@ go_library( "text_formatter.go", "writer.go", ], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/sirupsen/logrus", + importmap = "vendor/github.com/sirupsen/logrus", importpath = "github.com/sirupsen/logrus", visibility = ["//visibility:public"], deps = select({ diff --git a/vendor/github.com/stretchr/testify/assert/BUILD.bazel b/vendor/github.com/stretchr/testify/assert/BUILD.bazel index 5fc04335b69097cb28abf6363cbc53e98a917aa6..84915770c4ea7ff0b7db3bd5f755c5a8f5c7df3f 100644 --- a/vendor/github.com/stretchr/testify/assert/BUILD.bazel +++ b/vendor/github.com/stretchr/testify/assert/BUILD.bazel @@ -11,7 +11,7 @@ go_library( "forward_assertions.go", "http_assertions.go", ], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/stretchr/testify/assert", + importmap = "vendor/github.com/stretchr/testify/assert", importpath = "github.com/stretchr/testify/assert", visibility = ["//visibility:public"], deps = [ diff --git a/vendor/github.com/taktv6/tflow2/convert/BUILD.bazel b/vendor/github.com/taktv6/tflow2/convert/BUILD.bazel index 5506643341e1e3a4ea891167b92208d92d0931cb..b6d8a418d173754e2d28152a5a674c26ad27a76e 100644 --- a/vendor/github.com/taktv6/tflow2/convert/BUILD.bazel +++ b/vendor/github.com/taktv6/tflow2/convert/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["convert.go"], - importmap = "github.com/bio-routing/bio-rd/vendor/github.com/taktv6/tflow2/convert", + importmap = "vendor/github.com/taktv6/tflow2/convert", importpath = "github.com/taktv6/tflow2/convert", visibility = ["//visibility:public"], ) diff --git a/vendor/golang.org/x/crypto/ssh/terminal/BUILD.bazel b/vendor/golang.org/x/crypto/ssh/terminal/BUILD.bazel index f1dbddae821cfbbdda8f70941472708f75ddf41d..593a697cd9117b5d197fa40ea741b4da68685b20 100644 --- a/vendor/golang.org/x/crypto/ssh/terminal/BUILD.bazel +++ b/vendor/golang.org/x/crypto/ssh/terminal/BUILD.bazel @@ -11,7 +11,7 @@ go_library( "util_solaris.go", "util_windows.go", ], - importmap = "github.com/bio-routing/bio-rd/vendor/golang.org/x/crypto/ssh/terminal", + importmap = "vendor/golang.org/x/crypto/ssh/terminal", importpath = "golang.org/x/crypto/ssh/terminal", visibility = ["//visibility:public"], deps = select({ diff --git a/vendor/golang.org/x/net/context/BUILD.bazel b/vendor/golang.org/x/net/context/BUILD.bazel index 8a09a3615ea3ef3a023ed3ca7a5dc82d3b7ca79d..79dde6dff60ca5ed498faadc52bc0af430537f4b 100644 --- a/vendor/golang.org/x/net/context/BUILD.bazel +++ b/vendor/golang.org/x/net/context/BUILD.bazel @@ -9,7 +9,7 @@ go_library( "pre_go17.go", "pre_go19.go", ], - importmap = "github.com/bio-routing/bio-rd/vendor/golang.org/x/net/context", + importmap = "vendor/golang.org/x/net/context", importpath = "golang.org/x/net/context", visibility = ["//visibility:public"], ) diff --git a/vendor/golang.org/x/sync/errgroup/BUILD.bazel b/vendor/golang.org/x/sync/errgroup/BUILD.bazel index 9090cd0a8fb216e140ee77e5f9410f28874be014..50a4d6452a81b27bafb5accd7f061473c3175315 100644 --- a/vendor/golang.org/x/sync/errgroup/BUILD.bazel +++ b/vendor/golang.org/x/sync/errgroup/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["errgroup.go"], - importmap = "github.com/bio-routing/bio-rd/vendor/golang.org/x/sync/errgroup", + importmap = "vendor/golang.org/x/sync/errgroup", importpath = "golang.org/x/sync/errgroup", visibility = ["//visibility:public"], deps = ["//vendor/golang.org/x/net/context:go_default_library"], diff --git a/vendor/golang.org/x/sys/unix/BUILD.bazel b/vendor/golang.org/x/sys/unix/BUILD.bazel index 48a8509117d6f6ca6a4a912201377541cdd8a690..2c09789163943a674c9f359a7dec50b405d340a7 100644 --- a/vendor/golang.org/x/sys/unix/BUILD.bazel +++ b/vendor/golang.org/x/sys/unix/BUILD.bazel @@ -204,7 +204,7 @@ go_library( "ztypes_solaris_amd64.go", ], cgo = True, - importmap = "github.com/bio-routing/bio-rd/vendor/golang.org/x/sys/unix", + importmap = "vendor/golang.org/x/sys/unix", importpath = "golang.org/x/sys/unix", visibility = ["//visibility:public"], ) diff --git a/vendor/golang.org/x/sys/windows/BUILD.bazel b/vendor/golang.org/x/sys/windows/BUILD.bazel index 846dfeb4fdc916e7290b99707565ca2b4e80c236..a339813d0869e17ba47c6f91e7ebcc37b8b23771 100644 --- a/vendor/golang.org/x/sys/windows/BUILD.bazel +++ b/vendor/golang.org/x/sys/windows/BUILD.bazel @@ -23,7 +23,7 @@ go_library( "types_windows_amd64.go", "zsyscall_windows.go", ], - importmap = "github.com/bio-routing/bio-rd/vendor/golang.org/x/sys/windows", + importmap = "vendor/golang.org/x/sys/windows", importpath = "golang.org/x/sys/windows", visibility = ["//visibility:public"], ) diff --git a/vendor/golang.org/x/tools/cover/BUILD.bazel b/vendor/golang.org/x/tools/cover/BUILD.bazel index 85feea167867389c8dcfe6a82669ea915359276f..599c3ebc6b9e73701e26299c299a4694e20d0ff2 100644 --- a/vendor/golang.org/x/tools/cover/BUILD.bazel +++ b/vendor/golang.org/x/tools/cover/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["profile.go"], - importmap = "github.com/bio-routing/bio-rd/vendor/golang.org/x/tools/cover", + importmap = "vendor/golang.org/x/tools/cover", importpath = "golang.org/x/tools/cover", visibility = ["//visibility:public"], )