mirror of
https://github.com/slackhq/nebula.git
synced 2025-11-23 17:04:25 +01:00
working again
This commit is contained in:
2
bits.go
2
bits.go
@@ -43,7 +43,7 @@ func (b *Bits) Check(l logrus.FieldLogger, i uint64) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Not within the window
|
// Not within the window
|
||||||
l.Debugf("rejected a packet (top) %d %d\n", b.current, i)
|
l.Debugf("rejected a packet (top) %d %d delta %d\n", b.current, i, b.current-i)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ func (f *Interface) listenOut(q int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
f.readOutsidePacketsMany(pkts, outPackets, h, fwPacket, lhh, nb, q, ctCache.Get(f.l))
|
f.readOutsidePacketsMany(pkts, outPackets, h, fwPacket, lhh, nb, q, ctCache.Get(f.l))
|
||||||
for i := range outPackets {
|
for i := range pkts {
|
||||||
if pkts[i].OutLen != -1 {
|
if pkts[i].OutLen != -1 {
|
||||||
for j := 0; j < outPackets[i].SegCounter; j++ {
|
for j := 0; j < outPackets[i].SegCounter; j++ {
|
||||||
if len(outPackets[i].Segments[j]) > 0 {
|
if len(outPackets[i].Segments[j]) > 0 {
|
||||||
@@ -298,12 +298,15 @@ func (f *Interface) listenOut(q int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//toSend = toSend[:toSendCount]
|
//toSend = toSend[:toSendCount]
|
||||||
if len(toSend) != 0 {
|
for i := 0; i < len(toSend); i += batch {
|
||||||
_, err := f.readers[q].WriteMany(toSend)
|
x := min(len(toSend[i:]), batch)
|
||||||
|
toSendThisTime := toSend[i : i+x]
|
||||||
|
_, err := f.readers[q].WriteMany(toSendThisTime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
f.l.WithError(err).Error("Failed to write messages")
|
f.l.WithError(err).Error("Failed to write messages")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -745,7 +745,9 @@ func (t *tun) Write(b []byte) (int, error) {
|
|||||||
|
|
||||||
func (t *tun) WriteMany(b [][]byte) (int, error) {
|
func (t *tun) WriteMany(b [][]byte) (int, error) {
|
||||||
maximum := len(b) //we are RXing
|
maximum := len(b) //we are RXing
|
||||||
|
if maximum == 0 {
|
||||||
|
return 0, nil
|
||||||
|
}
|
||||||
hdr := virtio.NetHdr{ //todo
|
hdr := virtio.NetHdr{ //todo
|
||||||
Flags: unix.VIRTIO_NET_HDR_F_DATA_VALID,
|
Flags: unix.VIRTIO_NET_HDR_F_DATA_VALID,
|
||||||
GSOType: unix.VIRTIO_NET_HDR_GSO_NONE,
|
GSOType: unix.VIRTIO_NET_HDR_GSO_NONE,
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ func (u *StdConn) ListenOut(r EncReader) {
|
|||||||
packets[i].Payload = packets[i].Payload[:msgs[i].Len]
|
packets[i].Payload = packets[i].Payload[:msgs[i].Len]
|
||||||
packets[i].Update(getRawMessageControlLen(&msgs[i]))
|
packets[i].Update(getRawMessageControlLen(&msgs[i]))
|
||||||
}
|
}
|
||||||
r(packets)
|
r(packets[:n])
|
||||||
for i := 0; i < n; i++ { //todo reset this in prev loop, but this makes debug ez
|
for i := 0; i < n; i++ { //todo reset this in prev loop, but this makes debug ez
|
||||||
msgs[i].Hdr.Controllen = uint64(unix.CmsgSpace(2))
|
msgs[i].Hdr.Controllen = uint64(unix.CmsgSpace(2))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user