Sfoglia il codice sorgente

- added disable tcp support (-T or disable_tcp=yes in the cfg)
- the number of tcp "worker" processes is now setable (-N or tcp_children=NN)
- replaced get_out_socket w/ get_send_socket in tm/uac.c & fixed some proto
stuff (proto was not set properly when called w/ PROTO_NONE)
- updated man pages & INSTALL

Andrei Pelinescu-Onciul 22 anni fa
parent
commit
5dcfb23d56
15 ha cambiato i file con 210 aggiunte e 111 eliminazioni
  1. 4 2
      INSTALL
  2. 1 1
      Makefile.defs
  3. 3 0
      TODO
  4. 4 0
      cfg.lex
  5. 22 0
      cfg.y
  6. 2 2
      forward.c
  7. 11 2
      forward.h
  8. 1 0
      globals.h
  9. 127 90
      main.c
  10. 2 2
      modules/tm/t_fwd.c
  11. 2 2
      modules/tm/t_lookup.c
  12. 7 4
      modules/tm/uac.c
  13. 9 3
      pt.h
  14. 12 2
      ser.8
  15. 3 1
      ser.cfg.5

+ 4 - 2
INSTALL

@@ -42,7 +42,7 @@ TOC
 -------------------------------------------
 
 Supported arhitectures: Linux/i386, Linux/armv4l, FreeBSD/i386, OpenBSD/i386
-Solaris/sparc64 
+Solaris/sparc64, NetBSD/sparc64
 (for other arhitectures the Makefiles might need to be edited)
 
 There are various configuration options defined in the Makefile.
@@ -66,7 +66,7 @@ Requirements:
 
 OS Notes:
 
-- FreeBSD/OpenBSD: make sure gmake, bison or yacc & flex are installed
+- FreeBSD/OpenBSD/NetBSD: make sure gmake, bison or yacc & flex are installed
 - Solaris: as above; you can use Solaris's yacc instead of bison. You might
   need also gtar and ginstall.
 - Windows: it works in windows (only the core, w/o shared mem. support) but you
@@ -220,6 +220,8 @@ tar.gz:
      /usr/local/etc/ser/ser.cfg)
 Solaris:
     gunzip <package_name>.gz ; pkgadd -d <package_name>
+*BSD:
+    pkg_add package_name
     
 3) start the server
 RPM:

+ 1 - 1
Makefile.defs

@@ -21,7 +21,7 @@
 VERSION = 0
 PATCHLEVEL = 8
 SUBLEVEL =   11
-EXTRAVERSION = pre19
+EXTRAVERSION = pre20
 
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")

+ 3 - 0
TODO

@@ -3,6 +3,7 @@ $Id$
 ( - todo, x - done)
 
 release:
+- fix -march=..., or compile w/ i386 for the release
 x resolver should resolve [ipv6]
 - remove parse_uri debugging info
 - fix DBG("<%.*s>", len, _null_)
@@ -99,6 +100,7 @@ optimizations:
 
 
 tcp stuff:
+- timeout on long sends
 x tcp disable nagle 
 x set TOS to minimize delay
 - tcp locking/atomic ops review
@@ -110,5 +112,6 @@ tm optimizations:
 - replace snprintfs int build_uac_request, *_dlg
 - fix the huge param no. in this functions (use structs if neccessary):
   build_uac_request, build_uac_request_dlg, t_uac, t_uac_dlg
+- uri2proxy - t_uac_dlg => extra malloc/free (no üroxy needed here)
   
 

+ 4 - 0
cfg.lex

@@ -155,6 +155,8 @@ GROUP		"group"|"gid"
 CHROOT		"chroot"
 WDIR		"workdir"|"wdir"
 MHOMED		mhomed
+DISABLE_TCP		"disable_tcp"
+TCP_CHILDREN	"tcp_children"
 
 LOADMODULE	loadmodule
 MODPARAM        modparam
@@ -272,6 +274,8 @@ EAT_ABLE	[\ \t\b\r]
 <INITIAL>{CHROOT}	{ count(); yylval.strval=yytext; return CHROOT; }
 <INITIAL>{WDIR}	{ count(); yylval.strval=yytext; return WDIR; }
 <INITIAL>{MHOMED}	{ count(); yylval.strval=yytext; return MHOMED; }
