[Libwebsockets] Why is it necessary to set a route for libwebsocket even when server and client are on the same network

Thomas Spitz thomas.spitz at hestia-france.com
Wed Apr 15 10:38:48 CEST 2015


Hello everybody,

I am using libwebsocket to connect a client and a server that are on the
same subnetwork. (eg: 192.168.1.5 and 192.168.1.6).

Here is what I do to configure statically my server IP parameters:

>  # ip link set eth0 up
>  # ip addr add 192.168.1.5/24 broadcast + dev eth0


If I check route at this stage, i see the following:

>  # ip route
> 127.0.0.0/8 dev lo  scope link
> 192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.5


At this stage, if I try to connect to the server it hangs up.

 Then if I do

>  # ip route add default via 192.168.1.x with x between 0 and 255 OR ip
> route add default via 0.0.0.0

Now the server replies correctly but I don't see any change using ip route
command:

>  # ip route
> 127.0.0.0/8 dev lo  scope link
> 192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.5


I don't understand why libwebsocket need to know a route in order to reply
to a client on the same network?

Last question: if I give a gateway address that is not on the same
subnetwork as the server (customer wrong setting), eg:

> #ip route add default via 192.167.1.2.

RTNETLINK answers: Network is unreachable


Again, the libwebsocket doesn't respond anymore.

Sorry if it is network basics questions....

Thanks in advance for your answers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libwebsockets.org/pipermail/libwebsockets/attachments/20150415/63e3a256/attachment.html>


More information about the Libwebsockets mailing list