[SR-Users] LCR module : same IP address for different prefix.

Juha Heinanen jh at tutpro.com
Mon Mar 28 10:36:42 CEST 2011


Ricardo Martinez writes:

> How can access this change in the code?.  Do I need to update to the last
> version? 3.1.2 ??
> Hope you can help me.

currently the trivial change (do not check uniqueness of gateway's ip
address) is only in master branch.  patch to 3.1 is included below.

-- juha

** lcr_mod.c	2011-03-18 16:36:30.000000000 +0200
--- /usr/src/openxg-sip-proxy/modules/lcr/lcr_mod.c	2011-03-18 16:3
5:45.000000000 +0200
***************
*** 783,808 ****
  }
  
  
! /*
!  * Check if ip_addr/grp_id of gateway is unique.
   */
- static int gw_unique(const struct gw_info *gws, const unsigned int count,
- 		     const unsigned int ip_addr, const unsigned int port,
- 		     char *hostname, unsigned int hostname_len)
- {
-     unsigned int i;
- 
-     for (i = 1; i <= count; i++) {
- 	if ((gws[i].ip_addr == ip_addr) &&
- 	    (gws[i].port == port) &&
- 	    (gws[i].hostname_len == hostname_len) &&
- 	    (strncasecmp(gws[i].hostname, hostname, hostname_len) == 0)) {
- 	    return 0;
- 	}
-     }
-     return 1;
- }
- 
  static int insert_gw(struct gw_info *gws, unsigned int i, unsigned int gw_id,
  		     char *gw_name, unsigned int gw_name_len,
  		     unsigned int scheme, unsigned int ip_addr,
--- 783,791 ----
  }
  
  
! /* 
!  * Insert gw info into index i of gws table
   */
  static int insert_gw(struct gw_info *gws, unsigned int i, unsigned int gw_id,
  		     char *gw_name, unsigned int gw_name_len,
  		     unsigned int scheme, unsigned int ip_addr,
***************
*** 813,823 ****
  		     unsigned int tag_len, unsigned int flags,
  		     unsigned int defunct_until)
  {
-     if (gw_unique(gws, i - 1, ip_addr, port, hostname, hostname_len) == 0) {
- 	LM_ERR("gw <%s, %u, %.*s> is not unique\n", ip_string, port,
- 	       hostname_len, hostname);
- 	return 0;
-     }
      gws[i].gw_id = gw_id;
      if (gw_name_len) memcpy(&(gws[i].gw_name[0]), gw_name, gw_name_len);
      gws[i].gw_name_len = gw_name_len;
--- 796,801 ----



More information about the sr-users mailing list