summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/taskmanager
diff options
context:
space:
mode:
authorSimon Rettberg2020-09-03 11:53:17 +0200
committerSimon Rettberg2020-09-03 11:53:17 +0200
commitf5487ac4acea9f180fe2e18f968a87ea9810c2cf (patch)
tree9d58aec093a12b947da37524646b969e7a64750c /src/main/java/org/openslx/taskmanager
parent[sshd] Remove deprecated options (diff)
downloadtmlite-bwlp-f5487ac4acea9f180fe2e18f968a87ea9810c2cf.tar.gz
tmlite-bwlp-f5487ac4acea9f180fe2e18f968a87ea9810c2cf.tar.xz
tmlite-bwlp-f5487ac4acea9f180fe2e18f968a87ea9810c2cf.zip
[WakeOnLan] Make dest port configurable
Diffstat (limited to 'src/main/java/org/openslx/taskmanager')
-rw-r--r--src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java b/src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java
index 74b776d..246749a 100644
--- a/src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java
+++ b/src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java
@@ -31,6 +31,9 @@ public class WakeOnLan extends AbstractTask
@Expose
private String password;
+
+ @Expose
+ private int port;
private StatusObject status;
@@ -77,6 +80,12 @@ public class WakeOnLan extends AbstractTask
return false;
}
}
+ if ( this.port == 0 ) {
+ this.port = 9;
+ } else if ( this.port > 65535 || this.port < 0 ) {
+ status.addMsg( "Invalid port: " + this.port );
+ return false;
+ }
return true;
}
@@ -126,7 +135,7 @@ public class WakeOnLan extends AbstractTask
status.addMsg( "Invalid octet in MAC address: " + macs[mi] );
continue;
}
- DatagramPacket dp = new DatagramPacket( buffer, buffer.length, InetAddress.getByName( ip ), 9 );
+ DatagramPacket dp = new DatagramPacket( buffer, buffer.length, InetAddress.getByName( ip ), this.port );
try {
sock.send( dp );
status.addMsg( "Sent packet to " + macs[mi] );