+<INITIAL>{DISABLE_TCP}	{ count(); yylval.strval=yytext; return DISABLE_TCP; }
+<INITIAL>{TCP_CHILDREN}	{ count(); yylval.strval=yytext; return TCP_CHILDREN; }
 <INITIAL>{FIFO}	{ count(); yylval.strval=yytext; return FIFO; }
 <INITIAL>{FIFO_MODE}	{ count(); yylval.strval=yytext; return FIFO_MODE; }
 <INITIAL>{SERVER_SIGNATURE}	{ count(); yylval.strval=yytext; return SERVER_SIGNATURE; }

+ 22 - 0
cfg.y

@@ -37,6 +37,7 @@
  * 2003-04-01  added dst_port, proto , af (andrei)
  * 2003-04-05  s/reply_route/failure_route, onreply_route introduced (jiri)
  * 2003-04-12  added force_rport, chroot and wdir (andrei)
+ * 2003-04-15  added tcp_children, disable_tcp (andrei)
  */
 
 
@@ -168,6 +169,9 @@ int rt;  /* Type of route block for find_export */
 %token CHROOT
 %token WDIR
 %token MHOMED
+%token DISABLE_TCP
+%token TCP_CHILDREN
+
 
 
 
@@ -344,6 +348,24 @@ assign_stm:	DEBUG EQUAL NUMBER { debug=$3; }
 		| WDIR EQUAL error      { yyerror("string value expected"); }
 		| MHOMED EQUAL NUMBER { mhomed=$3; }
 		| MHOMED EQUAL error { yyerror("boolean value expected"); }
+		| DISABLE_TCP EQUAL NUMBER {
+									#ifdef USE_TCP
+										tcp_disable=$3;
+									#else
+										fprintf(stderr, "WARNING: tcp support"
+												"not compiled in\n");
+									#endif
+									}
+		| DISABLE_TCP EQUAL error { yyerror("boolean value expected"); }
+		| TCP_CHILDREN EQUAL NUMBER {
+									#ifdef USE_TCP
+										tcp_children_no=$3;
+									#else
+										fprintf(stderr, "WARNING: tcp support"
+												"not compiled in\n");
+									#endif
+									}
+		| TCP_CHILDREN EQUAL error { yyerror("number expected"); }
 		| SERVER_SIGNATURE EQUAL NUMBER { server_signature=$3; }
 		| SERVER_SIGNATURE EQUAL error { yyerror("boolean value expected"); }
 		| REPLY_TO_VIA EQUAL NUMBER { reply_to_via=$3; }

+ 2 - 2
forward.c

@@ -289,8 +289,8 @@ int forward_request( struct sip_msg* msg, struct proxy_l * p, int proto)
 
 	send_sock=get_send_socket(to, proto);
 	if (send_sock==0){
-		LOG(L_ERR, "forward_req: ERROR: cannot forward to af %d "
-				"no coresponding listening socket\n", to->s.sa_family);
+		LOG(L_ERR, "forward_req: ERROR: cannot forward to af %d, proto %d "
+				"no coresponding listening socket\n", to->s.sa_family, proto);
 		ser_error=E_NO_SOCKET;
 		goto error1;
 	}

+ 11 - 2
forward.h

@@ -32,6 +32,7 @@
  *  2003-02-11 added inline msg_send (andrei)
  *  2003-04-07 changed all ports to host byte order (andrei)
  *  2003-04-12  FORCE_RPORT_T added (andrei)
+ *  2003-04-15  added tcp_disable support (andrei)
  */
 
 
@@ -39,6 +40,7 @@
 #ifndef forward_h
 #define forward_h
 
+#include "globals.h"
 #include "parser/msg_parser.h"
 #include "route.h"
 #include "proxy.h"
