FreeSWITCH

Improvements to nat_map

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Patch Patch
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: freeswitch-core
  • Platform:
    Linux x86/gcc
  • FreeSWITCH GIT Revision:
    13748
  • Reproduced with GIT HEAD?:
    yes
  • Description:
    Hide
    This is a work in progress.

    This patch adds a few features to nat_map.

    1) nat_map status and nat_map_reinit and nat_map_republish. These api commands should be self-evident.
    2) we keep track of the current maps in a hash so we can republish when necessary
    3) there is a new thread that listens on the appropriate multicast address and republishes the nat mapping when it gets an event from the router and also re-inits the nat subsystem in the event of an ip addr change.

    Some of the code is a bit ugly. :(

    Nothing is hooked into the nat stuff changing. I believe we should publish a NAT event with appropriate details that other subsystems should listen for and reconfigure when the nat info changes.

    we can publish:

    1) nat maps published
    2) ip addr changed
    3) nat gateway went down cleanly (only appropriate for upnp)
    Show
    This is a work in progress. This patch adds a few features to nat_map. 1) nat_map status and nat_map_reinit and nat_map_republish. These api commands should be self-evident. 2) we keep track of the current maps in a hash so we can republish when necessary 3) there is a new thread that listens on the appropriate multicast address and republishes the nat mapping when it gets an event from the router and also re-inits the nat subsystem in the event of an ip addr change. Some of the code is a bit ugly. :( Nothing is hooked into the nat stuff changing. I believe we should publish a NAT event with appropriate details that other subsystems should listen for and reconfigure when the nat info changes. we can publish: 1) nat maps published 2) ip addr changed 3) nat gateway went down cleanly (only appropriate for upnp)
  1. nat.patch.txt
    (31 kB)
    Rupa Schomaker
    30/Jun/09 10:29 AM
  2. nat.patch.txt
    (31 kB)
    Rupa Schomaker
    27/Jun/09 4:18 AM
  3. nat.patch.txt
    (16 kB)
    Rupa Schomaker
    23/Jun/09 12:19 PM
  4. nat.patch.txt
    (16 kB)
    Rupa Schomaker
    17/Jun/09 9:58 AM
  5. nat.patch.txt
    (16 kB)
    Rupa Schomaker
    10/Jun/09 2:35 PM

Activity

Hide
Rupa Schomaker added a comment - 17/Jun/09 9:58 AM
Ran through valgrind. Only issues remaining are the two below. Issue 1 is from a debug log which will be removed prior to applying. Second is... not sure what I can do about that.

Attached updated patch fixes a couple of memory leaks.

