[OpenSIPS-Devel] Change to listen= syntax to support per-interface advertised address...

Phil D'Amore ptdamore at gmail.com
Tue Feb 3 15:32:06 CET 2009


Hello:

A while back (around openser 1.3 time) I tried to get some feedback
for this functionality that I've been using for a while.  Now that I'm
having to port it to opensips 1.5.0 I figured I'd try to put it out
here and see what happens:

The patch extends the idea of the advertised_address and advertised_port
parameters so that it is possible to bind such an address to each
listen= statement.
Syntax-wise, it works like this:

   listen=[proto:]host[:port][ AS host[:port]]

This new AS host[:port] syntax binds the advertised address specifically to the
corresponding socket_info structure.  If such an address is specified, it will
be used before the address specified as advertised_address, or set in the
set_advertised_address function for packets being sent on that particular
socket.  If it is not specified, then the old methods work as before.

The core has been modified so that address tuples using the advertised address
work interchangeably with the real address where you'd expect them to.
grep_sock_info and find_si have been updated to allow this.  Therefore, it is
not necessary to explicitly name your advertised address on an alias= line.
The following are now equivalent:

   force_send_socket(udp:adv_address:adv_port);
   force_send_socket(udp:real_address:real_port);

Note we don't specify protocol on the advertised address.  The way I see
things, it makes no sense to advertise a different protocol, so it inherits the
protocol of the socket.

Via construction is affected in the same way that the old global
advertised_address does, except the Via is written specifically for
the socket used
to send the message.

Lump substitution is also affected.  The following lump substitutions are aware
of this new facility:

 SUBST_RCV_IP
 SUBST_RCV_PORT
 SUBST_RCV_ALL
 SUBST_SND_IP
 SUBST_SND_PORT
 SUBST_SND_ALL

As a result of this, I was able to stop using record_route_preset in
my own config, and
just use standard record_route.  This winds up working much better,
because double-rr
works properly, and add_rr_param now works as expected for me, where it was a
problem using record_route_preset.

Additionally, registrar and usrloc had to be modified:

registrar - update the add_sock_hdr function to put the advertised address in
the message instead of the real address.  This allows registration information
to be replicated between multi-homed proxies, and the correct interface on the
peer can be used.

usrloc - update db_insert_ucontact to store the advertised address in the
database instead of the real address.  Same reasoning as the mods to registrar.

If there's any interest, I can submit a patch and more details about
how it works.

Thanks,
Phil



More information about the Devel mailing list