@@ -98,10 +100,17 @@ static inline int msg_send(	struct socket_info* send_sock, int proto,
 	}
 #ifdef USE_TCP
 	else if (proto==PROTO_TCP){
-		if (tcp_send(buf, len, to, id)<0){
+		if (tcp_disable){
 			STATS_TX_DROPS;
-			LOG(L_ERR, "msg_send: ERROR: tcp_send failed\n");
+			LOG(L_WARN, "msg_send: WARNING: attempt to send on tcp and tcp"
+					" support is disabled\n");
 			goto error;
+		}else{
+			if (tcp_send(buf, len, to, id)<0){
+				STATS_TX_DROPS;
+				LOG(L_ERR, "msg_send: ERROR: tcp_send failed\n");
+				goto error;
+			}
 		}
 	}
 #endif

+ 1 - 0
globals.h

@@ -67,6 +67,7 @@ extern unsigned int maxbuffer;
 extern int children_no;
 #ifdef USE_TCP
 extern int tcp_children_no;
+extern int tcp_disable;
 #endif
 extern int dont_fork;
 extern int check_via;

+ 127 - 90
main.c

@@ -34,6 +34,7 @@
  *  2003-04-06  child_init called in all processes (janakj)
  *  2003-04-08  init_mallocs split into init_{pkg,shm}_mallocs and 
  *               init_shm_mallocs called after cmd. line parsing (andrei)
+ *  2003-04-15  added tcp_disable support (andrei)
  *
  */
 
@@ -180,35 +181,36 @@ Usage: " NAME " -l address [-p port] [-l address [-p port]...] [options]\n\
 Options:\n\
     -f file      Configuration file (default " CFG_FILE ")\n\
     -p port      Listen on the specified port (default: 5060)\n\
-                 applies to the last address in -l and to all \n\
-                 following that do not have a corespponding -p\n\
-    -l address   Listen on the specified address (multiple -l mean\n\
-                 listening on more addresses). The default behaviour\n\
-                 is to listen on the addresses returned by uname(2)\n\
-\n\
+                  applies to the last address in -l and to all \n\
+                  following that do not have a corespponding -p\n\
+    -l address   Listen on the specified address/interface (multiple -l\n\
+                  mean listening on more addresses). The default behaviour\n\
+                  is to listen on all the interfaces\n\
     -n processes Number of child processes to fork per interface\n\
-                 (default: 8)\n\
-\n\
+                  (default: 8)\n\
     -r           Use dns to check if is necessary to add a \"received=\"\n\
-                 field to a via\n\
+                  field to a via\n\
     -R           Same as `-r` but use reverse dns;\n\
-                 (to use both use `-rR`)\n\
-\n\
+                  (to use both use `-rR`)\n\
     -v           Turn on \"via:\" host checking when forwarding replies\n\
     -d           Debugging mode (multiple -d increase the level)\n\
     -D           Do not fork into daemon mode\n\
-    -E           Log to stderr\n\
-    -V           Version number\n\
+    -E           Log to stderr\n"
+#ifdef USE_TCP
+"    -T           Disable tcp\n\
+    -N           Number of tcp child processes (default: equal to `-n`)\n"
+#endif
+"    -V           Version number\n\
     -h           This help message\n\
     -b nr        Maximum receive buffer size which will not be exceeded by\n\
-                 auto-probing procedure even if  OS allows\n\
+                  auto-probing procedure even if  OS allows\n\
     -m nr        Size of shared memory allocated in Megabytes\n\
-    -w  dir      change the working directory to \"dir\" (default \"/\")\n\
-    -t  dir      chroot to \"dir\"\n\
-    -u uid       change uid \n\
-    -g gid       change gid \n\
-    -P file      create a pid file\n\
-    -i fifo_path create a fifo (usefull for monitoring " NAME ") \n"
+    -w  dir      Change the working directory to \"dir\" (default \"/\")\n\
+    -t  dir      Chroot to \"dir\"\n\
+    -u uid       Change uid \n\
+    -g gid       Change gid \n\
+    -P file      Create a pid file\n\
+    -i fifo_path Create a fifo (usefull for monitoring " NAME ") \n"
 #ifdef STATS
 "    -s file     File to which statistics is dumped (disabled otherwise)\n"
 #endif
@@ -258,6 +260,7 @@ unsigned int maxbuffer = MAX_RECV_BUFFER_SIZE; /* maximum buffer size we do
 int children_no = 0;			/* number of children processing requests */
 #ifdef USE_TCP
 int tcp_children_no = 0;
+int tcp_disable = 0; /* 1 if tcp is disabled */
 #endif
 struct process_table *pt=0;		/*array with childrens pids, 0= main proc,
 									alloc'ed in shared mem if possible*/
@@ -518,10 +521,6 @@ void handle_sigs()
 			/* we end the program in all these cases */
 			if (sig_flag==SIGINT)
 				DBG("INT received, program terminates\n");
-#ifdef OBSOLETED
-			else if (sig_flag==SIGPIPE) 
-				DBG("SIGPIPE received, program terminates\n");
-#endif
 			else
 				DBG("SIGTERM received, program terminates\n");
 				
@@ -627,11 +626,13 @@ int main_loop()
 		*/
 
 		/* we need another process to act as the timer*/
-#ifndef USE_TCP
+#ifdef USE_TCP
 		/* if we are using tcp we always need a timer process,
 		 * we cannot count on select timeout to measure time
 		 * (it works only on linux)
 		 */
+		if ((!tcp_disable)||(timer_list))
+#else
 		if (timer_list)
 #endif
 		{
@@ -703,17 +704,19 @@ int main_loop()
 				sendipv6=&sock_info[r];
 	#endif
 #ifdef USE_TCP
-			tcp_info[r]=sock_info[r]; /* copy the sockets */
-			/* same thing for tcp */
-			if (tcp_init(&tcp_info[r])==-1)  goto error;
-			/* get first ipv4/ipv6 socket*/
-			if ((tcp_info[r].address.af==AF_INET)&&
-					((sendipv4_tcp==0)||(sendipv4_tcp->is_lo)))
-				sendipv4_tcp=&tcp_info[r];
-	#ifdef USE_IPV6
-			if((sendipv6_tcp==0)&&(tcp_info[r].address.af==AF_INET6))
-				sendipv6_tcp=&tcp_info[r];
-	#endif
+			if (!tcp_disable){
+				tcp_info[r]=sock_info[r]; /* copy the sockets */
+				/* same thing for tcp */
+				if (tcp_init(&tcp_info[r])==-1)  goto error;
+				/* get first ipv4/ipv6 socket*/
+				if ((tcp_info[r].address.af==AF_INET)&&
+						((sendipv4_tcp==0)||(sendipv4_tcp->is_lo)))
+					sendipv4_tcp=&tcp_info[r];
+		#ifdef USE_IPV6
+				if((sendipv6_tcp==0)&&(tcp_info[r].address.af==AF_INET6))
+					sendipv6_tcp=&tcp_info[r];
+		#endif
+			}
 #endif
 			/* all procs should have access to all the sockets (for sending)
 			 * so we open all first*/
@@ -722,10 +725,12 @@ int main_loop()
 			for(i=0;i<children_no;i++){
 				process_no++;
 #ifdef USE_TCP
-		 		if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd)<0){
-					LOG(L_ERR, "ERROR: main_loop: socketpair failed: %s\n",
-						strerror(errno));
-					goto error;
+				if(!tcp_disable){
+		 			if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd)<0){
+						LOG(L_ERR, "ERROR: main_loop: socketpair failed: %s\n",
+							strerror(errno));
+						goto error;
+					}
 				}
 #endif
 				if ((pid=fork())<0){
@@ -734,8 +739,10 @@ int main_loop()
 				}else if (pid==0){
 					     /* child */
 #ifdef USE_TCP
-					close(sockfd[0]);
-					unix_tcp_sock=sockfd[1];
+					if (!tcp_disable){
+						close(sockfd[0]);
+						unix_tcp_sock=sockfd[1];
+					}
 #endif
 					bind_address=&sock_info[r]; /* shortcut */
 					bind_idx=r;
@@ -753,9 +760,12 @@ int main_loop()
 							"receiver child=%d sock=%d @ %s:%s", i, r, 	
 							sock_info[r].name.s, sock_info[r].port_no_str.s );
 #ifdef USE_TCP
