[OpenSER-Devel] [ openser-Patches-1811125 ] Multi-interface friendly advertised_address functionality

SourceForge.net noreply at sourceforge.net
Fri Dec 14 21:08:22 UTC 2007


Patches item #1811125, was opened at 2007-10-10 15:36
Message generated for change (Comment added) made by ptdamore
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=1811125&group_id=139143

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Phil D'Amore (ptdamore)
Assigned to: Nobody/Anonymous (nobody)
Summary: Multi-interface friendly advertised_address functionality

Initial Comment:
The attached patch extended the idea of an advertised address 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.  If it is not specified, then those methods work as before.

The core has been modified so that address tuples using the advertised address work interchangably 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 nexessary 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 properly 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, 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 have been 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.


This code was originaly written for 1.1.x, and I've been using it quite happily for about a year now.  I ported it to 1.2 with the hope of getting it submitted for 1.3, but time got the better of me.  I've now ported this to HEAD, and have tested that the functionality still works as compared to in my production 1.1.1 setup.  So at this point, I'd like to get this patch in here and hopefully someone can think about it for 1.4.

Any constructive comments on the functionality of the implementation would also be welcome.

Here is a (hopefully complete) breakdown of the modified files.  No files were added:

cfg.lex - new listen syntax
cfg.y - new listen syntax

ip_addr.h - socket_info and socket_id expanded to hold the advertised address data.
main.c - update for new add_listen_iface prototype

msg_translator.c - lump and via support.

socket_info.[ch] - add_listen_interface updated to accept the advertised information, and socket2str expanded to accept a flag to request the real address or the advertised address

socket_info.c - grep_sock_info and find_si updated to work with the advertised addresses.

modules/lcr/lcr_mod.c - updated to call socket2str the new way.

modules/registrar/reg_mod.c - update to place the advertised address in the socket info header.

modules/usrloc/ucontact.c - updated to save the advertised address in the database.
modules/usrloc/ul_mi.c - updated to return the advertised address of the socket.


----------------------------------------------------------------------

>Comment By: Phil D'Amore (ptdamore)
Date: 2007-12-14 16:08

Message:
Logged In: YES 
user_id=1596829
Originator: YES

File Added: listen_alias.patch

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=1811125&group_id=139143



More information about the Devel mailing list