Skip to content
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

Update gvisor.dev/gvisor to latest tagged release #249

Merged
merged 4 commits into from
Jul 27, 2023
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
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.20.x
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼


- name: Build
run: make cross qemu-wrapper vm
Expand All @@ -42,7 +42,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.20.x

- name: Test
run: make test
Expand All @@ -62,7 +62,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.20.x

- name: Build
run: go build -ldflags -H=windowsgui -o bin/win-sshproxy.exe ./cmd/win-sshproxy
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.20.x

- uses: actions/checkout@v3
- name: golangci-lint
Expand Down
22 changes: 22 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ jobs:
srpm_build_deps:
- make
- rpkg
targets:
- fedora-rawhide-aarch64
- fedora-rawhide-x86_64
- fedora-eln-aarch64
- fedora-eln-x86_64
- fedora-38-aarch64
- fedora-38-x86_64
- centos-stream-9-aarch64
- centos-stream-9-x86_64
- centos-stream-8-aarch64
- centos-stream-8-x86_64
actions:
post-upstream-clone:
- "rpkg spec --outdir ./"
Expand All @@ -29,3 +40,14 @@ jobs:
#trigger: commit
#branch: main
#project: podman-next
#targets:
# - fedora-rawhide-aarch64
# - fedora-rawhide-x86_64
# - fedora-eln-aarch64
# - fedora-eln-x86_64
# - fedora-38-aarch64
# - fedora-38-x86_64
# - centos-stream-9-aarch64
# - centos-stream-9-x86_64
# - centos-stream-8-aarch64
# - centos-stream-8-x86_64
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/containers/gvisor-tap-vsock

go 1.18
go 1.20

