Skip to content

Commit 7449352

Browse files
committed
CA-420524 Do not allow input a non-exist device in network reset
Find the device from /sys/class/net/ to check if it exists. Signed-off-by: Changlei Li <[email protected]>
1 parent b64a761 commit 7449352

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

plugins-base/XSFeatureNetworkReset.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ def HandleKeyDEVICE(self, inKey):
216216
if self.device == "":
217217
pane.InputIndexSet(None)
218218
Layout.Inst().PushDialogue(InfoDialogue(Lang('Invalid device name')))
219+
elif not os.path.isdir('/sys/class/net/' + self.device):
220+
pane.InputIndexSet(None)
221+
Layout.Inst().PushDialogue(InfoDialogue(Lang('Device does not exist')))
219222
elif (self.vlan != '') and not valid_vlan(self.vlan):
220223
pane.InputIndexSet(None)
221224
Layout.Inst().PushDialogue(InfoDialogue(Lang('VLAN tag must be between 0 and 4094')))

0 commit comments

Comments
 (0)