-						close(sockfd[1]);
-						pt[process_no].unix_sock=sockfd[0];
-						pt[process_no].idx=-1; /* this is not "tcp" process*/
+						if (!tcp_disable){
+							close(sockfd[1]);
+							pt[process_no].unix_sock=sockfd[0];
+							pt[process_no].idx=-1; /* this is not a "tcp"
+													  process*/
+						}
 #endif
 				}
 			}
@@ -775,16 +785,20 @@ int main_loop()
 		goto error;
 	}
 
-#ifndef USE_TCP
+#ifdef USE_TCP
 	/* if we are using tcp we always need the timer */
+	if ((!tcp_disable)||(timer_list))
+#else
 	if (timer_list)
 #endif
 	{
 #ifdef USE_TCP
- 		if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd)<0){
-			LOG(L_ERR, "ERROR: main_loop: socketpair failed: %s\n",
-				strerror(errno));
-			goto error;
+		if (!tcp_disable){
+ 			if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd)<0){
+				LOG(L_ERR, "ERROR: main_loop: socketpair failed: %s\n",
+					strerror(errno));
+				goto error;
+			}
 		}
 #endif
 		/* fork again for the attendant process*/
@@ -796,8 +810,10 @@ int main_loop()
 			/* child */
 			/* is_main=0; */
 #ifdef USE_TCP
