... | ... |
@@ -42,7 +42,7 @@ TOC |
42 | 42 |
------------------------------------------- |
43 | 43 |
|
44 | 44 |
Supported arhitectures: Linux/i386, Linux/armv4l, FreeBSD/i386, OpenBSD/i386 |
45 |
-Solaris/sparc64 |
|
45 |
+Solaris/sparc64, NetBSD/sparc64 |
|
46 | 46 |
(for other arhitectures the Makefiles might need to be edited) |
47 | 47 |
|
48 | 48 |
There are various configuration options defined in the Makefile. |
... | ... |
@@ -66,7 +66,7 @@ Requirements: |
66 | 66 |
|
67 | 67 |
OS Notes: |
68 | 68 |
|
69 |
-- FreeBSD/OpenBSD: make sure gmake, bison or yacc & flex are installed |
|
69 |
+- FreeBSD/OpenBSD/NetBSD: make sure gmake, bison or yacc & flex are installed |
|
70 | 70 |
- Solaris: as above; you can use Solaris's yacc instead of bison. You might |
71 | 71 |
need also gtar and ginstall. |
72 | 72 |
- Windows: it works in windows (only the core, w/o shared mem. support) but you |
... | ... |
@@ -220,6 +220,8 @@ tar.gz: |
220 | 220 |
/usr/local/etc/ser/ser.cfg) |
221 | 221 |
Solaris: |
222 | 222 |
gunzip <package_name>.gz ; pkgadd -d <package_name> |
223 |
+*BSD: |
|
224 |
+ pkg_add package_name |
|
223 | 225 |
|
224 | 226 |
3) start the server |
225 | 227 |
RPM: |
... | ... |
@@ -3,6 +3,7 @@ $Id$ |
3 | 3 |
( - todo, x - done) |
4 | 4 |
|
5 | 5 |
release: |
6 |
+- fix -march=..., or compile w/ i386 for the release |
|
6 | 7 |
x resolver should resolve [ipv6] |
7 | 8 |
- remove parse_uri debugging info |
8 | 9 |
- fix DBG("<%.*s>", len, _null_) |
... | ... |
@@ -99,6 +100,7 @@ optimizations: |
99 | 100 |
|
100 | 101 |
|
101 | 102 |
tcp stuff: |
103 |
+- timeout on long sends |
|
102 | 104 |
x tcp disable nagle |
103 | 105 |
x set TOS to minimize delay |
104 | 106 |
- tcp locking/atomic ops review |
... | ... |
@@ -110,5 +112,6 @@ tm optimizations: |
110 | 112 |
- replace snprintfs int build_uac_request, *_dlg |
111 | 113 |
- fix the huge param no. in this functions (use structs if neccessary): |
112 | 114 |
build_uac_request, build_uac_request_dlg, t_uac, t_uac_dlg |
115 |
+- uri2proxy - t_uac_dlg => extra malloc/free (no �roxy needed here) |
|
113 | 116 |
|
114 | 117 |
|
... | ... |
@@ -155,6 +155,8 @@ GROUP "group"|"gid" |
155 | 155 |
CHROOT "chroot" |
156 | 156 |
WDIR "workdir"|"wdir" |
157 | 157 |
MHOMED mhomed |
158 |
+DISABLE_TCP "disable_tcp" |
|
159 |
+TCP_CHILDREN "tcp_children" |
|
158 | 160 |
|
159 | 161 |
LOADMODULE loadmodule |
160 | 162 |
MODPARAM modparam |
... | ... |
@@ -272,6 +274,8 @@ EAT_ABLE [\ \t\b\r] |
272 | 274 |
<INITIAL>{CHROOT} { count(); yylval.strval=yytext; return CHROOT; } |
273 | 275 |
<INITIAL>{WDIR} { count(); yylval.strval=yytext; return WDIR; } |
274 | 276 |
<INITIAL>{MHOMED} { count(); yylval.strval=yytext; return MHOMED; } |
277 |
+<INITIAL>{DISABLE_TCP} { count(); yylval.strval=yytext; return DISABLE_TCP; } |
|
278 |
+<INITIAL>{TCP_CHILDREN} { count(); yylval.strval=yytext; return TCP_CHILDREN; } |
|
275 | 279 |
<INITIAL>{FIFO} { count(); yylval.strval=yytext; return FIFO; } |
276 | 280 |
<INITIAL>{FIFO_MODE} { count(); yylval.strval=yytext; return FIFO_MODE; } |
277 | 281 |
<INITIAL>{SERVER_SIGNATURE} { count(); yylval.strval=yytext; return SERVER_SIGNATURE; } |
... | ... |
@@ -37,6 +37,7 @@ |
37 | 37 |
* 2003-04-01 added dst_port, proto , af (andrei) |
38 | 38 |
* 2003-04-05 s/reply_route/failure_route, onreply_route introduced (jiri) |
39 | 39 |
* 2003-04-12 added force_rport, chroot and wdir (andrei) |
40 |
+ * 2003-04-15 added tcp_children, disable_tcp (andrei) |
|
40 | 41 |
*/ |
41 | 42 |
|
42 | 43 |
|
... | ... |
@@ -168,6 +169,9 @@ int rt; /* Type of route block for find_export */ |
168 | 169 |
%token CHROOT |
169 | 170 |
%token WDIR |
170 | 171 |
%token MHOMED |
172 |
+%token DISABLE_TCP |
|
173 |
+%token TCP_CHILDREN |
|
174 |
+ |
|
171 | 175 |
|
172 | 176 |
|
173 | 177 |
|
... | ... |
@@ -344,6 +348,24 @@ assign_stm: DEBUG EQUAL NUMBER { debug=$3; } |
344 | 348 |
| WDIR EQUAL error { yyerror("string value expected"); } |
345 | 349 |
| MHOMED EQUAL NUMBER { mhomed=$3; } |
346 | 350 |
| MHOMED EQUAL error { yyerror("boolean value expected"); } |
351 |
+ | DISABLE_TCP EQUAL NUMBER { |
|
352 |
+ #ifdef USE_TCP |
|
353 |
+ tcp_disable=$3; |
|
354 |
+ #else |
|
355 |
+ fprintf(stderr, "WARNING: tcp support" |
|
356 |
+ "not compiled in\n"); |
|
357 |
+ #endif |
|
358 |
+ } |
|
359 |
+ | DISABLE_TCP EQUAL error { yyerror("boolean value expected"); } |
|
360 |
+ | TCP_CHILDREN EQUAL NUMBER { |
|
361 |
+ #ifdef USE_TCP |
|
362 |
+ tcp_children_no=$3; |
|
363 |
+ #else |
|
364 |
+ fprintf(stderr, "WARNING: tcp support" |
|
365 |
+ "not compiled in\n"); |
|
366 |
+ #endif |
|
367 |
+ } |
|
368 |
+ | TCP_CHILDREN EQUAL error { yyerror("number expected"); } |
|
347 | 369 |
| SERVER_SIGNATURE EQUAL NUMBER { server_signature=$3; } |
348 | 370 |
| SERVER_SIGNATURE EQUAL error { yyerror("boolean value expected"); } |
349 | 371 |
| REPLY_TO_VIA EQUAL NUMBER { reply_to_via=$3; } |
... | ... |
@@ -289,8 +289,8 @@ int forward_request( struct sip_msg* msg, struct proxy_l * p, int proto) |
289 | 289 |
|
290 | 290 |
send_sock=get_send_socket(to, proto); |
291 | 291 |
if (send_sock==0){ |
292 |
- LOG(L_ERR, "forward_req: ERROR: cannot forward to af %d " |
|
293 |
- "no coresponding listening socket\n", to->s.sa_family); |
|
292 |
+ LOG(L_ERR, "forward_req: ERROR: cannot forward to af %d, proto %d " |
|
293 |
+ "no coresponding listening socket\n", to->s.sa_family, proto); |
|
294 | 294 |
ser_error=E_NO_SOCKET; |
295 | 295 |
goto error1; |
296 | 296 |
} |
... | ... |
@@ -32,6 +32,7 @@ |
32 | 32 |
* 2003-02-11 added inline msg_send (andrei) |
33 | 33 |
* 2003-04-07 changed all ports to host byte order (andrei) |
34 | 34 |
* 2003-04-12 FORCE_RPORT_T added (andrei) |
35 |
+ * 2003-04-15 added tcp_disable support (andrei) |
|
35 | 36 |
*/ |
36 | 37 |
|
37 | 38 |
|
... | ... |
@@ -39,6 +40,7 @@ |
39 | 40 |
#ifndef forward_h |
40 | 41 |
#define forward_h |
41 | 42 |
|
43 |
+#include "globals.h" |
|
42 | 44 |
#include "parser/msg_parser.h" |
43 | 45 |
#include "route.h" |
44 | 46 |
#include "proxy.h" |
... | ... |
@@ -98,10 +100,17 @@ static inline int msg_send( struct socket_info* send_sock, int proto, |
98 | 100 |
} |
99 | 101 |
#ifdef USE_TCP |
100 | 102 |
else if (proto==PROTO_TCP){ |
101 |
- if (tcp_send(buf, len, to, id)<0){ |
|
103 |
+ if (tcp_disable){ |
|
102 | 104 |
STATS_TX_DROPS; |
103 |
- LOG(L_ERR, "msg_send: ERROR: tcp_send failed\n"); |
|
105 |
+ LOG(L_WARN, "msg_send: WARNING: attempt to send on tcp and tcp" |
|
106 |
+ " support is disabled\n"); |
|
104 | 107 |
goto error; |
108 |
+ }else{ |
|
109 |
+ if (tcp_send(buf, len, to, id)<0){ |
|
110 |
+ STATS_TX_DROPS; |
|
111 |
+ LOG(L_ERR, "msg_send: ERROR: tcp_send failed\n"); |
|
112 |
+ goto error; |
|
113 |
+ } |
|
105 | 114 |
} |
106 | 115 |
} |
107 | 116 |
#endif |
... | ... |
@@ -34,6 +34,7 @@ |
34 | 34 |
* 2003-04-06 child_init called in all processes (janakj) |
35 | 35 |
* 2003-04-08 init_mallocs split into init_{pkg,shm}_mallocs and |
36 | 36 |
* init_shm_mallocs called after cmd. line parsing (andrei) |
37 |
+ * 2003-04-15 added tcp_disable support (andrei) |
|
37 | 38 |
* |
38 | 39 |
*/ |
39 | 40 |
|
... | ... |
@@ -180,35 +181,36 @@ Usage: " NAME " -l address [-p port] [-l address [-p port]...] [options]\n\ |
180 | 181 |
Options:\n\ |
181 | 182 |
-f file Configuration file (default " CFG_FILE ")\n\ |
182 | 183 |
-p port Listen on the specified port (default: 5060)\n\ |
183 |
- applies to the last address in -l and to all \n\ |
|
184 |
- following that do not have a corespponding -p\n\ |
|
185 |
- -l address Listen on the specified address (multiple -l mean\n\ |
|
186 |
- listening on more addresses). The default behaviour\n\ |
|
187 |
- is to listen on the addresses returned by uname(2)\n\ |
|
188 |
-\n\ |
|
184 |
+ applies to the last address in -l and to all \n\ |
|
185 |
+ following that do not have a corespponding -p\n\ |
|
186 |
+ -l address Listen on the specified address/interface (multiple -l\n\ |
|
187 |
+ mean listening on more addresses). The default behaviour\n\ |
|
188 |
+ is to listen on all the interfaces\n\ |
|
189 | 189 |
-n processes Number of child processes to fork per interface\n\ |
190 |
- (default: 8)\n\ |
|
191 |
-\n\ |
|
190 |
+ (default: 8)\n\ |
|
192 | 191 |
-r Use dns to check if is necessary to add a \"received=\"\n\ |
193 |
- field to a via\n\ |
|
192 |
+ field to a via\n\ |
|
194 | 193 |
-R Same as `-r` but use reverse dns;\n\ |
195 |
- (to use both use `-rR`)\n\ |
|
196 |
-\n\ |
|
194 |
+ (to use both use `-rR`)\n\ |
|
197 | 195 |
-v Turn on \"via:\" host checking when forwarding replies\n\ |
198 | 196 |
-d Debugging mode (multiple -d increase the level)\n\ |
199 | 197 |
-D Do not fork into daemon mode\n\ |
200 |
- -E Log to stderr\n\ |
|
201 |
- -V Version number\n\ |
|
198 |
+ -E Log to stderr\n" |
|
199 |
+#ifdef USE_TCP |
|
200 |
+" -T Disable tcp\n\ |
|
201 |
+ -N Number of tcp child processes (default: equal to `-n`)\n" |
|
202 |
+#endif |
|
203 |
+" -V Version number\n\ |
|
202 | 204 |
-h This help message\n\ |
203 | 205 |
-b nr Maximum receive buffer size which will not be exceeded by\n\ |
204 |
- auto-probing procedure even if OS allows\n\ |
|
206 |
+ auto-probing procedure even if OS allows\n\ |
|
205 | 207 |
-m nr Size of shared memory allocated in Megabytes\n\ |
206 |
- -w dir change the working directory to \"dir\" (default \"/\")\n\ |
|
207 |
- -t dir chroot to \"dir\"\n\ |
|
208 |
- -u uid change uid \n\ |
|
209 |
- -g gid change gid \n\ |
|
210 |
- -P file create a pid file\n\ |
|
211 |
- -i fifo_path create a fifo (usefull for monitoring " NAME ") \n" |
|
208 |
+ -w dir Change the working directory to \"dir\" (default \"/\")\n\ |
|
209 |
+ -t dir Chroot to \"dir\"\n\ |
|
210 |
+ -u uid Change uid \n\ |
|
211 |
+ -g gid Change gid \n\ |
|
212 |
+ -P file Create a pid file\n\ |
|
213 |
+ -i fifo_path Create a fifo (usefull for monitoring " NAME ") \n" |
|
212 | 214 |
#ifdef STATS |
213 | 215 |
" -s file File to which statistics is dumped (disabled otherwise)\n" |
214 | 216 |
#endif |
... | ... |
@@ -258,6 +260,7 @@ unsigned int maxbuffer = MAX_RECV_BUFFER_SIZE; /* maximum buffer size we do |
258 | 260 |
int children_no = 0; /* number of children processing requests */ |
259 | 261 |
#ifdef USE_TCP |
260 | 262 |
int tcp_children_no = 0; |
263 |
+int tcp_disable = 0; /* 1 if tcp is disabled */ |
|
261 | 264 |
#endif |
262 | 265 |
struct process_table *pt=0; /*array with childrens pids, 0= main proc, |
263 | 266 |
alloc'ed in shared mem if possible*/ |
... | ... |
@@ -518,10 +521,6 @@ void handle_sigs() |
518 | 521 |
/* we end the program in all these cases */ |
519 | 522 |
if (sig_flag==SIGINT) |
520 | 523 |
DBG("INT received, program terminates\n"); |
521 |
-#ifdef OBSOLETED |
|
522 |
- else if (sig_flag==SIGPIPE) |
|
523 |
- DBG("SIGPIPE received, program terminates\n"); |
|
524 |
-#endif |
|
525 | 524 |
else |
526 | 525 |
DBG("SIGTERM received, program terminates\n"); |
527 | 526 |
|
... | ... |
@@ -627,11 +626,13 @@ int main_loop() |
627 | 626 |
*/ |
628 | 627 |
|
629 | 628 |
/* we need another process to act as the timer*/ |
630 |
-#ifndef USE_TCP |
|
629 |
+#ifdef USE_TCP |
|
631 | 630 |
/* if we are using tcp we always need a timer process, |
632 | 631 |
* we cannot count on select timeout to measure time |
633 | 632 |
* (it works only on linux) |
634 | 633 |
*/ |
634 |
+ if ((!tcp_disable)||(timer_list)) |
|
635 |
+#else |
|
635 | 636 |
if (timer_list) |
636 | 637 |
#endif |
637 | 638 |
{ |
... | ... |
@@ -703,17 +704,19 @@ int main_loop() |
703 | 704 |
sendipv6=&sock_info[r]; |
704 | 705 |
#endif |
705 | 706 |
#ifdef USE_TCP |
706 |
- tcp_info[r]=sock_info[r]; /* copy the sockets */ |
|
707 |
- /* same thing for tcp */ |
|
708 |
- if (tcp_init(&tcp_info[r])==-1) goto error; |
|
709 |
- /* get first ipv4/ipv6 socket*/ |
|
710 |
- if ((tcp_info[r].address.af==AF_INET)&& |
|
711 |
- ((sendipv4_tcp==0)||(sendipv4_tcp->is_lo))) |
|
712 |
- sendipv4_tcp=&tcp_info[r]; |
|
713 |
- #ifdef USE_IPV6 |
|
714 |
- if((sendipv6_tcp==0)&&(tcp_info[r].address.af==AF_INET6)) |
|
715 |
- sendipv6_tcp=&tcp_info[r]; |
|
716 |
- #endif |
|
707 |
+ if (!tcp_disable){ |
|
708 |
+ tcp_info[r]=sock_info[r]; /* copy the sockets */ |
|
709 |
+ /* same thing for tcp */ |
|
710 |
+ if (tcp_init(&tcp_info[r])==-1) goto error; |
|
711 |
+ /* get first ipv4/ipv6 socket*/ |
|
712 |
+ if ((tcp_info[r].address.af==AF_INET)&& |
|
713 |
+ ((sendipv4_tcp==0)||(sendipv4_tcp->is_lo))) |
|
714 |
+ sendipv4_tcp=&tcp_info[r]; |
|
715 |
+ #ifdef USE_IPV6 |
|
716 |
+ if((sendipv6_tcp==0)&&(tcp_info[r].address.af==AF_INET6)) |
|
717 |
+ sendipv6_tcp=&tcp_info[r]; |
|
718 |
+ #endif |
|
719 |
+ } |
|
717 | 720 |
#endif |
718 | 721 |
/* all procs should have access to all the sockets (for sending) |
719 | 722 |
* so we open all first*/ |
... | ... |
@@ -722,10 +725,12 @@ int main_loop() |
722 | 725 |
for(i=0;i<children_no;i++){ |
723 | 726 |
process_no++; |
724 | 727 |
#ifdef USE_TCP |
725 |
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd)<0){ |
|
726 |
- LOG(L_ERR, "ERROR: main_loop: socketpair failed: %s\n", |
|
727 |
- strerror(errno)); |
|
728 |
- goto error; |
|
728 |
+ if(!tcp_disable){ |
|
729 |
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd)<0){ |
|
730 |
+ LOG(L_ERR, "ERROR: main_loop: socketpair failed: %s\n", |
|
731 |
+ strerror(errno)); |
|
732 |
+ goto error; |
|
733 |
+ } |
|
729 | 734 |
} |
730 | 735 |
#endif |
731 | 736 |
if ((pid=fork())<0){ |
... | ... |
@@ -734,8 +739,10 @@ int main_loop() |
734 | 739 |
}else if (pid==0){ |
735 | 740 |
/* child */ |
736 | 741 |
#ifdef USE_TCP |
737 |
- close(sockfd[0]); |
|
738 |
- unix_tcp_sock=sockfd[1]; |
|
742 |
+ if (!tcp_disable){ |
|
743 |
+ close(sockfd[0]); |
|
744 |
+ unix_tcp_sock=sockfd[1]; |
|
745 |
+ } |
|
739 | 746 |
#endif |
740 | 747 |
bind_address=&sock_info[r]; /* shortcut */ |
741 | 748 |
bind_idx=r; |
... | ... |
@@ -753,9 +760,12 @@ int main_loop() |
753 | 760 |
"receiver child=%d sock=%d @ %s:%s", i, r, |
754 | 761 |
sock_info[r].name.s, sock_info[r].port_no_str.s ); |
755 | 762 |
#ifdef USE_TCP |
756 |
- close(sockfd[1]); |
|
757 |
- pt[process_no].unix_sock=sockfd[0]; |
|
758 |
- pt[process_no].idx=-1; /* this is not "tcp" process*/ |
|
763 |
+ if (!tcp_disable){ |
|
764 |
+ close(sockfd[1]); |
|
765 |
+ pt[process_no].unix_sock=sockfd[0]; |
|
766 |
+ pt[process_no].idx=-1; /* this is not a "tcp" |
|
767 |
+ process*/ |
|
768 |
+ } |
|
759 | 769 |
#endif |
760 | 770 |
} |
761 | 771 |
} |
... | ... |
@@ -775,16 +785,20 @@ int main_loop() |
775 | 785 |
goto error; |
776 | 786 |
} |
777 | 787 |
|
778 |
-#ifndef USE_TCP |
|
788 |
+#ifdef USE_TCP |
|
779 | 789 |
/* if we are using tcp we always need the timer */ |
790 |
+ if ((!tcp_disable)||(timer_list)) |
|
791 |
+#else |
|
780 | 792 |
if (timer_list) |
781 | 793 |
#endif |
782 | 794 |
{ |
783 | 795 |
#ifdef USE_TCP |
784 |
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd)<0){ |
|
785 |
- LOG(L_ERR, "ERROR: main_loop: socketpair failed: %s\n", |
|
786 |
- strerror(errno)); |
|
787 |
- goto error; |
|
796 |
+ if (!tcp_disable){ |
|
797 |
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd)<0){ |
|
798 |
+ LOG(L_ERR, "ERROR: main_loop: socketpair failed: %s\n", |
|
799 |
+ strerror(errno)); |
|
800 |
+ goto error; |
|
801 |
+ } |
|
788 | 802 |
} |
789 | 803 |
#endif |
790 | 804 |
/* fork again for the attendant process*/ |
... | ... |
@@ -796,8 +810,10 @@ int main_loop() |
796 | 810 |
/* child */ |
797 | 811 |
/* is_main=0; */ |
798 | 812 |
#ifdef USE_TCP |
799 |
- close(sockfd[0]); |
|
800 |
- unix_tcp_sock=sockfd[1]; |
|
813 |
+ if (!tcp_disable){ |
|
814 |
+ close(sockfd[0]); |
|
815 |
+ unix_tcp_sock=sockfd[1]; |
|
816 |
+ } |
|
801 | 817 |
#endif |
802 | 818 |
if (init_child(PROC_TIMER) < 0) { |
803 | 819 |
LOG(L_ERR, "timer: init_child failed\n"); |
... | ... |
@@ -815,43 +831,49 @@ int main_loop() |
815 | 831 |
pt[process_no].pid=pid; |
816 | 832 |
strncpy(pt[process_no].desc, "timer", MAX_PT_DESC ); |
817 | 833 |
#ifdef USE_TCP |
834 |
+ if(!tcp_disable){ |
|
818 | 835 |
close(sockfd[1]); |
819 | 836 |
pt[process_no].unix_sock=sockfd[0]; |
820 | 837 |
pt[process_no].idx=-1; /* this is not a "tcp" process*/ |
838 |
+ } |
|
821 | 839 |
#endif |
822 | 840 |
} |
823 | 841 |
} |
824 | 842 |
#ifdef USE_TCP |
825 |
- /* start tcp receivers */ |
|
826 |
- if (tcp_init_children()<0) goto error; |
|
827 |
- /* start tcp master proc */ |
|
828 |
- process_no++; |
|
829 |
- if ((pid=fork())<0){ |
|
830 |
- LOG(L_CRIT, "main_loop: cannot fork tcp main process\n"); |
|
831 |
- goto error; |
|
832 |
- }else if (pid==0){ |
|
833 |
- /* child */ |
|
834 |
- /* is_main=0; */ |
|
835 |
- if (init_child(PROC_TCP_MAIN) < 0) { |
|
836 |
- LOG(L_ERR, "tcp_main: error in init_child\n"); |
|
843 |
+ if (!tcp_disable){ |
|
844 |
+ /* start tcp receivers */ |
|
845 |
+ if (tcp_init_children()<0) goto error; |
|
846 |
+ /* start tcp master proc */ |
|
847 |
+ process_no++; |
|
848 |
+ if ((pid=fork())<0){ |
|
849 |
+ LOG(L_CRIT, "main_loop: cannot fork tcp main process\n"); |
|
837 | 850 |
goto error; |
851 |
+ }else if (pid==0){ |
|
852 |
+ /* child */ |
|
853 |
+ /* is_main=0; */ |
|
854 |
+ if (init_child(PROC_TCP_MAIN) < 0) { |
|
855 |
+ LOG(L_ERR, "tcp_main: error in init_child\n"); |
|
856 |
+ goto error; |
|
857 |
+ } |
|
858 |
+ tcp_main_loop(); |
|
859 |
+ }else{ |
|
860 |
+ pt[process_no].pid=pid; |
|
861 |
+ strncpy(pt[process_no].desc, "tcp main process", MAX_PT_DESC ); |
|
862 |
+ pt[process_no].unix_sock=-1; |
|
863 |
+ pt[process_no].idx=-1; /* this is not a "tcp" process*/ |
|
864 |
+ unix_tcp_sock=-1; |
|
838 | 865 |
} |
839 |
- tcp_main_loop(); |
|
840 |
- }else{ |
|
841 |
- pt[process_no].pid=pid; |
|
842 |
- strncpy(pt[process_no].desc, "tcp main process", MAX_PT_DESC ); |
|
843 |
- pt[process_no].unix_sock=-1; |
|
844 |
- pt[process_no].idx=-1; /* this is not a "tcp" process*/ |
|
845 |
- unix_tcp_sock=-1; |
|
846 | 866 |
} |
847 | 867 |
#endif |
848 | 868 |
/* main */ |
849 | 869 |
pt[0].pid=getpid(); |
850 | 870 |
strncpy(pt[0].desc, "attendant", MAX_PT_DESC ); |
851 | 871 |
#ifdef USE_TCP |
852 |
- pt[process_no].unix_sock=-1; |
|
853 |
- pt[process_no].idx=-1; /* this is not a "tcp" process*/ |
|
854 |
- unix_tcp_sock=-1; |
|
872 |
+ if(!tcp_disable){ |
|
873 |
+ pt[process_no].unix_sock=-1; |
|
874 |
+ pt[process_no].idx=-1; /* this is not a "tcp" process*/ |
|
875 |
+ unix_tcp_sock=-1; |
|
876 |
+ } |
|
855 | 877 |
#endif |
856 | 878 |
/*DEBUG- remove it*/ |
857 | 879 |
#ifdef DEBUG |
... | ... |
@@ -1140,7 +1162,7 @@ int main(int argc, char** argv) |
1140 | 1162 |
#ifdef STATS |
1141 | 1163 |
"s:" |
1142 | 1164 |
#endif |
1143 |
- "f:p:m:b:l:n:rRvdDEVhw:t:u:g:P:i:"; |
|
1165 |
+ "f:p:m:b:l:n:N:rRvdDETVhw:t:u:g:P:i:"; |
|
1144 | 1166 |
|
1145 | 1167 |
while((c=getopt(argc,argv,options))!=-1){ |
1146 | 1168 |
switch(c){ |
... | ... |
@@ -1227,6 +1249,25 @@ int main(int argc, char** argv) |
1227 | 1249 |
case 'E': |
1228 | 1250 |
log_stderr=1; |
1229 | 1251 |
break; |
1252 |
+ case 'T': |
|
1253 |
+#ifdef USE_TCP |
|
1254 |
+ tcp_disable=1; |
|
1255 |
+#else |
|
1256 |
+ fprintf(stderr,"WARNING: tcp support not compiled in\n"); |
|
1257 |
+#endif |
|
1258 |
+ break; |
|
1259 |
+ case 'N': |
|
1260 |
+#ifdef USE_TCP |
|
1261 |
+ tcp_children_no=strtol(optarg, &tmp, 10); |
|
1262 |
+ if ((tmp==0) ||(*tmp)){ |
|
1263 |
+ fprintf(stderr, "bad process number: -N %s\n", |
|
1264 |
+ optarg); |
|
1265 |
+ goto error; |
|
1266 |
+ } |
|
1267 |
+#else |
|
1268 |
+ fprintf(stderr,"WARNING: tcp support not compiled in\n"); |
|
1269 |
+#endif |
|
1270 |
+ break; |
|
1230 | 1271 |
case 'V': |
1231 | 1272 |
printf("version: %s\n", version); |
1232 | 1273 |
printf("flags: %s\n", flags ); |
... | ... |
@@ -1324,13 +1365,6 @@ try_again: |
1324 | 1365 |
LOG(L_CRIT, "could not initialize timer, exiting...\n"); |
1325 | 1366 |
goto error; |
1326 | 1367 |
} |
1327 |
-#ifdef USE_TCP |
|
1328 |
- /*init tcp*/ |
|
1329 |
- if (init_tcp()<0){ |
|
1330 |
- LOG(L_CRIT, "could not initialize tcp, exiting...\n"); |
|
1331 |
- goto error; |
|
1332 |
- } |
|
1333 |
-#endif |
|
1334 | 1368 |
|
1335 | 1369 |
/* register a diagnostic FIFO command */ |
1336 | 1370 |
if (register_core_fifo()<0) { |
... | ... |
@@ -1357,14 +1391,8 @@ try_again: |
1357 | 1391 |
|
1358 | 1392 |
if (children_no<=0) children_no=CHILD_NO; |
1359 | 1393 |
#ifdef USE_TCP |
1360 |
- tcp_children_no=children_no; |
|
1361 |
-#endif |
|
1362 |
-#ifdef _OBSOLETED |
|
1363 |
- else if (children_no >= MAX_PROCESSES ) { |
|
1364 |
- fprintf(stderr, "ERROR: too many children processes configured;" |
|
1365 |
- " maximum is %d\n", |
|
1366 |
- MAX_PROCESSES-1 ); |
|
1367 |
- goto error; |
|
1394 |
+ if (!tcp_disable){ |
|
1395 |
+ if (tcp_children_no<=0) tcp_children_no=children_no; |
|
1368 | 1396 |
} |
1369 | 1397 |
#endif |
1370 | 1398 |
|
... | ... |
@@ -1592,6 +1620,15 @@ try_again: |
1592 | 1620 |
" use only the the first one)":""); |
1593 | 1621 |
} |
1594 | 1622 |
|
1623 |
+#ifdef USE_TCP |
|
1624 |
+ if (!tcp_disable){ |
|
1625 |
+ /*init tcp*/ |
|
1626 |
+ if (init_tcp()<0){ |
|
1627 |
+ LOG(L_CRIT, "could not initialize tcp, exiting...\n"); |
|
1628 |
+ goto error; |
|
1629 |
+ } |
|
1630 |
+ } |
|
1631 |
+#endif |
|
1595 | 1632 |
/* init_daemon? */ |
1596 | 1633 |
if (!dont_fork){ |
1597 | 1634 |
if ( daemonize(argv[0]) <0 ) goto error; |
... | ... |
@@ -210,9 +210,9 @@ int add_uac( struct cell *t, struct sip_msg *request, str *uri, str* next_hop, |
210 | 210 |
|
211 | 211 |
send_sock=get_send_socket( &to , proxy->proto); |
212 | 212 |
if (send_sock==0) { |
213 |
- LOG(L_ERR, "ERROR: add_uac: can't fwd to af %d " |
|
213 |
+ LOG(L_ERR, "ERROR: add_uac: can't fwd to af %d, proto %d " |
|
214 | 214 |
" (no corresponding listening socket)\n", |
215 |
- to.s.sa_family ); |
|
215 |
+ to.s.sa_family, proxy->proto ); |
|
216 | 216 |
ret=ser_error=E_NO_SOCKET; |
217 | 217 |
goto error01; |
218 | 218 |
} |
... | ... |
@@ -908,8 +908,8 @@ int init_rb( struct retr_buf *rb, struct sip_msg *msg) |
908 | 908 |
rb->dst.proto_reserved1=msg->rcv.proto_reserved1; |
909 | 909 |
send_sock=get_send_socket(&rb->dst.to, proto); |
910 | 910 |
if (send_sock==0) { |
911 |
- LOG(L_ERR, "ERROR: init_rb: cannot fwd to af %d " |
|
912 |
- "no socket\n", rb->dst.to.s.sa_family); |
|
911 |
+ LOG(L_ERR, "ERROR: init_rb: cannot fwd to af %d, proto %d " |
|
912 |
+ "no socket\n", rb->dst.to.s.sa_family, proto); |
|
913 | 913 |
ser_error=E_BAD_VIA; |
914 | 914 |
return 0; |
915 | 915 |
} |
... | ... |
@@ -54,6 +54,9 @@ |
54 | 54 |
* 2003-03-01 kr set through a function now (jiri) |
55 | 55 |
* 2003-03-19 replaced all mallocs/frees w/ pkg_malloc/pkg_free (andrei) |
56 | 56 |
* 2003-04-02 port_no_str does not contain a leading ':' anymore (andrei) |
57 |
+ * 2003-04-15 t_uac_dlg now uses get_send_socket(get_out_socket doesn't |
|
58 |
+ * work for tcp) (andrei) |
|
59 |
+ * |
|
57 | 60 |
*/ |
58 | 61 |
|
59 | 62 |
|
... | ... |
@@ -218,10 +221,10 @@ static struct socket_info *uri2sock( str *uri, union sockaddr_union *to_su, |
218 | 221 |
|
219 | 222 |
hostent2su(to_su, &proxy->host, proxy->addr_idx, |
220 | 223 |
(proxy->port) ? proxy->port : SIP_PORT); |
221 |
- send_sock=get_out_socket(to_su, proto); |
|
224 |
+ send_sock=get_send_socket(to_su, proxy->proto); |
|
222 | 225 |
if (send_sock == 0) { |
223 |
- LOG(L_ERR, "ERROR: uri2sock: no corresponding socket for af %d\n", |
|
224 |
- to_su->s.sa_family ); |
|
226 |
+ LOG(L_ERR, "ERROR: uri2sock: no corresponding socket for af %d," |
|
227 |
+ "proto %d\n", to_su->s.sa_family , proto); |
|
225 | 228 |
ser_error = E_NO_SOCKET; |
226 | 229 |
} |
227 | 230 |
|
... | ... |
@@ -370,7 +373,7 @@ int t_uac_dlg(str* msg, /* Type of the message - MESSAGE, OP |
370 | 373 |
request = &new_cell->uac[branch].request; |
371 | 374 |
request->dst.to = to_su; |
372 | 375 |
request->dst.send_sock = send_sock; |
373 |
- request->dst.proto = proto; |
|
376 |
+ request->dst.proto = send_sock->proto; |
|
374 | 377 |
request->dst.proto_reserved1 = 0; |
375 | 378 |
|
376 | 379 |
/* need to put in table to calculate label which is needed for printing */ |
... | ... |
@@ -28,6 +28,11 @@ |
28 | 28 |
* along with this program; if not, write to the Free Software |
29 | 29 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
30 | 30 |
*/ |
31 |
+/* |
|
32 |
+ * History: |
|
33 |
+ * -------- |
|
34 |
+ * 2003-04-15 added tcp_disable support (andrei) |
|
35 |
+ */ |
|
31 | 36 |
|
32 | 37 |
|
33 | 38 |
#ifndef _PT_H |
... | ... |
@@ -66,9 +71,10 @@ inline static int process_count() |
66 | 71 |
/* fifo server */ |
67 | 72 |
+((fifo==NULL || strlen(fifo)==0) ? 0 : 1 ) |
68 | 73 |
#ifdef USE_TCP |
69 |
- + 1/* tcp main */ + tcp_children_no + |
|
70 |
- (timer_list ? 0: 1) /* add the timer proc. if not already taken |
|
71 |
- into account */ |
|
74 |
+ + (!tcp_disable)?( 1/* tcp main */ + tcp_children_no + |
|
75 |
+ (timer_list ? 0: 1)):0 /* add the timer proc. |
|
76 |
+ if not already taken |
|
77 |
+ into account */ |
|
72 | 78 |
#endif |
73 | 79 |
|
74 | 80 |
; |
... | ... |
@@ -8,7 +8,7 @@ ser \- very fast and configurable sip proxy |
8 | 8 |
.SH SYNOPSIS |
9 | 9 |
.B ser |
10 | 10 |
[ |
11 |
-.B \-hcrRvdDEV |
|
11 |
+.B \-hcrRvdDEVT |
|
12 | 12 |
] [ |
13 | 13 |
.BI \-f " config\-file" |
14 | 14 |
] [ |
... | ... |
@@ -19,6 +19,8 @@ ser \- very fast and configurable sip proxy |
19 | 19 |
] [ |
20 | 20 |
.BI \-n " processes\-no" |
21 | 21 |
] [ |
22 |
+.BI \-N " tcp processes\-no" |
|
23 |
+] [ |
|
22 | 24 |
.BI \-b " max_rcv_buf_size" |
23 | 25 |
] [ |
24 | 26 |
.BI \-m " shared_mem_size" |
... | ... |
@@ -74,6 +76,9 @@ Runs ser in the foreground (it doesn't fork into daemon mode). |
74 | 76 |
.BI \-E |
75 | 77 |
Sends all the log messages to stderr. |
76 | 78 |
.TP |
79 |
+.BI \-T |
|
80 |
+Disables TCP support. |
|
81 |
+.TP |
|
77 | 82 |
.BI \-V |
78 | 83 |
Displays the version number. |
79 | 84 |
.TP |
... | ... |
@@ -98,6 +103,11 @@ and to all the following that do not have a corresponding |
98 | 103 |
.BI \-n " processes\-no" |
99 | 104 |
Specifies the number of children processes forked per interface (default 8). |
100 | 105 |
.TP |
106 |
+.BI \-N " tcp processes\-no" |
|
107 |
+Specifies the number of children processes forked to handle tcp incoming connections (by default is equal to |
|
108 |
+.BI \-n |
|
109 |
+). |
|
110 |
+.TP |
|
101 | 111 |
.BI \-b " max_rcv_buf_size" |
102 | 112 |
Maximum receive buffer size which will not be exceeded by the auto-probing procedure even if the OS allows. |
103 | 113 |
.TP |
... | ... |
@@ -171,4 +181,4 @@ Report bugs at |
171 | 181 |
.nf |
172 | 182 |
https://developer.berlios.de/bugs/?func=addbug&group_id=480 . |
173 | 183 |
.br |
174 |
-For help/support, write an email to <serhelp@iptel.org>. |
|
184 |
+For help/support, write an email to <serhelp@iptel.org> or <seruser@iptel.org>. |