[Libwebsockets] Filtering on client IP

Thomas Spitz thomas.spitz at hestia-france.com
Thu Jan 2 15:14:45 CET 2014


Dear all,

Is there someone who tried to filter client connection using their IP
(using white and/or black list approach).

In test-server.c I have uncommented the following line

> libwebsockets_get_peer_addresses(context, wsi, (int)(long)in, client_name,
>  sizeof(client_name), client_ip, sizeof(client_ip));
>  fprintf(stderr, "Received network connect from %s (%s)\n", client_name,
> client_ip);

But all I get is :

>  gethostbyaddr: Connection refused
> Received network connect from  ()


It seems that this line

> host = gethostbyaddr((char *) &sin.sin_addr,
> sizeof(sin.sin_addr), AF_INET);

always returns NULL..

I haven't investigate much yet...

BR,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libwebsockets.org/pipermail/libwebsockets/attachments/20140102/a0a76892/attachment.html>


More information about the Libwebsockets mailing list