[This is the patch for an idea I posted several weeks ago to the devel list.
Below is the original list posting as an explanation.]
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
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:
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:
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,
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.