==19720== Invalid read of size 1
==19720== at 0x4C240A4: strlen (mc_replace_strmem.c:242)
==19720== by 0x61AF9AD: vfprintf (in /lib/libc-2.9.so)
==19720== by 0x61D043E: vasprintf (in /lib/libc-2.9.so)
==19720== by 0x50F7829: switch_vasprintf (switch_apr.c:940)
==19720== by 0x51626C8: switch_log_vprintf (switch_log.c:312)
==19720== by 0x51623ED: switch_log_printf (switch_log.c:265)
==19720== by 0x5160051: init_upnp (switch_nat.c:118)
==19720== by 0x5160D43: switch_nat_init (switch_nat.c:401)
==19720== by 0x511FA58: switch_core_init (switch_core.c:1236)
==19720== by 0x51202D6: switch_core_init_and_modload (switch_core.c:1421)
==19720== by 0x402CDF: main (switch.c:707)
==19720== Address 0x733183a is 0 bytes after a block of size 2,970 alloc'd
==19720== at 0x4C23A51: realloc (vg_replace_malloc.c:429)
==19720== by 0x517B3A0: miniwget2 (miniwget.c:136)
==19720== by 0x517B644: miniwget (miniwget.c:206)
==19720== by 0x515FFF7: init_upnp (switch_nat.c:114)
==19720== by 0x5160D43: switch_nat_init (switch_nat.c:401)
==19720== by 0x511FA58: switch_core_init (switch_core.c:1236)
==19720== by 0x51202D6: switch_core_init_and_modload (switch_core.c:1421)
==19720== by 0x402CDF: main (switch.c:707)
Show
Rupa Schomaker added a comment - 17/Jun/09 9:58 AM Ran through valgrind. Only issues remaining are the two below. Issue 1 is from a debug log which will be removed prior to applying. Second is... not sure what I can do about that. Attached updated patch fixes a couple of memory leaks. ==19720== Invalid read of size 1 ==19720== at 0x4C240A4: strlen (mc_replace_strmem.c:242) ==19720== by 0x61AF9AD: vfprintf (in /lib/libc-2.9.so) ==19720== by 0x61D043E: vasprintf (in /lib/libc-2.9.so) ==19720== by 0x50F7829: switch_vasprintf (switch_apr.c:940) ==19720== by 0x51626C8: switch_log_vprintf (switch_log.c:312) ==19720== by 0x51623ED: switch_log_printf (switch_log.c:265) ==19720== by 0x5160051: init_upnp (switch_nat.c:118) ==19720== by 0x5160D43: switch_nat_init (switch_nat.c:401) ==19720== by 0x511FA58: switch_core_init (switch_core.c:1236) ==19720== by 0x51202D6: switch_core_init_and_modload (switch_core.c:1421) ==19720== by 0x402CDF: main (switch.c:707) ==19720== Address 0x733183a is 0 bytes after a block of size 2,970 alloc'd ==19720== at 0x4C23A51: realloc (vg_replace_malloc.c:429) ==19720== by 0x517B3A0: miniwget2 (miniwget.c:136) ==19720== by 0x517B644: miniwget (miniwget.c:206) ==19720== by 0x515FFF7: init_upnp (switch_nat.c:114) ==19720== by 0x5160D43: switch_nat_init (switch_nat.c:401) ==19720== by 0x511FA58: switch_core_init (switch_core.c:1236) ==19720== by 0x51202D6: switch_core_init_and_modload (switch_core.c:1421) ==19720== by 0x402CDF: main (switch.c:707)
Hide
Rupa Schomaker added a comment - 17/Jun/09 10:01 AM
Assigning to anthm for review.

Tony, can you review this?

1) am I doing anything fundamentally wrong?
2) if this is a good direction, can you create events for me to publish?

I'll then hook to the events and then would like it applied prior to actually modifying endpoints if you agree.
Show
Rupa Schomaker added a comment - 17/Jun/09 10:01 AM Assigning to anthm for review. Tony, can you review this? 1) am I doing anything fundamentally wrong? 2) if this is a good direction, can you create events for me to publish? I'll then hook to the events and then would like it applied prior to actually modifying endpoints if you agree.
Hide
Rupa Schomaker added a comment - 23/Jun/09 12:19 PM
Updated to current svn
Show
Rupa Schomaker added a comment - 23/Jun/09 12:19 PM Updated to current svn
Hide
Rupa Schomaker added a comment - 27/Jun/09 4:18 AM
Next iteration of patch. I'm happy with this one:

1) switch to using sqlite for state info
2) support static mappings
3) sofia works BUT, sofia should really only reload profiles whose ip addr has actually changed not all profiles as currently done. Thoughts?
4) dingaling should work, untested. bkw, you can test this?
5) fixed memory leak with "show foo as xml"
Show
Rupa Schomaker added a comment - 27/Jun/09 4:18 AM Next iteration of patch. I'm happy with this one: 1) switch to using sqlite for state info 2) support static mappings 3) sofia works BUT, sofia should really only reload profiles whose ip addr has actually changed not all profiles as currently done. Thoughts? 4) dingaling should work, untested. bkw, you can test this? 5) fixed memory leak with "show foo as xml"
Hide
Rupa Schomaker added a comment - 30/Jun/09 10:29 AM
rediff to 14048
Show
Rupa Schomaker added a comment - 30/Jun/09 10:29 AM rediff to 14048

People

Dates

  • Created:
    10/Jun/09 2:35 PM
    Updated:
    27/Sep/10 1:45 AM
    Resolved:
    01/Jul/09 3:47 PM