... | ... |
@@ -10,9 +10,9 @@ auto_gen=lex.yy.c cfg.tab.c #lexx, yacc etc |
10 | 10 |
#include source related defs |
11 | 11 |
include Makefile.sources |
12 | 12 |
|
13 |
-exclude_modules=CVS mysql |
|
13 |
+exclude_modules=CVS |
|
14 | 14 |
#mysql auth rr |
15 |
-static_modules= |
|
15 |
+static_modules=tm |
|
16 | 16 |
static_modules_path=$(addprefix modules/, $(static_modules)) |
17 | 17 |
extra_sources=$(wildcard $(addsuffix /*.c, $(static_modules_path))) |
18 | 18 |
extra_objs=$(extra_sources:.c=.o) |
... | ... |
@@ -1,4 +1,8 @@ |
1 |
+<<<<<<< Makefile.defs |
|
1 | 2 |
# $Id$ |
3 |
+======= |
|
4 |
+# $Id$ |
|
5 |
+>>>>>>> 1.99 |
|
2 | 6 |
# |
3 | 7 |
# makefile defs (CC, LD,a.s.o) |
4 | 8 |
# |
... | ... |
@@ -7,7 +11,7 @@ |
7 | 11 |
#version number |
8 | 12 |
VERSION = 0 |
9 | 13 |
PATCHLEVEL = 8 |
10 |
-SUBLEVEL = 8 |
|
14 |
+SUBLEVEL = 7 |
|
11 | 15 |
EXTRAVERSION = -3-ipv6 |
12 | 16 |
|
13 | 17 |
RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) |
... | ... |
@@ -74,22 +78,21 @@ ARCH = $(shell uname -m |sed -e s/i.86/i386/ -e s/sun4u/sparc64/ ) |
74 | 78 |
# -DNEW_HNAME |
75 | 79 |
# 32-bit header name parsing; turn off for lower speed ;-) or debugging; |
76 | 80 |
# to become non-optional if fast and stable |
77 |
-# -DSILENT_FR |
|
81 |
+# -SILENT_FR |
|
78 | 82 |
# if defined, when FR timer hits (in tm) cancel is sent only if forking |
79 | 83 |
# if used; otherwise, just delete the transaction without doing anything |
80 |
-# -DUSE_IPV6 |
|
81 |
-# compiles ipv6 support |
|
82 | 84 |
|
83 | 85 |
DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \ |
84 | 86 |
-DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"'\ |
85 |
- -DDNS_IP_HACK -DPKG_MALLOC \ |
|
87 |
+ -DPKG_MALLOC \ |
|
86 | 88 |
-DF_MALLOC \ |
87 | 89 |
-DSHM_MEM -DSHM_MMAP \ |
88 | 90 |
-DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 \ |
89 | 91 |
-DWAIT -DNEW_HNAME \ |
92 |
+ -DSILENT_FR \ |
|
90 | 93 |
-DUSE_IPV6 \ |
91 |
- -DVERY_NOISY_REPLIES\ |
|
92 |
- #-DSILENT_FR \ |
|
94 |
+ -DNOISY_REPLIES -DVERY_NOISY_REPLIES\ |
|
95 |
+ #-DUSE_SYNONIM\ |
|
93 | 96 |
#-DNO_DEBUG \ |
94 | 97 |
#-DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=0 \ |
95 | 98 |
#-DNOSMP \ |
... | ... |
@@ -230,7 +233,7 @@ ifeq ($(ARCH), sparc64) |
230 | 233 |
ifeq ($(CC_NAME), gcc) |
231 | 234 |
#common stuff |
232 | 235 |
CFLAGS=-O9 -funroll-loops -Wcast-align $(PROFILE) -Winline\ |
233 |
- -Wall #-Wmissing-prototypes \ |
|
236 |
+ #-Wmissing-prototypes \ |
|
234 | 237 |
#if gcc 3.0 |
235 | 238 |
ifeq ($(CC_SHORTVER), 3.0) |
236 | 239 |
#use 32bit for now |
... | ... |
@@ -318,7 +321,7 @@ endif |
318 | 321 |
# -andrei |
319 | 322 |
else #mode,release |
320 | 323 |
ifeq ($(CC_NAME), gcc) |
321 |
- CFLAGS=-g -Wcast-align -Winline $(PROFILE) -Wall |
|
324 |
+ CFLAGS=-g -Wcast-align -Winline $(PROFILE) |
|
322 | 325 |
LDFLAGS+=-g -Wl,-E $(PROFILE) |
323 | 326 |
endif |
324 | 327 |
ifeq ($(CC_NAME), icc) |
... | ... |
@@ -375,8 +378,7 @@ ifeq ($(OS), SunOS) |
375 | 378 |
ifeq ($(CC_NAME), suncc) |
376 | 379 |
LIBS=-lfast |
377 | 380 |
endif |
378 |
- LIBS+=-ldl -L/usr/local/lib -L/usr/lib/mysql -lfl -lresolv -lnsl \ |
|
379 |
- -lsocket -lrt |
|
381 |
+ LIBS+=-ldl -L/usr/local/lib -L/usr/lib/mysql -lfl -lxnet -lrt |
|
380 | 382 |
# -lrt needed for sched_yield |
381 | 383 |
endif |
382 | 384 |
|
... | ... |
@@ -123,8 +123,8 @@ struct sip_msg* sip_msg_cloner( struct sip_msg *org_msg ) |
123 | 123 |
|
124 | 124 |
/*computing the length of entire sip_msg structure*/ |
125 | 125 |
len = ROUND4(sizeof( struct sip_msg )); |
126 |
- /*we will keep only the original msg*/ |
|
127 |
- len += ROUND4(org_msg->len); |
|
126 |
+ /*we will keep only the original msg +ZT */ |
|
127 |
+ len += ROUND4(org_msg->len + 1); |
|
128 | 128 |
/*the new uri (if any)*/ |
129 | 129 |
if (org_msg->new_uri.s && org_msg->new_uri.len) |
130 | 130 |
len+= ROUND4(org_msg->new_uri.len); |
... | ... |
@@ -206,8 +206,10 @@ struct sip_msg* sip_msg_cloner( struct sip_msg *org_msg ) |
206 | 206 |
} |
207 | 207 |
/* message buffers(org and scratch pad) */ |
208 | 208 |
memcpy( p , org_msg->orig , org_msg->len); |
209 |
+ /* ZT to be safer */ |
|
210 |
+ *(p+org_msg->len)=0; |
|
209 | 211 |
new_msg->orig = new_msg->buf = p; |
210 |
- p += ROUND4(new_msg->len); |
|
212 |
+ p += ROUND4(new_msg->len+1); |
|
211 | 213 |
/* unparsed and eoh pointer */ |
212 | 214 |
new_msg->unparsed = translate_pointer(new_msg->buf ,org_msg->buf, |
213 | 215 |
org_msg->unparsed ); |
... | ... |
@@ -48,13 +48,15 @@ int t_build_and_send_CANCEL(struct cell *Trans,unsigned int branch) |
48 | 48 |
via = 0; |
49 | 49 |
p_msg = Trans->uas.request; |
50 | 50 |
|
51 |
- len = 0; |
|
52 |
- /*first line's len - CANCEL and INVITE has the same lenght */ |
|
53 |
- len += ( REQ_LINE(p_msg).version.s+REQ_LINE(p_msg).version.len)- |
|
54 |
- REQ_LINE(p_msg).method.s+CRLF_LEN; |
|
55 |
- /*check if the REQ URI was override */ |
|
51 |
+ /* method, separators, version */ |
|
52 |
+ len=SIP_VERSION_LEN + CANCEL_LEN + 2 /* spaces */ + CRLF_LEN; |
|
53 |
+ /* if URL was overridden .... */ |
|
56 | 54 |
if (Trans->uac[branch].uri.s) |
57 |
- len += Trans->uac[branch].uri.len - REQ_LINE(p_msg).uri.len; |
|
55 |
+ len+=Trans->uac[branch].uri.len; |
|
56 |
+ else |
|
57 |
+ /* ... otherwise use the inbound URL */ |
|
58 |
+ len+=REQ_LINE(p_msg).uri.len; |
|
59 |
+ |
|
58 | 60 |
/*via*/ |
59 | 61 |
if ( add_branch_label(Trans,p_msg,branch)==-1 ) |
60 | 62 |
goto error; |
... | ... |
@@ -67,16 +69,18 @@ int t_build_and_send_CANCEL(struct cell *Trans,unsigned int branch) |
67 | 69 |
} |
68 | 70 |
len+= via_len; |
69 | 71 |
/*headers*/ |
70 |
- for ( hdr=p_msg->headers ; hdr ; hdr=hdr->next ) |
|
71 |
- if (hdr->type==HDR_FROM || hdr->type==HDR_CALLID || |
|
72 |
- hdr->type==HDR_CSEQ || hdr->type==HDR_TO ) |
|
72 |
+ for ( hdr=p_msg->headers ; hdr ; hdr=hdr->next ) { |
|
73 |
+ if (hdr->type==HDR_FROM || hdr->type==HDR_CALLID |
|
74 |
+ || hdr->type==HDR_TO ) |
|
73 | 75 |
len += ((hdr->body.s+hdr->body.len ) - hdr->name.s ) + CRLF_LEN ; |
74 |
- /* User Agent header*/ |
|
75 |
- len += USER_AGENT_LEN + CRLF_LEN; |
|
76 |
- /* Content Lenght heder*/ |
|
77 |
- len += CONTENT_LEN_LEN + CRLF_LEN; |
|
78 |
- /* end of message */ |
|
79 |
- len += CRLF_LEN; |
|
76 |
+ else if (hdr->type==HDR_CSEQ) |
|
77 |
+ len += hdr->name.len + 2 + ((struct cseq_body*)hdr->parsed)->number.len + |
|
78 |
+ 1+CANCEL_LEN+CRLF_LEN; |
|
79 |
+ } |
|
80 |
+ /* User Agent, Conteny Length, EoM */ |
|
81 |
+ len += USER_AGENT_LEN + CRLF_LEN + |
|
82 |
+ CONTENT_LEN_LEN + CRLF_LEN + |
|
83 |
+ CRLF_LEN; |
|
80 | 84 |
|
81 | 85 |
cancel_buf=sh_malloc( len+1 ); |
82 | 86 |
if (!cancel_buf) |
... | ... |
@@ -86,24 +90,16 @@ int t_build_and_send_CANCEL(struct cell *Trans,unsigned int branch) |
86 | 90 |
} |
87 | 91 |
p = cancel_buf; |
88 | 92 |
|
89 |
- /* first line -> do we have a new URI? */ |
|
90 |
- if (Trans->uac[branch].uri.s) |
|
91 |
- { |
|
92 |
- append_mem_block(p,REQ_LINE(p_msg).method.s, |
|
93 |
- REQ_LINE(p_msg).uri.s-REQ_LINE(p_msg).method.s); |
|
94 |
- append_mem_block(p,Trans->uac[branch].uri.s, |
|
93 |
+ append_mem_block( p, CANCEL " ", CANCEL_LEN +1 ); |
|
94 |
+ if (Trans->uac[branch].uri.s) { |
|
95 |
+ append_mem_block( p, Trans->uac[branch].uri.s, |
|
95 | 96 |
Trans->uac[branch].uri.len); |
96 |
- append_mem_block(p,REQ_LINE(p_msg).uri.s+REQ_LINE(p_msg).uri.len, |
|
97 |
- REQ_LINE(p_msg).version.s+REQ_LINE(p_msg).version.len- |
|
98 |
- (REQ_LINE(p_msg).uri.s+REQ_LINE(p_msg).uri.len)) |
|
99 |
- }else{ |
|
100 |
- append_mem_block(p,REQ_LINE(p_msg).method.s, |
|
101 |
- REQ_LINE(p_msg).version.s+REQ_LINE(p_msg).version.len- |
|
102 |
- REQ_LINE(p_msg).method.s); |
|
97 |
+ } else { |
|
98 |
+ append_mem_block(p,REQ_LINE(p_msg).uri.s, |
|
99 |
+ REQ_LINE(p_msg).uri.len ); |
|
103 | 100 |
} |
104 |
- /* changhing method name*/ |
|
105 |
- memcpy(cancel_buf, CANCEL , CANCEL_LEN ); |
|
106 |
- append_mem_block(p,CRLF,CRLF_LEN); |
|
101 |
+ append_mem_block( p, " " SIP_VERSION CRLF, 1+SIP_VERSION_LEN+CRLF_LEN ); |
|
102 |
+ |
|
107 | 103 |
/* insert our via */ |
108 | 104 |
append_mem_block(p,via,via_len); |
109 | 105 |
|
... | ... |
@@ -115,22 +111,19 @@ int t_build_and_send_CANCEL(struct cell *Trans,unsigned int branch) |
115 | 111 |
append_mem_block(p,hdr->name.s, |
116 | 112 |
((hdr->body.s+hdr->body.len)-hdr->name.s) ); |
117 | 113 |
append_mem_block(p, CRLF, CRLF_LEN ); |
118 |
- }else if ( hdr->type==HDR_CSEQ ) |
|
114 |
+ } else if ( hdr->type==HDR_CSEQ ) |
|
119 | 115 |
{ |
120 |
- append_mem_block(p,hdr->name.s, |
|
121 |
- ((((struct cseq_body*)hdr->parsed)->method.s)-hdr->name.s)); |
|
122 |
- append_mem_block(p, CANCEL CRLF, CANCEL_LEN +CRLF_LEN ); |
|
116 |
+ append_mem_block(p,hdr->name.s, hdr->name.len ); |
|
117 |
+ append_mem_block(p,": ", 2 ); |
|
118 |
+ append_mem_block(p, ((struct cseq_body*)hdr->parsed)->number.s, |
|
119 |
+ ((struct cseq_body*)hdr->parsed)->number.len ); |
|
120 |
+ append_mem_block(p, " " CANCEL CRLF, 1+CANCEL_LEN+CRLF_LEN); |
|
123 | 121 |
} |
124 |
-} |
|
122 |
+ } |
|
125 | 123 |
|
126 |
- /* User Agent header */ |
|
127 |
- append_mem_block(p,USER_AGENT,USER_AGENT_LEN); |
|
128 |
- append_mem_block(p,CRLF,CRLF_LEN); |
|
129 |
- /* Content Lenght header*/ |
|
130 |
- append_mem_block(p,CONTENT_LEN,CONTENT_LEN_LEN); |
|
131 |
- append_mem_block(p,CRLF,CRLF_LEN); |
|
132 |
- /* end of message */ |
|
133 |
- append_mem_block(p,CRLF,CRLF_LEN); |
|
124 |
+ /* User Agent header, Content Length, EoM */ |
|
125 |
+ append_mem_block(p,USER_AGENT CRLF CONTENT_LEN CRLF CRLF , |
|
126 |
+ USER_AGENT_LEN + CRLF_LEN + CONTENT_LEN_LEN + CRLF_LEN + CRLF_LEN); |
|
134 | 127 |
*p=0; |
135 | 128 |
|
136 | 129 |
if (Trans->uac[branch].request.cancel) { |
... | ... |
@@ -93,7 +93,12 @@ inline void final_response_handler( void *attr) |
93 | 93 |
{ |
94 | 94 |
DBG("DEBUG: FR_handler:stop retr. and send CANCEL (%p)\n",r_buf->my_T); |
95 | 95 |
reset_timer( hash_table, &(r_buf->retr_timer) ); |
96 |
- t_build_and_send_CANCEL( r_buf->my_T ,r_buf->branch); |
|
96 |
+ /* BUG -- we want CANCELs actually ONLY for INVITE; BTW, the |
|
97 |
+ CANCEL construction method results for non-INVITEs in |
|
98 |
+ bizzar messages such as "CANCELS" for OPTIONS; -Jiri |
|
99 |
+ */ |
|
100 |
+ if (r_buf->my_T->uas.request->first_line.u.request.method_value==METHOD_INVITE) |
|
101 |
+ t_build_and_send_CANCEL( r_buf->my_T ,r_buf->branch); |
|
97 | 102 |
/* dirty hack:t_send_reply would increase ref_count which would indeed |
98 | 103 |
result in refcount++ which would not -- until timer processe's |
99 | 104 |
T changes again; currently only on next call to t_send_reply from |
... | ... |
@@ -42,6 +42,9 @@ int receive_msg(char* buf, unsigned int len, union sockaddr_union* src_su) |
42 | 42 |
/* fill in msg */ |
43 | 43 |
msg->buf=buf; |
44 | 44 |
msg->len=len; |
45 |
+ /* zero termination (termination of orig message bellow not that |
|
46 |
+ useful as most of the work is done with scrath-pad; -jiri */ |
|
47 |
+ buf[len]=0; |
|
45 | 48 |
su2ip_addr(&msg->src_ip, src_su); |
46 | 49 |
msg->dst_ip=bind_address->address; /* won't work if listening on 0.0.0.0 */ |
47 | 50 |
msg->id=msg_no; |
... | ... |
@@ -1,6 +1,6 @@ |
1 | 1 |
BYE sip:jiri@bat.iptel.org SIP/2.0 |
2 | 2 |
Max-Forwards: 0 |
3 |
-Via: SIP/2.0/UDP 195.37.77.101;branch=df6250bb14ccda4a69dc0502173d02b2.e0e.0 |
|
3 |
+Via: SIP/2.0/UDP 195.37.77.100;branch=df6250bb14ccda4a69dc0502173d02b2.e0e.0 |
|
4 | 4 |
Via: SIP/2.0/UDP 213.20.228.21:13671 |
5 | 5 |
From: "jiri" <sip:jiri@iptel.org>;tag=9c77afe9-71ec-4c52-a009-f2869fba848b |
6 | 6 |
To: <sip:jiri@bat.iptel.org>;tag=9c77afe9-71ec-4c52-a009-f2869fba848b |