瀏覽代碼

- replaced msg->src_ip w/ msg->rcv.src_ip (to be in sync w/ core)$
- updated all get_send_sock , forward_request & via_builder calls to the new
format (proto included) [now it compiles and hopefully works on udp]

Andrei Pelinescu-Onciul 23 年之前
父節點
當前提交
0a22850173
共有 5 個文件被更改,包括 11 次插入10 次删除
  1. 2 2
      modules/tm/t_funcs.c
  2. 2 2
      modules/tm/t_fwd.c
  3. 1 1
      modules/tm/t_lookup.c
  4. 4 3
      modules/tm/t_msgbuilder.c
  5. 2 2
      modules/tm/uac.c

+ 2 - 2
modules/tm/t_funcs.c

@@ -221,7 +221,7 @@ int t_relay_to( struct sip_msg  *p_msg , struct proxy_l *proxy,
 					ret=E_BAD_ADDRESS;
 					ret=E_BAD_ADDRESS;
 					goto done;
 					goto done;
 			}
 			}
-			ret=forward_request( p_msg , proxy ) ;
+			ret=forward_request( p_msg , proxy, p_msg->rcv.proto) ;
 			free_proxy( proxy );	
 			free_proxy( proxy );	
 			free( proxy );
 			free( proxy );
 #ifdef ACK_FORKING_HACK
 #ifdef ACK_FORKING_HACK
