Skip to content

Commit fa9fca0

Browse files
committed
remove force cast of link to RTNLLinkBridge
1 parent a873564 commit fa9fca0

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Examples/nltool/main.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ func findBridge(index: Int, socket: NLSocket) async throws -> RTNLLinkBridge {
8080
}
8181

8282
func add_vlan(command: Command, socket: NLSocket, link: RTNLLink, arg: String) async throws {
83-
guard let vlan = UInt16(arg) else { usage() }
84-
try await (link as! RTNLLinkBridge).add(vlans: Set([vlan]), socket: socket)
83+
guard let link = link as? RTNLLinkBridge, let vlan = UInt16(arg) else { usage() }
84+
try await link.add(vlans: Set([vlan]), socket: socket)
8585
}
8686

8787
func del_vlan(command: Command, socket: NLSocket, link: RTNLLink, arg: String) async throws {
88-
guard let vlan = UInt16(arg) else { usage() }
89-
try await (link as! RTNLLinkBridge).remove(vlans: Set([vlan]), socket: socket)
88+
guard let link = link as? RTNLLinkBridge, let vlan = UInt16(arg) else { usage() }
89+
try await link.remove(vlans: Set([vlan]), socket: socket)
9090
}
9191

9292
func add_fdb(

0 commit comments

Comments
 (0)