[Serdev] AVPOPS patch - dst_ip

Elena Ramona Modroiu ramona at voice-system.ro
Tue Jun 21 09:05:45 UTC 2005


Hello,

my colleagues told me that the patch is ok, so I can apply it but it
cannot be committed to 0.9.0 (no new development in this branch), only
to cvs head. Could you send the patch for CVS head? That will make
things easier, otherwise the patch will be applied a bit later, when
I will find some time to port it by myself.

Ramona

On Wed, Jun 15, 2005 at 10:58:20AM -0400, Evan Borgstr?m wrote:
> Hey All,
> 
> 	Here's a patch for the avpops module in the rel_0_9_0 tag that adds 
> 	the ability to test for $dst_ip along with $src_ip. Feel free to commit it 
> into CVS if there's interest in it from others.
> 
> -Evan

> --- ser-0.9.3.orig/modules/avpops/avpops.c	2005-06-14 11:47:34.000000000 -0400
> +++ ser-0.9.3/modules/avpops/avpops.c	2005-06-14 11:53:02.000000000 -0400
> @@ -376,6 +376,7 @@
>  			if ( (!strcasecmp( "from", s) && (flags|=AVPOPS_USE_FROM))
>  				|| (!strcasecmp( "to", s) && (flags|=AVPOPS_USE_TO))
>  				|| (!strcasecmp( "ruri", s) && (flags|=AVPOPS_USE_RURI))
> +				|| (!strcasecmp( "dst_ip", s) && (flags|=AVPOPS_USE_DST_IP))
>  				|| (!strcasecmp( "src_ip", s) && (flags|=AVPOPS_USE_SRC_IP)) )
>  			{
>  				ap = (struct fis_param*)pkg_malloc(sizeof(struct fis_param));
> @@ -387,7 +388,7 @@
>  				}
>  				memset( ap, 0, sizeof(struct fis_param));
>  				/* any falgs ? */
> -				if ( p && !( (flags&AVPOPS_USE_SRC_IP)==0 && (
> +				if ( p && !( (flags&(AVPOPS_USE_SRC_IP|AVPOPS_USE_DST_IP))==0 && (
>  				(!strcasecmp("username",p) && (flags|=AVPOPS_FLAG_USER)) ||
>  				(!strcasecmp("domain", p) && (flags|=AVPOPS_FLAG_DOMAIN)))) )
>  				{
> --- ser-0.9.3.orig/modules/avpops/avpops_impl.c	2005-06-14 11:47:34.000000000 -0400
> +++ ser-0.9.3/modules/avpops/avpops_impl.c	2005-06-14 11:55:19.000000000 -0400
> @@ -567,6 +567,15 @@
>  			}
>  			s_ip.len = strlen(s_ip.s);
>  			avp_val.s = &s_ip;
> +		} else if (src->flags&AVPOPS_USE_DST_IP) {
> +			/* get data from dst ip */
> +			if ( (s_ip.s=ip_addr2a( &msg->rcv.dst_ip ))==0)
> +			{
> +				LOG(L_ERR,"ERROR:avpops:write_avp: cannot get dst_ip\n");
> +				goto error;
> +			}
> +			s_ip.len = strlen(s_ip.s);
> +			avp_val.s = &s_ip;
>  		} else {
>  			/* get data from uri (from,to,ruri) */
>  			if (src->flags&(AVPOPS_FLAG_USER|AVPOPS_FLAG_DOMAIN))
> @@ -898,6 +907,15 @@
>  				}
>  				s_ip.len = strlen(s_ip.s);
>  				ck_val.s = &s_ip;
> +			} else if (val->flags&AVPOPS_USE_DST_IP) {
> +				/* get value from dst ip */
> +				if ( (s_ip.s=ip_addr2a( &msg->rcv.dst_ip ))==0)
> +				{
> +					LOG(L_ERR,"ERROR:avpops:check_avp: cannot get dst_ip\n");
> +					goto error;
> +				}
> +				s_ip.len = strlen(s_ip.s);
> +				ck_val.s = &s_ip;
>  			} else {
>  				/* get value from uri */
>  				if ( (ck_val.s=get_source_uri(msg,val->flags))==0 )
> --- ser-0.9.3.orig/modules/avpops/avpops_impl.h	2005-06-14 11:47:34.000000000 -0400
> +++ ser-0.9.3/modules/avpops/avpops_impl.h	2005-06-14 11:55:26.000000000 -0400
> @@ -64,6 +64,7 @@
>  #define AVPOPS_USE_HDRREQ    (1<<10)
>  #define AVPOPS_USE_HDRRPL    (1<<11)
>  #define AVPOPS_USE_SRC_IP    (1<<12)
> +#define AVPOPS_USE_DST_IP    (1<<13)
>  
>  /* flags about operation  16..23  */
>  #define AVPOPS_OP_EQ        (1<<16)
> --- ser-0.9.3.orig/modules/avpops/avpops_parse.c	2005-06-14 11:47:34.000000000 -0400
> +++ ser-0.9.3/modules/avpops/avpops_parse.c	2005-06-14 11:53:30.000000000 -0400
> @@ -383,7 +383,8 @@
>  		if ( (strncasecmp(p,"ruri"  ,len)==0 && (flags|=AVPOPS_USE_RURI))
>  		  || (strncasecmp(p,"from"  ,len)==0 && (flags|=AVPOPS_USE_FROM))
>  		  || (strncasecmp(p,"to"    ,len)==0 && (flags|=AVPOPS_USE_TO))
> -		  || (strncasecmp(p,"src_ip",len)==0 && (flags|=AVPOPS_USE_SRC_IP)))
> +		  || (strncasecmp(p,"src_ip",len)==0 && (flags|=AVPOPS_USE_SRC_IP))
> +		  || (strncasecmp(p,"dst_ip",len)==0 && (flags|=AVPOPS_USE_DST_IP)))
>  		{
>  			flags |= AVPOPS_VAL_NONE;
>  		} else {

> _______________________________________________
> Serdev mailing list
> serdev at lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serdev




More information about the Serdev mailing list