On Wed, 2010-06-02 at 14:42 +0400, Alexander Zhukov wrote:
> >>>>> Fredrik Thulin (FT) writes:
> 

>  >> Why incomingroxy sets source IP address of the outgoing packet?
>  >> Usually this job is done by an IP stack. Application which sits on
>  >> the "application" level should not bother with such low level
>  >> details.
> 
>  FT> I agree about the principle. IIRC, YXA opens a separate UDP socket
>  FT> per interface to be able to distinguish the IP address someone
>  FT> sends packets to. There might be better ways to do this, and I'm
>  FT> not sure it was the only reason.
> 
> Sorry, I do not understand it. Why do you need to distinghuish the IP
> adresses by interfaces? Again, I'm no expert in Erlnag networking but I
> can't think of any reason to have a separate UPD socket per interface.
> 

YXA needs to know which IP address it receives requests on over UDP to
be able to support symmetric response routing (RFC 3581), I think. When
using symmetric response routing it isn't enough to send the response to
the IP address and port you received it from, you also need to send the
response from the same IP address and port you received the request on.
This is to play nice with NAT:s sitting between the two SIP devices.

/Mikael

> >From my point of view it can be as simple as this:
> 
> 1. One listening UPD socket. It will receive incoming packets from all
>    interfaces.
> 

Then you need to use recvmsg, which I think is not supported in Erlang.

> 2. Some number of unbound UDP sockets to send outgoing packets.
> 
> This way you should not think about interfaces at all. And it seems to
> be quite portable.
> 

Requires sendmsg, again unsupported in Erlang. 

>  FT> So, what a running YXA server has to use for sending datagrams is a
>  FT> list of UDP sockets. All sockets are tried (see
>  FT> src/transportlayer/sipsocket_udp.erl function do_send/5) until the
>  FT> OS says that a socket worked for sending to that particular
>  FT> destination.
> 
> I do no like the idea. Just the ability to send a packet do warrant you
> nothing. To do the right thing you should be able to send a "reply"
> packet by the same interface you got the "initial" packet. Or, more
> generally, the choice of the interface should be based on the dest IP
> and the interface IP. Going this way you may end up writing a small IP
> router inside YXA aplication.  (OK, this was a joke :) I do not want to
> offend anybody.)
> 

There isn't a one-to-one mapping between interface and IP-addresses. Any
number of IP addresses can be bound to one interface. And these IP
addresses can be in the same or different networks. 

/Mikael

_______________________________________________
Yxa-devel mailing list
Yxa-devel@lists.su.se
https://lists.su.se/mailman/listinfo/yxa-devel

Reply via email to