kiss9815 / mongoose

Automatically exported from code.google.com/p/mongoose
MIT License
0 stars 0 forks source link

Poor behavior on kernel without IPv6 support when compiled with USE_IPV6 #393

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile mongoose with USE_IPV6
2. Compile linux kernel without IPv6 support
3. Run mongoose under this kernel

Right now, application fails to start with
'set_ports_option: cannot bind to <PORT>: Bad File Number.

'Bad file number' is due to closesocket(-1), which should be moved after cry(), 
since it modifies errno.

In this environment, mongoose should try to fall back to IPv4. 

For example, when 'sock = socket(so.lsa.sa.sa_family, SOCK_STREAM, 6)' fails, 
call should be retried with 
  so.lsa.sa.sa_family = AF_INET;
  so.lsa.sin.sin_port = so.lsa.sin6.sin6_port;

What version of the product are you using? On what operating system?
mongoose from git trunk, Linux kernel 2.6.29 without IPv6 support.

Impact: Android 2.x kernels are compiled without IPv6 support. Making universal 
binary which runs on every platform and optionally uses IPv6 is impossible 
right now.

Mentioned code is located near mongoose.c:4396.

Original issue reported on code.google.com by pas.n...@gmail.com on 23 Jan 2013 at 2:51