@@ -238,7 +238,7 @@ int t_relay_to( struct sip_msg  *p_msg , struct proxy_l *proxy,
 			p_msg->new_uri=backup_uri;
 			p_msg->new_uri=backup_uri;
 #endif
 #endif
 		} else {
 		} else {
-			ret=forward_request( p_msg , proxy ) ;
+			ret=forward_request( p_msg , proxy, p_msg->rcv.proto ) ;
 #ifdef ACK_FORKING_HACK
 #ifdef ACK_FORKING_HACK
 			backup_uri=p_msg->new_uri;
 			backup_uri=p_msg->new_uri;
 			init_branch_iterator();
 			init_branch_iterator();

+ 2 - 2
modules/tm/t_fwd.c

@@ -79,7 +79,7 @@ char *print_uac_request( struct cell *t, struct sip_msg *i_req,
 	callback_event( TMCB_REQUEST_OUT, t, i_req, -i_req->REQ_METHOD);
 	callback_event( TMCB_REQUEST_OUT, t, i_req, -i_req->REQ_METHOD);
 
 
 	/* ... and build it now */
 	/* ... and build it now */
-	buf=build_req_buf_from_sip_req( i_req, len, send_sock );
+	buf=build_req_buf_from_sip_req( i_req, len, send_sock, i_req->rcv.proto );
 #ifdef DBG_MSG_QA
 #ifdef DBG_MSG_QA
 	if (buf[*len-1]==0) {
 	if (buf[*len-1]==0) {
 		LOG(L_ERR, "ERROR: print_uac_request: sanity check failed\n");
 		LOG(L_ERR, "ERROR: print_uac_request: sanity check failed\n");
@@ -173,7 +173,7 @@ int add_uac( struct cell *t, struct sip_msg *request, str *uri,
 	hostent2su( &to, &proxy->host, proxy->addr_idx, 
 	hostent2su( &to, &proxy->host, proxy->addr_idx, 
 		proxy->port ? htons(proxy->port):htons(SIP_PORT));
 		proxy->port ? htons(proxy->port):htons(SIP_PORT));
 
 
-	send_sock=get_send_socket( &to );
+	send_sock=get_send_socket( &to , request->rcv.proto);
 	if (send_sock==0) {
 	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 "
 			" (no corresponding listening socket)\n",
 			" (no corresponding listening socket)\n",

+ 1 - 1
modules/tm/t_lookup.c

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

+ 4 - 3
modules/tm/t_msgbuilder.c

@@ -81,7 +81,7 @@ char *build_local(struct cell *Trans,unsigned int branch,
 		branch_buf, &branch_len ))
 		branch_buf, &branch_len ))
 		goto error;
 		goto error;
 	via=via_builder(&via_len, Trans->uac[branch].request.send_sock,
 	via=via_builder(&via_len, Trans->uac[branch].request.send_sock,
-		branch_buf, branch_len );
+		branch_buf, branch_len, Trans->uac[branch].request.send_sock->proto );
 	if (!via)
 	if (!via)
 	{
 	{
 		LOG(L_ERR, "ERROR: t_build_and_send_CANCEL: "
 		LOG(L_ERR, "ERROR: t_build_and_send_CANCEL: "
@@ -225,7 +225,7 @@ char *build_uac_request(  str msg_type, str dst, str from,
 		goto error;
 		goto error;
 	}
 	}
 	via=via_builder(&via_len, t->uac[branch].request.send_sock,
 	via=via_builder(&via_len, t->uac[branch].request.send_sock,
-		branch_buf, branch_len );
+		branch_buf, branch_len, t->uac[branch].request.send_sock->proto);
 	
 	
 	if (!via) {
 	if (!via) {
 		LOG(L_ERR, "ERROR: build_uac_request: via building failed\n");
 		LOG(L_ERR, "ERROR: build_uac_request: via building failed\n");
@@ -365,7 +365,8 @@ char *build_uac_request_dlg(str* msg,           /* Method */
 		goto error;
 		goto error;
 	}
 	}
 
 
-	via = via_builder(&via_len, t->uac[branch].request.send_sock, branch_buf, branch_len);
+	via = via_builder(&via_len, t->uac[branch].request.send_sock, 
+			branch_buf, branch_len, t->uac[branch].request.send_sock->proto);
 	if (!via) {
 	if (!via) {
 		LOG(L_ERR, "ERROR: build_uac_request_dlg: via building failed\n");
 		LOG(L_ERR, "ERROR: build_uac_request_dlg: via building failed\n");
 		goto error;
 		goto error;

+ 2 - 2
modules/tm/uac.c

@@ -202,7 +202,7 @@ int t_uac( str *msg_type, str *dst,
 	/* T->uac[branch].request.to_len=sizeof(union sockaddr_union); */
 	/* T->uac[branch].request.to_len=sizeof(union sockaddr_union); */
 	hostent2su(&to, &proxy->host, proxy->addr_idx, 
 	hostent2su(&to, &proxy->host, proxy->addr_idx, 
 		(proxy->port)?htons(proxy->port):htons(SIP_PORT));
 		(proxy->port)?htons(proxy->port):htons(SIP_PORT));
-	send_sock=get_send_socket( &to );
+	send_sock=get_send_socket( &to, PROTO_UDP );
 	if (send_sock==0) {
 	if (send_sock==0) {
 		LOG(L_ERR, "ERROR: t_uac: no corresponding listening socket "
 		LOG(L_ERR, "ERROR: t_uac: no corresponding listening socket "
 			"for af %d\n", to.s.sa_family );
 			"for af %d\n", to.s.sa_family );
@@ -345,7 +345,7 @@ int t_uac_dlg(str* msg,                     /* Type of the message - MESSAGE, OP
 
 
 	branch=0;
 	branch=0;
 	hostent2su(&to_su, &proxy->host, proxy->addr_idx, (proxy->port) ? htons(proxy->port) : htons(SIP_PORT));
 	hostent2su(&to_su, &proxy->host, proxy->addr_idx, (proxy->port) ? htons(proxy->port) : htons(SIP_PORT));
-	send_sock=get_send_socket(&to_su);
+	send_sock=get_send_socket(&to_su, PROTO_UDP);
 	if (send_sock == 0) {
 	if (send_sock == 0) {
 		LOG(L_ERR, "ERROR: t_uac_dlg: no corresponding listening socket for af %d\n", to_su.s.sa_family );
 		LOG(L_ERR, "ERROR: t_uac_dlg: no corresponding listening socket for af %d\n", to_su.s.sa_family );
 		ret = E_NO_SOCKET;
 		ret = E_NO_SOCKET;