summaryrefslogtreecommitdiffstats
path: root/src/ogAdmServer.c
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2021-12-19 21:18:13 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2021-12-20 12:18:46 +0100
commit41ac15d1007e1e00b0aeacf9dff67a60ed3488b4 (patch)
tree995894b107b893efc2914cd76b50c9fec099e821 /src/ogAdmServer.c
parentdd578a944e08ff17805a95aff67d707dc6d02424 (diff)
#915 Remove useless WoL shim code
Levanta() is not required, iterate over the array of IP address and make direct calls to WakeUp(). This is also implicitly fixing up a memleak in og_cmd_wol().
Diffstat (limited to 'src/ogAdmServer.c')
-rw-r--r--src/ogAdmServer.c36
1 files changed, 1 insertions, 35 deletions
diff --git a/src/ogAdmServer.c b/src/ogAdmServer.c
index 17c9d39..6f6de54 100644
--- a/src/ogAdmServer.c
+++ b/src/ogAdmServer.c
@@ -271,40 +271,6 @@ int checkDato(struct og_dbi *dbi, char *dato, const char *tabla,
return (identificador);
}
-// ________________________________________________________________________________________________________
-// Función: Levanta
-//
-// Descripción:
-// Enciende ordenadores a través de la red cuyas macs se pasan como parámetro
-// Parámetros:
-// - iph: Cadena de direcciones ip separadas por ";"
-// - mac: Cadena de direcciones mac separadas por ";"
-// - mar: Método de arranque (1=Broadcast, 2=Unicast)
-// Devuelve:
-// true: Si el proceso es correcto
-// false: En caso de ocurrir algún error
-// ________________________________________________________________________________________________________
-
-bool Levanta(char *ptrIP[], char *ptrMacs[], char *ptrNetmasks[], int lon,
- char *mar)
-{
- int i, s;
-
- s = wol_socket_open();
- if (s < 0)
- return false;
-
- for (i = 0; i < lon; i++) {
- if (!WakeUp(s, ptrIP[i], ptrMacs[i], ptrNetmasks[i], mar)) {
- syslog(LOG_ERR, "problem sending magic packet\n");
- close(s);
- return false;
- }
- }
- close(s);
- return true;
-}
-
enum wol_delivery_type {
OG_WOL_BROADCAST = 1,
OG_WOL_UNICAST = 2
@@ -325,7 +291,7 @@ enum wol_delivery_type {
// false: En caso de ocurrir algún error
//_____________________________________________________________________________________________________________
//
-bool WakeUp(int s, char* iph, char *mac, char *netmask, char *mar)
+bool WakeUp(int s, const char *iph, const char *mac, const char *netmask, const char *mar)
{
struct in_addr addr, netmask_addr, broadcast_addr ={};
unsigned int macaddr[OG_WOL_MACADDR_LEN];