From b1d57877264c2b94e3024375efc9914881f0bbe8 Mon Sep 17 00:00:00 2001 From: Kevin Krakauer Date: Mon, 15 Mar 2021 18:47:41 -0700 Subject: Make netstack (//pkg/tcpip) buildable for 32 bit Doing so involved breaking dependencies between //pkg/tcpip and the rest of gVisor, which are discouraged anyways. Tested on the Go branch via: gvisor.dev/gvisor/pkg/tcpip/... Addresses #1446. PiperOrigin-RevId: 363081778 --- pkg/tcpip/link/fdbased/endpoint.go | 2 +- pkg/tcpip/link/fdbased/packet_dispatchers.go | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'pkg/tcpip/link/fdbased') diff --git a/pkg/tcpip/link/fdbased/endpoint.go b/pkg/tcpip/link/fdbased/endpoint.go index e17e2085c..2bb1be5d6 100644 --- a/pkg/tcpip/link/fdbased/endpoint.go +++ b/pkg/tcpip/link/fdbased/endpoint.go @@ -492,7 +492,7 @@ func (e *endpoint) sendBatch(batchFD int, batch []*stack.PacketBuffer) (int, tcp var mmsgHdr rawfile.MMsgHdr mmsgHdr.Msg.Iov = &iovecs[0] - mmsgHdr.Msg.Iovlen = uint64(len(iovecs)) + mmsgHdr.Msg.SetIovlen((len(iovecs))) mmsgHdrs = append(mmsgHdrs, mmsgHdr) } diff --git a/pkg/tcpip/link/fdbased/packet_dispatchers.go b/pkg/tcpip/link/fdbased/packet_dispatchers.go index 46df87f44..a7adf822b 100644 --- a/pkg/tcpip/link/fdbased/packet_dispatchers.go +++ b/pkg/tcpip/link/fdbased/packet_dispatchers.go @@ -68,10 +68,8 @@ func (b *iovecBuffer) nextIovecs() []unix.Iovec { // The kernel adds virtioNetHdr before each packet, but // we don't use it, so so we allocate a buffer for it, // add it in iovecs but don't add it in a view. - b.iovecs[0] = unix.Iovec{ - Base: &vnetHdr[0], - Len: uint64(virtioNetHdrSize), - } + b.iovecs[0] = unix.Iovec{Base: &vnetHdr[0]} + b.iovecs[0].SetLen(virtioNetHdrSize) vnetHdrOff++ } for i := range b.views { @@ -80,10 +78,8 @@ func (b *iovecBuffer) nextIovecs() []unix.Iovec { } v := buffer.NewView(b.sizes[i]) b.views[i] = v - b.iovecs[i+vnetHdrOff] = unix.Iovec{ - Base: &v[0], - Len: uint64(len(v)), - } + b.iovecs[i+vnetHdrOff] = unix.Iovec{Base: &v[0]} + b.iovecs[i+vnetHdrOff].SetLen(len(v)) } return b.iovecs } @@ -235,7 +231,7 @@ func (d *recvMMsgDispatcher) dispatch() (bool, tcpip.Error) { iovLen := len(iovecs) d.msgHdrs[k].Len = 0 d.msgHdrs[k].Msg.Iov = &iovecs[0] - d.msgHdrs[k].Msg.Iovlen = uint64(iovLen) + d.msgHdrs[k].Msg.SetIovlen(iovLen) } nMsgs, err := rawfile.BlockingRecvMMsg(d.fd, d.msgHdrs) -- cgit v1.2.3