-			close(sockfd[0]);
-			unix_tcp_sock=sockfd[1];
+			if (!tcp_disable){
+				close(sockfd[0]);
+				unix_tcp_sock=sockfd[1];
+			}
 #endif
 			if (init_child(PROC_TIMER) < 0) {
 				LOG(L_ERR, "timer: init_child failed\n");
@@ -815,43 +831,49 @@ int main_loop()
 			pt[process_no].pid=pid;
 			strncpy(pt[process_no].desc, "timer", MAX_PT_DESC );
 #ifdef USE_TCP
+			if(!tcp_disable){
 						close(sockfd[1]);
 						pt[process_no].unix_sock=sockfd[0];
 						pt[process_no].idx=-1; /* this is not a "tcp" process*/
+			}
 #endif
 		}
 	}
 #ifdef USE_TCP
-			/* start tcp receivers */
-		if (tcp_init_children()<0) goto error;
-			/* start tcp master proc */
-		process_no++;
-		if ((pid=fork())<0){
-			LOG(L_CRIT, "main_loop: cannot fork tcp main process\n");
-			goto error;
-		}else if (pid==0){
-			/* child */
-			/* is_main=0; */
-			if (init_child(PROC_TCP_MAIN) < 0) {
-				LOG(L_ERR, "tcp_main: error in init_child\n");
+		if (!tcp_disable){
+				/* start tcp receivers */
+			if (tcp_init_children()<0) goto error;
+				/* start tcp master proc */
+			process_no++;
+			if ((pid=fork())<0){
+				LOG(L_CRIT, "main_loop: cannot fork tcp main process\n");
 				goto error;
+			}else if (pid==0){
+				/* child */
+				/* is_main=0; */
+				if (init_child(PROC_TCP_MAIN) < 0) {
+					LOG(L_ERR, "tcp_main: error in init_child\n");
+					goto error;
+				}
+				tcp_main_loop();
+			}else{
+				pt[process_no].pid=pid;
+				strncpy(pt[process_no].desc, "tcp main process", MAX_PT_DESC );
+				pt[process_no].unix_sock=-1;
+				pt[process_no].idx=-1; /* this is not a "tcp" process*/
+				unix_tcp_sock=-1;
 			}
-			tcp_main_loop();
-		}else{
-			pt[process_no].pid=pid;
-			strncpy(pt[process_no].desc, "tcp main process", MAX_PT_DESC );
-			pt[process_no].unix_sock=-1;
-			pt[process_no].idx=-1; /* this is not a "tcp" process*/
-			unix_tcp_sock=-1;
 		}
 #endif
 	/* main */
 	pt[0].pid=getpid();
 	strncpy(pt[0].desc, "attendant", MAX_PT_DESC );
 #ifdef USE_TCP
-	pt[process_no].unix_sock=-1;
-	pt[process_no].idx=-1; /* this is not a "tcp" process*/
-	unix_tcp_sock=-1;
+	if(!tcp_disable){
+		pt[process_no].unix_sock=-1;
+		pt[process_no].idx=-1; /* this is not a "tcp" process*/
+		unix_tcp_sock=-1;
+	}
 #endif
 	/*DEBUG- remove it*/
 #ifdef DEBUG
@@ -1140,7 +1162,7 @@ int main(int argc, char** argv)
 #ifdef STATS
 	"s:"
 #endif
-	"f:p:m:b:l:n:rRvdDEVhw:t:u:g:P:i:";
+	"f:p:m:b:l:n:N:rRvdDETVhw:t:u:g:P:i:";
 	
 	while((c=getopt(argc,argv,options))!=-1){
 		switch(c){
@@ -1227,6 +1249,25 @@ int main(int argc, char** argv)
 			case 'E':
 					log_stderr=1;
 					break;
+			case 'T':
+#ifdef USE_TCP
+					tcp_disable=1;
+#else
+					fprintf(stderr,"WARNING: tcp support not compiled in\n");
+#endif
+					break;
+			case 'N':
+#ifdef USE_TCP
+					tcp_children_no=strtol(optarg, &tmp, 10);
+					if ((tmp==0) ||(*tmp)){
+						fprintf(stderr, "bad process number: -N %s\n",
+									optarg);
+						goto error;
+					}
+#else
+					fprintf(stderr,"WARNING: tcp support not compiled in\n");
+#endif
+					break;
 			case 'V':
 					printf("version: %s\n", version);
 					printf("flags: %s\n", flags );
@@ -1324,13 +1365,6 @@ try_again:
 		LOG(L_CRIT, "could not initialize timer, exiting...\n");
 		goto error;
 	}
-#ifdef USE_TCP
-	/*init tcp*/
-	if (init_tcp()<0){
-		LOG(L_CRIT, "could not initialize tcp, exiting...\n");
-		goto error;
-	}
-#endif
 	
 	/* register a diagnostic FIFO command */
 	if (register_core_fifo()<0) {
@@ -1357,14 +1391,8 @@ try_again:
 	
 	if (children_no<=0) children_no=CHILD_NO;
 #ifdef USE_TCP
-	tcp_children_no=children_no;
-#endif
-#ifdef _OBSOLETED
-	else if (children_no >= MAX_PROCESSES ) {
-		fprintf(stderr, "ERROR: too many children processes configured;"
-				" maximum is %d\n",
-			MAX_PROCESSES-1 );
-		goto error;
+	if (!tcp_disable){
+		if (tcp_children_no<=0) tcp_children_no=children_no;
 	}
 #endif
 	
@@ -1592,6 +1620,15 @@ try_again:
 							" use only the the first one)":"");
 	}
 	
+#ifdef USE_TCP
+	if (!tcp_disable){
+		/*init tcp*/
+		if (init_tcp()<0){
+			LOG(L_CRIT, "could not initialize tcp, exiting...\n");
+			goto error;
+		}
+	}
+#endif
 	/* init_daemon? */
 	if (!dont_fork){
 		if ( daemonize(argv[0]) <0 ) goto error;

+ 2 - 2
modules/tm/t_fwd.c

@@ -210,9 +210,9 @@ int add_uac( struct cell *t, struct sip_msg *request, str *uri, str* next_hop,
 
 	send_sock=get_send_socket( &to , proxy->proto);
 	if (send_sock==0) {
-		LOG(L_ERR, "ERROR: add_uac: can't fwd to af %d "
+		LOG(L_ERR, "ERROR: add_uac: can't fwd to af %d, proto %d "
 			" (no corresponding listening socket)\n",
-			to.s.sa_family );
+			to.s.sa_family, proxy->proto );
 		ret=ser_error=E_NO_SOCKET;
 		goto error01;
 	}

+ 2 - 2
modules/tm/t_lookup.c

@@ -908,8 +908,8 @@ int init_rb( struct retr_buf *rb, struct sip_msg *msg)
 	rb->dst.proto_reserved1=msg->rcv.proto_reserved1;
 	send_sock=get_send_socket(&rb->dst.to, proto);
 	if (send_sock==0) {
-		LOG(L_ERR, "ERROR: init_rb: cannot fwd to af %d "
-			"no socket\n", rb->dst.to.s.sa_family);
+		LOG(L_ERR, "ERROR: init_rb: cannot fwd to af %d, proto %d "
+			"no socket\n", rb->dst.to.s.sa_family, proto);
 		ser_error=E_BAD_VIA;
 		return 0;
 	}

+ 7 - 4
modules/tm/uac.c

@@ -54,6 +54,9 @@
  *  2003-03-01  kr set through a function now (jiri)
  *  2003-03-19  replaced all mallocs/frees w/ pkg_malloc/pkg_free (andrei)
  *  2003-04-02  port_no_str does not contain a leading ':' anymore (andrei)
+ *  2003-04-15  t_uac_dlg now uses get_send_socket(get_out_socket doesn't
+ *               work for tcp) (andrei)
+ *  
  */
 
 
@@ -218,10 +221,10 @@ static struct socket_info *uri2sock( str *uri, union sockaddr_union *to_su,
 
 	hostent2su(to_su, &proxy->host, proxy->addr_idx, 
 			(proxy->port) ? proxy->port : SIP_PORT);
-	send_sock=get_out_socket(to_su, proto);
+	send_sock=get_send_socket(to_su, proxy->proto);
 	if (send_sock == 0) {
-		LOG(L_ERR, "ERROR: uri2sock: no corresponding socket for af %d\n", 
-						to_su->s.sa_family );
+		LOG(L_ERR, "ERROR: uri2sock: no corresponding socket for af %d,"
+				"proto %d\n", to_su->s.sa_family , proto);
 		ser_error = E_NO_SOCKET;
 	}
 
@@ -370,7 +373,7 @@ int t_uac_dlg(str* msg,                     /* Type of the message - MESSAGE, OP
 	request = &new_cell->uac[branch].request;
 	request->dst.to = to_su;
 	request->dst.send_sock = send_sock;
-	request->dst.proto = proto;
+	request->dst.proto = send_sock->proto;
 	request->dst.proto_reserved1 = 0;
 
 	/* need to put in table to calculate label which is needed for printing */

+ 9 - 3
pt.h

@@ -28,6 +28,11 @@
  * along with this program; if not, write to the Free Software 
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+/*
+ * History:
+ * --------
+ *  2003-04-15  added tcp_disable support (andrei)
+ */
 
 
 #ifndef _PT_H
@@ -66,9 +71,10 @@ inline static int process_count()
 		/* fifo server */
 		+((fifo==NULL || strlen(fifo)==0) ? 0 : 1 )
 #ifdef USE_TCP
-		+ 1/* tcp main */ + tcp_children_no + 
-		(timer_list ? 0: 1) /* add the timer proc. if not already taken
-							   into account */
+		+ (!tcp_disable)?( 1/* tcp main */ + tcp_children_no + 
+							(timer_list ? 0: 1)):0 /* add the timer proc.
+													  if not already taken
+													  into account */
 #endif
 		
 		;

+ 12 - 2
ser.8

@@ -8,7 +8,7 @@ ser \- very fast and configurable sip proxy
 .SH SYNOPSIS
 .B ser
 [
-.B \-hcrRvdDEV
+.B \-hcrRvdDEVT
 ] [
 .BI \-f " config\-file"
 ] [
@@ -19,6 +19,8 @@ ser \- very fast and configurable sip proxy
 ] [
 .BI \-n " processes\-no"
 ] [
+.BI \-N " tcp processes\-no"
+] [
 .BI \-b " max_rcv_buf_size"
 ] [
 .BI \-m " shared_mem_size"
@@ -74,6 +76,9 @@ Runs ser in the foreground (it doesn't fork into daemon mode).
 .BI \-E
 Sends all the log messages to stderr.
 .TP
+.BI \-T
+Disables TCP support.
+.TP
 .BI \-V
 Displays the version number.
 .TP
@@ -98,6 +103,11 @@ and to all the following that do not have a corresponding
 .BI \-n " processes\-no"
 Specifies the number of children processes forked per interface (default 8).
 .TP
+.BI \-N " tcp processes\-no"
+Specifies the number of children processes forked to handle tcp incoming connections (by default is equal to
+.BI \-n
+).
+.TP
 .BI \-b " max_rcv_buf_size"
 Maximum receive buffer size which will not be exceeded by the auto-probing procedure even if the OS allows.
 .TP
@@ -171,4 +181,4 @@ Report bugs at
 .nf
 https://developer.berlios.de/bugs/?func=addbug&group_id=480 .
 .br
-For help/support, write an email to <[email protected]>. 
+For help/support, write an email to <[email protected]> or <[email protected]>.

+ 3 - 1
ser.cfg.5

@@ -21,7 +21,9 @@ or enclosed in
 are interpreted as comments.
 .PP
 This manual page is incomplete. For further information please read
-.I /usr/share/doc/ser/README.cfg.
+.I /usr/share/doc/ser/README.cfg
+and
+.I Ser User Guide.
 
 .SH FILES
 .bL