[Libwebsockets] Filtering on client IP

"Andy Green (林安廸)" andy at warmcat.com
Fri Jan 3 05:07:34 CET 2014


On 02/01/14 22:14, the mail apparently from Thomas Spitz included:
> Dear all,
>
> Is there someone who tried to filter client connection using their IP
> (using white and/or black list approach).

This is less about connection filtering and more about name lookup.

> 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...

If enabled, it works here on Linux

Received network connect from localhost (127.0.0.1)
Received network connect from localhost (127.0.0.1)

Do you have any name resolution arrangements on the server machine? 
Connection Refused sounds like it'll be referring to that.

-Andy

> BR,
> Thomas
>
>
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://ml.libwebsockets.org/mailman/listinfo/libwebsockets
>




More information about the Libwebsockets mailing list