[OpenSIPS-Devel] [opensips] tcp_no_new_conn_bflag may be not set correctly in OpenSIPS 1.9 later (#229)

yeyingxian notifications at github.com
Fri May 9 13:09:59 CEST 2014


when writing scripts like this


listen=tcp:192.168.1.100:8080

tcp_connection_lifetime=1200
tcp_no_new_conn_bflag=6
...

the variable tcp_no_new_conn_bflag will be not correctly set to number 6. This is because in cfg.y, 

		| TCP_NO_NEW_CONN_BFLAG EQUAL NUMBER {
			#ifdef USE_TCP
				fix_flag_name(&tmp, $3);
				tcp_no_new_conn_bflag = get_flag_id_by_name(FLAG_TYPE_BRANCH, tmp);
				if (!flag_in_range( (flag_t)tcp_no_new_conn_bflag ) )
					yyerror("invalid TCP no_new_conn Branch Flag");
				flag_idx2mask( &tcp_no_new_conn_bflag );

the number flag will be converted to string by macro "fix_flag_name". The macro “fix_flag_name” was defined as


#define fix_flag_name(_s, _flag)                         \
     do {                                                \
		if (!*_s && _flag > 0) {                         \
			LM_WARN("Integer flags are now deprecated! " \
			        "Use unique quoted strings!\n");     \
			*_s = int2str(_flag, NULL);                  \
		}                                                \
	 } while (0)

in flags.h. It is executed only when tmp is pointing to a null string. But the global variable tmp is used to store listening IP address in  cfg.y

listen_id:	ip			{	tmp=ip_addr2a($1);

So please use a new variable for converting number to string.


---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/229
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20140509/b71991b3/attachment.htm>


More information about the Devel mailing list