From 41ac15d1007e1e00b0aeacf9dff67a60ed3488b4 Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Sun, 19 Dec 2021 21:18:13 +0100 Subject: #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(). --- src/ogAdmServer.c | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) (limited to 'src/ogAdmServer.c') 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]; -- cgit v1.2.3-18-g5258