require (
github.com/Microsoft/go-winio v0.6.1
Expand All @@ -24,7 +24,7 @@ require (
golang.org/x/crypto v0.10.0
golang.org/x/sync v0.3.0
golang.org/x/sys v0.10.0
gvisor.dev/gvisor v0.0.0-20221216231429-a78e892a26d2
gvisor.dev/gvisor v0.0.0-20230715022000-fd277b20b8db
inet.af/tcpproxy v0.0.0-20220326234310-be3ee21c9fa0
)

Expand All @@ -41,7 +41,7 @@ require (
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/text v0.10.0 // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
golang.org/x/tools v0.9.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
10 changes: 5 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ 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/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58=
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44=
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
Expand All @@ -182,7 +182,7 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
google.golang.org/protobuf v1.28.2-0.20230118093459-a9481185b34d h1:qp0AnQCvRCMlu9jBjtdbTaaEmThIgZOrbVyDEOcmKhQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
Expand All @@ -194,7 +194,7 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
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=
gvisor.dev/gvisor v0.0.0-20230715022000-fd277b20b8db h1:WZSmkyu/hep9YhWIlBZefwGVBrnGE5yW8JPD56YRsXs=
gvisor.dev/gvisor v0.0.0-20230715022000-fd277b20b8db/go.mod h1:sQuqOkxbfJq/GS2uSnqHphtXclHyk/ZrAGhZBxxsq6g=
inet.af/tcpproxy v0.0.0-20220326234310-be3ee21c9fa0 h1:PqdHrvQRVK1zapJkd0qf6+tevvSIcWdfenVqJd3PHWU=
inet.af/tcpproxy v0.0.0-20220326234310-be3ee21c9fa0/go.mod h1:Tojt5kmHpDIR2jMojxzZK2w2ZR7OILODmUo2gaSwjrk=
2 changes: 1 addition & 1 deletion pkg/services/dhcp/dhcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func dial(s *stack.Stack, nic int) (*gonet.UDPConn, error) {

if err := ep.Bind(tcpip.FullAddress{
NIC: tcpip.NICID(nic),
Addr: "",
Addr: tcpip.Address{},
Port: uint16(serverPort),
}); err != nil {
ep.Close()
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/forwarder/ports.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func tcpipAddress(nicID tcpip.NICID, remote string) (address tcpip.FullAddress,

address = tcpip.FullAddress{
NIC: nicID,
Addr: tcpip.Address(net.ParseIP(split[0]).To4()),
Addr: tcpip.AddrFrom4Slice(net.ParseIP(split[0]).To4()),
Port: uint16(port),
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/services/forwarder/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ func TCP(s *stack.Stack, nat map[tcpip.Address]tcpip.Address, natLock *sync.Mute

func linkLocal() *tcpip.Subnet {
_, parsedSubnet, _ := net.ParseCIDR(linkLocalSubnet) // CoreOS VM tries to connect to Amazon EC2 metadata service
subnet, _ := tcpip.NewSubnet(tcpip.Address(parsedSubnet.IP), tcpip.AddressMask(parsedSubnet.Mask))
subnet, _ := tcpip.NewSubnet(tcpip.AddrFromSlice(parsedSubnet.IP), tcpip.MaskFromBytes(parsedSubnet.Mask))
return &subnet
}
4 changes: 3 additions & 1 deletion pkg/tap/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ func (e *LinkEndpoint) DeliverNetworkPacket(protocol tcpip.NetworkProtocolNumber
func (e *LinkEndpoint) AddHeader(_ stack.PacketBufferPtr) {
}

func (e *LinkEndpoint) ParseHeader(stack.PacketBufferPtr) bool { return true }

func (e *LinkEndpoint) Capabilities() stack.LinkEndpointCapabilities {
return stack.CapabilityResolutionRequired | stack.CapabilityRXChecksumOffload
}
Expand Down Expand Up @@ -109,7 +111,7 @@ func (e *LinkEndpoint) writePacket(r stack.RouteInfo, protocol tcpip.NetworkProt
h := header.ARP(pkt.NetworkHeader().Slice())
if h.IsValid() &&
h.Op() == header.ARPReply {
ip := tcpip.Address(h.ProtocolAddressSender()).String()
ip := tcpip.AddrFromSlice(h.ProtocolAddressSender()).String()
_, ok := e.virtualIPs[ip]
if ip != e.IP() && !ok {
log.Debugf("dropping spoofing packets from the gateway about IP %s", ip)
Expand Down
6 changes: 3 additions & 3 deletions pkg/tap/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/google/gopacket/layers"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"gvisor.dev/gvisor/pkg/bufferv2"
"gvisor.dev/gvisor/pkg/buffer"
"gvisor.dev/gvisor/pkg/tcpip"
"gvisor.dev/gvisor/pkg/tcpip/header"
"gvisor.dev/gvisor/pkg/tcpip/stack"
Expand Down Expand Up @@ -262,15 +262,15 @@ func (e *Switch) rxBuf(_ context.Context, id int, buf []byte) {

if eth.DestinationAddress() != e.gateway.LinkAddress() {
pkt := stack.NewPacketBuffer(stack.PacketBufferOptions{
Payload: bufferv2.MakeWithData(buf),
Payload: buffer.MakeWithData(buf),
})
if err := e.tx(pkt); err != nil {
log.Error(err)
}
pkt.DecRef()
}
if eth.DestinationAddress() == e.gateway.LinkAddress() || eth.DestinationAddress() == header.EthernetBroadcastAddress {
data := bufferv2.MakeWithData(buf)
data := buffer.MakeWithData(buf)
data.TrimFront(header.EthernetMinimumSize)
pkt := stack.NewPacketBuffer(stack.PacketBufferOptions{
Payload: data,
Expand Down
6 changes: 3 additions & 3 deletions pkg/virtualnetwork/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (n *VirtualNetwork) Dial(network, addr string) (net.Conn, error) {
}
return gonet.DialTCP(n.stack, tcpip.FullAddress{
NIC: 1,
Addr: tcpip.Address(ip.To4()),
Addr: tcpip.AddrFrom4Slice(ip.To4()),
Port: uint16(port),
}, ipv4.ProtocolNumber)
}
Expand All @@ -32,7 +32,7 @@ func (n *VirtualNetwork) DialContextTCP(ctx context.Context, addr string) (net.C
return gonet.DialContextTCP(ctx, n.stack,
tcpip.FullAddress{
NIC: 1,
Addr: tcpip.Address(ip.To4()),
Addr: tcpip.AddrFrom4Slice(ip.To4()),
Port: uint16(port),
}, ipv4.ProtocolNumber)
}
Expand All @@ -44,7 +44,7 @@ func (n *VirtualNetwork) Listen(network, addr string) (net.Listener, error) {
}
return gonet.ListenTCP(n.stack, tcpip.FullAddress{
NIC: 1,
Addr: tcpip.Address(ip.To4()),
Addr: tcpip.AddrFrom4Slice(ip.To4()),
Port: uint16(port),
}, ipv4.ProtocolNumber)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/virtualnetwork/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (n *VirtualNetwork) Mux() *http.ServeMux {
DialContext: func(ctx context.Context, network, address string) (net.Conn, error) {
return gonet.DialContextTCP(ctx, n.stack, tcpip.FullAddress{
NIC: 1,
Addr: tcpip.Address(net.ParseIP(ip).To4()),
Addr: tcpip.AddrFrom4Slice(net.ParseIP(ip).To4()),
Port: uint16(port),
}, ipv4.ProtocolNumber)
},
Expand Down
6 changes: 3 additions & 3 deletions pkg/virtualnetwork/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ func addServices(configuration *types.Configuration, s *stack.Stack, ipPool *tap
func parseNATTable(configuration *types.Configuration) map[tcpip.Address]tcpip.Address {
translation := make(map[tcpip.Address]tcpip.Address)
for source, destination := range configuration.NAT {
translation[tcpip.Address(net.ParseIP(source).To4())] = tcpip.Address(net.ParseIP(destination).To4())
translation[tcpip.AddrFrom4Slice(net.ParseIP(source).To4())] = tcpip.AddrFrom4Slice(net.ParseIP(destination).To4())
}
return translation
}

func dnsServer(configuration *types.Configuration, s *stack.Stack) (http.Handler, error) {
udpConn, err := gonet.DialUDP(s, &tcpip.FullAddress{
NIC: 1,
Addr: tcpip.Address(net.ParseIP(configuration.GatewayIP).To4()),
Addr: tcpip.AddrFrom4Slice(net.ParseIP(configuration.GatewayIP).To4()),
Port: uint16(53),
}, nil, ipv4.ProtocolNumber)
if err != nil {
Expand All @@ -70,7 +70,7 @@ func dnsServer(configuration *types.Configuration, s *stack.Stack) (http.Handler

tcpLn, err := gonet.ListenTCP(s, tcpip.FullAddress{
NIC: 1,
Addr: tcpip.Address(net.ParseIP(configuration.GatewayIP).To4()),
Addr: tcpip.AddrFrom4Slice(net.ParseIP(configuration.GatewayIP).To4()),
Port: uint16(53),
}, ipv4.ProtocolNumber)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions pkg/virtualnetwork/virtualnetwork.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func createStack(configuration *types.Configuration, endpoint stack.LinkEndpoint

if err := s.AddProtocolAddress(1, tcpip.ProtocolAddress{
Protocol: ipv4.ProtocolNumber,
AddressWithPrefix: tcpip.Address(net.ParseIP(configuration.GatewayIP).To4()).WithPrefix(),
AddressWithPrefix: tcpip.AddrFrom4Slice(net.ParseIP(configuration.GatewayIP).To4()).WithPrefix(),
}, stack.AddressProperties{}); err != nil {
return nil, errors.New(err.String())
}
Expand All @@ -128,14 +128,14 @@ func createStack(configuration *types.Configuration, endpoint stack.LinkEndpoint
return nil, errors.Wrap(err, "cannot parse cidr")
}

subnet, err := tcpip.NewSubnet(tcpip.Address(parsedSubnet.IP), tcpip.AddressMask(parsedSubnet.Mask))
subnet, err := tcpip.NewSubnet(tcpip.AddrFromSlice(parsedSubnet.IP), tcpip.MaskFromBytes(parsedSubnet.Mask))
if err != nil {
return nil, errors.Wrap(err, "cannot parse subnet")
}
s.SetRouteTable([]tcpip.Route{
{
Destination: subnet,
Gateway: "",
Gateway: tcpip.Address{},
NIC: 1,
},
})
Expand Down
Loading