From: Floris Bos Date: Fri, 17 Feb 2017 14:36:48 +0000 (+0100) Subject: Add basic IPv6 support X-Git-Tag: archive/raspbian/1.68-2+rpi1~63^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=7eec4b6c8881bec2a237ef146fb7ba048ea5fc66;p=pigpio.git Add basic IPv6 support Add IPv6 support to daemon and python library. IPv6 was already supported by the C client library. Currently there is no support for whitelisting IPv6 client addresses implemented, so for now it reverts to listening to IPv4 only when the -n option is specified. Signed-off-by: Floris Bos --- 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