diff options
author | OpenGnSys Support Team <soporte-og@soleta.eu> | 2020-08-06 13:36:47 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2020-08-06 13:39:46 +0200 |
commit | 060e31cb53386282f1995937c18fe39855865046 (patch) | |
tree | 7fd99b05a839fcd31a9bbce4deda5ad7ceb504b0 /src/ogAdmServer.c | |
parent | 1855b68af3ee365f871090c840f728691dd687de (diff) |
#990 add wol_socket_open()
Add wol_socket_open() to initialize the WoL socket
Diffstat (limited to 'src/ogAdmServer.c')
-rw-r--r-- | src/ogAdmServer.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/src/ogAdmServer.c b/src/ogAdmServer.c index 3ba5b30..90dd0c8 100644 --- a/src/ogAdmServer.c +++ b/src/ogAdmServer.c @@ -455,27 +455,11 @@ int checkDato(struct og_dbi *dbi, char *dato, const char *tabla, bool Levanta(char *ptrIP[], char *ptrMacs[], char *ptrNetmasks[], int lon, char *mar) { - unsigned int on = 1; - struct sockaddr_in local; - int i, res; - int s; - - /* Creación de socket para envío de magig packet */ - s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (s < 0) { - syslog(LOG_ERR, "cannot create socket for magic packet\n"); - return false; - } - res = setsockopt(s, SOL_SOCKET, SO_BROADCAST, (unsigned int *) &on, - sizeof(on)); - if (res < 0) { - syslog(LOG_ERR, "cannot set broadcast socket\n"); + int i, s; + + s = wol_socket_open(); + if (s < 0) return false; - } - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_port = htons(PUERTO_WAKEUP); - local.sin_addr.s_addr = htonl(INADDR_ANY); for (i = 0; i < lon; i++) { if (!WakeUp(s, ptrIP[i], ptrMacs[i], ptrNetmasks[i], mar)) { |