Skip to content

Updated gvisor version #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dhcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/insomniacslk/dhcp/dhcpv4"
"gvisor.dev/gvisor/pkg/tcpip"
"gvisor.dev/gvisor/pkg/tcpip/checksum"
"gvisor.dev/gvisor/pkg/tcpip/header"
"gvisor.dev/gvisor/pkg/tcpip/network/ipv4"
"gvisor.dev/gvisor/pkg/tcpip/transport/udp"
Expand Down Expand Up @@ -115,7 +116,7 @@ func makeUDPv4Packet(
// Calculate the UDP pseudo-header checksum.
xsum := header.PseudoHeaderChecksum(udp.ProtocolNumber, srcIP, dstIP, uint16(len(udpv4)))
// Calculate the UDP checksum and set it.
xsum = header.Checksum(payload, xsum)
xsum = checksum.Checksum(payload, xsum)
udpv4.SetChecksum(^udpv4.CalculateChecksum(xsum))

return buf
Expand Down
6 changes: 3 additions & 3 deletions endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (e *endpoint) ARPHardwareType() header.ARPHardwareType {
}

// AddHeader implements stack.LinkEndpoint.AddHeader.
func (e *endpoint) AddHeader(pkt *stack.PacketBuffer) {
func (e *endpoint) AddHeader(pkt stack.PacketBufferPtr) {
// Add ethernet header if needed.
eth := header.Ethernet(pkt.LinkHeader().Push(header.EthernetMinimumSize))
eth.Encode(&header.EthernetFields{
Expand Down Expand Up @@ -184,7 +184,7 @@ func (e *endpoint) dispatchLoop(devAddr tcpip.Address, conn net.Conn) {

// writePacket writes outbound packets to the connection. If it is not
// currently writable, the packet is dropped.
func (e *endpoint) writePacket(pkt *stack.PacketBuffer) tcpip.Error {
func (e *endpoint) writePacket(pkt stack.PacketBufferPtr) tcpip.Error {
data := pkt.ToView().AsSlice()

if e.writer != nil {
Expand Down Expand Up @@ -259,7 +259,7 @@ func (e *endpoint) inboundDispatch(devAddr tcpip.Address, conn net.Conn) (bool,
}

func (e *endpoint) deliverOrConsumeNetworkPacket(
pkt *stack.PacketBuffer,
pkt stack.PacketBufferPtr,
conn net.Conn,
) (bool, error) {
hdr, ok := pkt.LinkHeader().Consume(int(e.MaxHeaderLength()))
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9
golang.org/x/net v0.2.0
golang.org/x/sync v0.1.0
gvisor.dev/gvisor v0.0.0-20220817001344-846276b3dbc5
gvisor.dev/gvisor v0.0.0-20221216231429-a78e892a26d2
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,5 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gvisor.dev/gvisor v0.0.0-20220817001344-846276b3dbc5 h1:cv/zaNV0nr1mJzaeo4S5mHIm5va1W0/9J3/5prlsuRM=
gvisor.dev/gvisor v0.0.0-20220817001344-846276b3dbc5/go.mod h1:TIvkJD0sxe8pIob3p6T8IzxXunlp6yfgktvTNp+DGNM=
gvisor.dev/gvisor v0.0.0-20221216231429-a78e892a26d2 h1:QN+Xh63jThYFN4CrcD4KXj+rUhevlb0LXEAlZ4m+qXQ=
gvisor.dev/gvisor v0.0.0-20221216231429-a78e892a26d2/go.mod h1:Dn5idtptoW1dIos9U6A2rpebLs/MtTwFacjKb8jLdQA=
3 changes: 2 additions & 1 deletion ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
xicmp "golang.org/x/net/icmp"
xipv4 "golang.org/x/net/ipv4"
"gvisor.dev/gvisor/pkg/tcpip"
"gvisor.dev/gvisor/pkg/tcpip/checksum"
"gvisor.dev/gvisor/pkg/tcpip/header"
"gvisor.dev/gvisor/pkg/tcpip/network/ipv4"
"gvisor.dev/gvisor/pkg/tcpip/transport/icmp"
Expand Down Expand Up @@ -129,7 +130,7 @@ func makeICMPv4EchoPacket(
icmpv4.SetSequence(sequence)
copy(icmpv4.Payload(), payload)
icmpv4.SetChecksum(0)
icmpv4.SetChecksum(^header.Checksum(icmpv4, 0))
icmpv4.SetChecksum(^checksum.Checksum(icmpv4, 0))

return buf
}