Automated rollback of changelist 516870932

PiperOrigin-RevId: 516937389
This commit is contained in:
Kevin Krakauer
2023-03-15 14:56:55 -07:00
committed by gVisor bot
parent d2da7d77d2
commit 6f90845aec
4 changed files with 15 additions and 27 deletions
+2 -3
View File
@@ -226,8 +226,6 @@ func (gb *groBucket) found(gd *groDispatcher, groPkt *groPacket, flushGROPkt boo
// Flush groPkt or merge the packets.
pktSize := pkt.Data().Size()
flags := tcpHdr.Flags()
dataOff := tcpHdr.DataOffset()
tcpPayloadSize := pkt.Data().Size() - len(ipHdr) - int(dataOff)
if flushGROPkt {
// Flush the existing GRO packet. Don't hold bucket.mu while
// processing the packet.
@@ -241,10 +239,12 @@ func (gb *groBucket) found(gd *groDispatcher, groPkt *groPacket, flushGROPkt boo
} else if groPkt != nil {
// Merge pkt in to GRO packet.
buf := pkt.Data().ToBuffer()
dataOff := tcpHdr.DataOffset()
buf.TrimFront(int64(len(ipHdr)) + int64(dataOff))
groPkt.pkt.Data().MergeBuffer(&buf)
buf.Release()
// Update the IP total length.
tcpPayloadSize := pkt.Data().Size() - len(ipHdr) - int(dataOff)
updateIPHdr(groPkt.ipHdr, tcpPayloadSize)
// Add flags from the packet to the GRO packet.
groPkt.tcpHdr.SetFlags(uint8(groPkt.tcpHdr.Flags() | (flags & (header.TCPFlagFin | header.TCPFlagPsh))))
@@ -261,7 +261,6 @@ func (gb *groBucket) found(gd *groDispatcher, groPkt *groPacket, flushGROPkt boo
// malformed, a local GSO packet, or has already been handled by host
// GRO.
flush := header.TCPFlags(flags)&(header.TCPFlagUrg|header.TCPFlagPsh|header.TCPFlagRst|header.TCPFlagSyn|header.TCPFlagFin) != 0
flush = flush || tcpPayloadSize == 0
if groPkt != nil {
flush = flush || pktSize != groPkt.initialLength
}
+7 -13
View File
@@ -121,19 +121,17 @@ type XDPLink struct {
LinkAddress net.HardwareAddr
QDisc config.QueueingDiscipline
Neighbors []Neighbor
GvisorGROTimeout time.Duration
// NumChannels controls how many underlying FDs are to be used to
// create this endpoint.
NumChannels int
}
// LoopbackLink configures a loopback link.
// LoopbackLink configures a loopback li nk.
type LoopbackLink struct {
Name string
Addresses []IPWithPrefix
Routes []Route
GvisorGROTimeout time.Duration
Name string
Addresses []IPWithPrefix
Routes []Route
}
// CreateLinksAndRoutesArgs are arguments to CreateLinkAndRoutes.
@@ -218,10 +216,7 @@ func (n *Network) CreateLinksAndRoutes(args *CreateLinksAndRoutesArgs, _ *struct
linkEP := packetsocket.New(ethernet.New(loopback.New()))
log.Infof("Enabling loopback interface %q with id %d on addresses %+v", link.Name, nicID, link.Addresses)
opts := stack.NICOptions{
Name: link.Name,
GROTimeout: link.GvisorGROTimeout,
}
opts := stack.NICOptions{Name: link.Name}
if err := n.createNICWithAddrs(nicID, linkEP, opts, link.Addresses); err != nil {
return err
}
@@ -388,9 +383,8 @@ func (n *Network) CreateLinksAndRoutes(args *CreateLinksAndRoutesArgs, _ *struct
log.Infof("Enabling interface %q with id %d on addresses %+v (%v) w/ %d channels", link.Name, nicID, link.Addresses, mac, link.NumChannels)
opts := stack.NICOptions{
Name: link.Name,
QDisc: qDisc,
GROTimeout: link.GvisorGROTimeout,
Name: link.Name,
QDisc: qDisc,
}
if err := n.createNICWithAddrs(nicID, sniffEP, opts, link.Addresses); err != nil {
return err
+6 -10
View File
@@ -60,7 +60,7 @@ func setupNetwork(conn *urpc.Client, pid int, conf *config.Config) error {
switch conf.Network {
case config.NetworkNone:
log.Infof("Network is disabled, create loopback interface only")
if err := createDefaultLoopbackInterface(conf, conn); err != nil {
if err := createDefaultLoopbackInterface(conn); err != nil {
return fmt.Errorf("creating default loopback interface: %v", err)
}
case config.NetworkSandbox:
@@ -78,11 +78,9 @@ func setupNetwork(conn *urpc.Client, pid int, conf *config.Config) error {
return nil
}
func createDefaultLoopbackInterface(conf *config.Config, conn *urpc.Client) error {
link := boot.DefaultLoopbackLink
link.GvisorGROTimeout = conf.GvisorGROTimeout
func createDefaultLoopbackInterface(conn *urpc.Client) error {
if err := conn.Call(boot.NetworkCreateLinksAndRoutes, &boot.CreateLinksAndRoutesArgs{
LoopbackLinks: []boot.LoopbackLink{link},
LoopbackLinks: []boot.LoopbackLink{boot.DefaultLoopbackLink},
}, nil); err != nil {
return fmt.Errorf("creating loopback link and routes: %v", err)
}
@@ -159,7 +157,7 @@ func createInterfacesAndRoutesFromNS(conn *urpc.Client, nsPath string, conf *con
// We build our own loopback device.
if iface.Flags&net.FlagLoopback != 0 {
link, err := loopbackLink(conf, iface, allAddrs)
link, err := loopbackLink(iface, allAddrs)
if err != nil {
return fmt.Errorf("getting loopback link for iface %q: %w", iface.Name, err)
}
@@ -263,7 +261,6 @@ func createInterfacesAndRoutesFromNS(conn *urpc.Client, nsPath string, conf *con
Neighbors: neighbors,
LinkAddress: linkAddress,
Addresses: addresses,
GvisorGROTimeout: conf.GvisorGROTimeout,
})
} else {
link := boot.FDBasedLink{
@@ -495,10 +492,9 @@ func createSocketXDP(iface net.Interface) ([]*os.File, error) {
// loopbackLink returns the link with addresses and routes for a loopback
// interface.
func loopbackLink(conf *config.Config, iface net.Interface, addrs []net.Addr) (boot.LoopbackLink, error) {
func loopbackLink(iface net.Interface, addrs []net.Addr) (boot.LoopbackLink, error) {
link := boot.LoopbackLink{
Name: iface.Name,
GvisorGROTimeout: conf.GvisorGROTimeout,
Name: iface.Name,
}
for _, addr := range addrs {
ipNet, ok := addr.(*net.IPNet)
-1
View File
@@ -229,7 +229,6 @@ func runRunsc(tc *gtest.TestCase, spec *specs.Spec) error {
"-watchdog-action=panic",
"-platform", *platform,
"-file-access", *fileAccess,
"-gvisor-gro=200000ns",
}
if *network == "host" && !testutil.TestEnvSupportsRawSockets {