diff --git a/pigpio.c b/pigpio.c index 3bacc20..570a8a2 100644 --- a/pigpio.c +++ b/pigpio.c @@ -6972,12 +6972,18 @@ static void *pthSocketThreadHandler(void *fdC) return 0; } -static int addrAllowed(uint32_t addr) +static int addrAllowed(struct sockaddr *saddr) { int i; + uint32_t addr; if (!numSockNetAddr) return 1; + // FIXME: add IPv6 whitelisting support + if (saddr->sa_family != AF_INET) return 0; + + addr = ((struct sockaddr_in *) saddr)->sin_addr.s_addr; + for (i=0; i