[Users] TCP socket problem

Klaus Darilion klaus.mailinglists at pernau.at
Wed Aug 17 20:46:24 CEST 2005


Bogdan-Andrei Iancu wrote:
> Hi Klaus,
> 
> the fix it's on cvs - any feedback will be helpful :)

Hi Bogdan!

I made some tests (listen on one interface, on multiple interfaces, 
changing the order of the interfaces, using force_send_socket) and 
everything worked as I expected it - no problems.

Thanks a lot for the fix (and all the other fixes).

regards
klaus

PS: It somehow wonders me that nobody found this bug before. Maybe 
nobody uses TCP :-(

> 
> regards,
> bogdan
> 
> Bogdan-Andrei Iancu wrote:
> 
>> Hi Klaus,
>>
>> I already tested bind with port 0 on linux and BSD kernels and works - 
>> but I have no access other OS, like solaris for example.
>> if same scheme is used in netcat, I would say is a good argument to 
>> for it (until proved otherwise :-/) - if no force_socket is used, the 
>> first listening TCP address will be used; otherwise the IP from forced 
>> socket.
>>
>> what I'm still looking for is to try to maintain the same interface in 
>> case of forwarding from TCP2TCP - if received over TCP on interface1, 
>> use the same (if not forced) interface to fwd.
>>
>> hopefully the code will be ready today.
>>
>> regards,
>> bogdan
>>
>> Klaus Darilion wrote:
>>
>>> Klaus Darilion wrote:
>>>
>>>> Bogdan-Andrei Iancu wrote:
>>>>  > I know no way to bind only to an address but letting the kernel to
>>>>
>>>>> choose the port (a portable solution)......
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> What about setting the port to 0? I tried it and it works on Linux. 
>>>> Do you think that this does not work on other OS?
>>>
>>>
>>>
>>>
>>> I reviewed the source code of netcat (which is quiet portable) and 
>>> netcat also does it this way:
>>>   socket()
>>>   bind()
>>>   connect()
>>>
>>> When binding, the "dynamic" part (address or port) will be set to 0.
>>>
>>> I think we should also implement this in openser. If openser listen 
>>> only on one interface the bind logic is simple: take this IP address.
>>>
>>> If openser listens to multiple IP addresses we can just use the first 
>>> IP address, or we can have a logic which chooses the best IP address 
>>> (e.g. the IP address, on which the request was received).
>>>
>>> regards
>>> klaus
>>
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at openser.org
>> http://openser.org/cgi-bin/mailman/listinfo/users
>>
> 
> 





More information about the Users mailing list