Skip to content

Commit 1c01d0c

Browse files
authored
Update to kata 3.20.0 kernel. (apple#1114)
- Closes apple#1113. - This is the newest we can do until we address apple#767. - Slight change to PacketFilter error handling so unit tests work more reliably. - Try making CLINetworkTests serialized to see if parallel execution is causing flakes.
1 parent 3f2060e commit 1c01d0c

File tree

3 files changed

+37
-32
lines changed

3 files changed

+37
-32
lines changed

‎Sources/ContainerPersistence/DefaultsStore.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ extension DefaultsStore.Keys {
181181
}
182182
return "ghcr.io/apple/containerization/vminit:\(tag)"
183183
case .defaultKernelBinaryPath:
184-
return "opt/kata/share/kata-containers/vmlinux-6.12.28-153"
184+
return "opt/kata/share/kata-containers/vmlinux-6.12.42-162"
185185
case .defaultKernelURL:
186-
return "https://github.com/kata-containers/kata-containers/releases/download/3.17.0/kata-static-3.17.0-arm64.tar.xz"
186+
return "https://github.com/kata-containers/kata-containers/releases/download/3.20.0/kata-static-3.20.0-arm64.tar.xz"
187187
case .defaultSubnet:
188188
return "192.168.64.1/24"
189189
case .defaultIPv6Subnet:

‎Sources/Services/ContainerAPIService/Client/PacketFilter.swift‎

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -159,40 +159,44 @@ public struct PacketFilter {
159159
}
160160

161161
public func reinitialize() throws {
162+
let null = FileHandle.nullDevice
163+
164+
let checkProcess = Foundation.Process()
165+
var checkStatus: Int32
166+
checkProcess.executableURL = URL(fileURLWithPath: "/sbin/pfctl")
167+
checkProcess.arguments = ["-n", "-f", configURL.path]
168+
checkProcess.standardOutput = null
169+
checkProcess.standardError = null
170+
162171
do {
163-
let pfctl = Foundation.Process()
164-
let null = FileHandle.nullDevice
165-
var status: Int32
166-
167-
pfctl.executableURL = URL(fileURLWithPath: "/sbin/pfctl")
168-
pfctl.arguments = ["-n", "-f", configURL.path]
169-
pfctl.standardOutput = null
170-
pfctl.standardError = null
171-
172-
try pfctl.run()
173-
pfctl.waitUntilExit()
174-
status = pfctl.terminationStatus
175-
guard status == 0 else {
176-
throw ContainerizationError(.internalError, message: "invalid pf config \"\(configURL.path)\"")
177-
}
172+
try checkProcess.run()
173+
} catch {
174+
throw ContainerizationError(.internalError, message: "pfctl rule check exec failed: \"\(error)\"")
175+
}
176+
177+
checkProcess.waitUntilExit()
178+
checkStatus = checkProcess.terminationStatus
179+
guard checkStatus == 0 else {
180+
throw ContainerizationError(.internalError, message: "invalid pf config \"\(configURL.path)\"")
178181
}
179182

183+
let reloadProcess = Foundation.Process()
184+
var reloadStatus: Int32
185+
186+
reloadProcess.executableURL = URL(fileURLWithPath: "/sbin/reloadProcess")
187+
reloadProcess.arguments = ["-f", configURL.path]
188+
reloadProcess.standardOutput = null
189+
reloadProcess.standardError = null
190+
180191
do {
181-
let pfctl = Foundation.Process()
182-
let null = FileHandle.nullDevice
183-
var status: Int32
184-
185-
pfctl.executableURL = URL(fileURLWithPath: "/sbin/pfctl")
186-
pfctl.arguments = ["-f", configURL.path]
187-
pfctl.standardOutput = null
188-
pfctl.standardError = null
189-
190-
try pfctl.run()
191-
pfctl.waitUntilExit()
192-
status = pfctl.terminationStatus
193-
guard status == 0 else {
194-
throw ContainerizationError(.invalidState, message: "pfctl -f \"\(configURL.path)\" failed with status \(status)")
195-
}
192+
try reloadProcess.run()
193+
} catch {
194+
throw ContainerizationError(.internalError, message: "pfctl reload exec failed: \"\(error)\"")
195+
}
196+
reloadProcess.waitUntilExit()
197+
reloadStatus = reloadProcess.terminationStatus
198+
guard reloadStatus == 0 else {
199+
throw ContainerizationError(.invalidState, message: "pfctl -f \"\(configURL.path)\" failed with status \(reloadStatus)")
196200
}
197201
}
198202
}

‎Tests/CLITests/Subcommands/Networks/TestCLINetwork.swift‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import ContainerizationOS
2222
import Foundation
2323
import Testing
2424

25+
@Suite(.serialized)
2526
class TestCLINetwork: CLITest {
2627
private static let retries = 10
2728
private static let retryDelaySeconds = Int64(3)

0 commit comments

Comments
 (0)