فهرست منبع

- fixed port byte order bugs introduced last night
- updated modules to use the new byte ordering (now all the ports are kept in host byte order, previously some structures used network byte order and in other host byte order)

Andrei Pelinescu-Onciul 22 سال پیش
والد
کامیت
6eacb2bc95
7فایلهای تغییر یافته به همراه10 افزوده شده و 10 حذف شده
  1. 1 1
      Makefile.defs
  2. 1 1
      action.c
  3. 2 2
      forward.c
  4. 1 1
      modules/tm/t_fwd.c
  5. 1 1
      modules/tm/uac.c
  6. 3 3
      tcp_main.c
  7. 1 1
      udp_server.c

+ 1 - 1
Makefile.defs

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

+ 1 - 1
action.c

@@ -190,7 +190,7 @@ int do_action(struct action* a, struct sip_msg* msg)
 				p->ok=1;
 			}
 			ret=hostent2su(	to, &p->host, p->addr_idx,
-						(p->port)?htons(p->port):htons(SIP_PORT) );
+						(p->port)?p->port:SIP_PORT );
 			if (ret==0){
 				p->tx++;
 				p->tx_bytes+=msg->len;

+ 2 - 2
forward.c

@@ -280,7 +280,7 @@ int forward_request( struct sip_msg* msg, struct proxy_l * p, int proto)
 	}
 	
 	hostent2su(to, &p->host, p->addr_idx, 
-				(p->port)?htons(p->port):htons(SIP_PORT));
+				(p->port)?p->port:SIP_PORT);
 	p->tx++;
 	p->tx_bytes+=len;
 	
@@ -410,7 +410,7 @@ int update_sock_struct_from_via( union sockaddr_union* to,
 		return -1;
 	}
 		
-	hostent2su(to, he, 0, htons(port));
+	hostent2su(to, he, 0, port);
 	return 1;
 }
 

+ 1 - 1
modules/tm/t_fwd.c

@@ -204,7 +204,7 @@ int add_uac( struct cell *t, struct sip_msg *request, str *uri, str* next_hop,
 	}
 
 	hostent2su( &to, &proxy->host, proxy->addr_idx, 
-		proxy->port ? htons(proxy->port):htons(SIP_PORT));
+		proxy->port ? proxy->port:SIP_PORT);
 
 	send_sock=get_send_socket( &to , proto);
 	if (send_sock==0) {

+ 1 - 1
modules/tm/uac.c

@@ -217,7 +217,7 @@ static struct socket_info *uri2sock( str *uri, union sockaddr_union *to_su,
 	}
 
 	hostent2su(to_su, &proxy->host, proxy->addr_idx, 
-			(proxy->port) ? htons(proxy->port) : htons(SIP_PORT));
+			(proxy->port) ? proxy->port : SIP_PORT);
 	send_sock=get_out_socket(to_su, proto);
 	if (send_sock == 0) {
 		LOG(L_ERR, "ERROR: uri2sock: no corresponding socket for af %d\n", 

+ 3 - 3
tcp_main.c

@@ -268,7 +268,7 @@ void tcpconn_rm(struct tcp_connection* c)
 }
 
 
-/* finds a connection, if id=0 uses the ip addr & port
+/* finds a connection, if id=0 uses the ip addr & port (host byte order)
  * WARNING: unprotected (locks) use tcpconn_get unless you really
  * know what you are doing */
 struct tcp_connection* _tcpconn_find(int id, struct ip_addr* ip, int port)
@@ -277,7 +277,7 @@ struct tcp_connection* _tcpconn_find(int id, struct ip_addr* ip, int port)
 	struct tcp_connection *c;
 	unsigned hash;
 	
-	DBG("tcpconn_find: %d ",id ); print_ip(ip); DBG(" %d\n", ntohs(port));
+	DBG("tcpconn_find: %d ",id ); print_ip(ip); DBG(" %d\n", port);
 	if (id){
 		hash=tcp_id_hash(id);
 		for (c=tcpconn_id_hash[hash]; c; c=c->id_next){
@@ -505,7 +505,7 @@ int tcp_init(struct socket_info* sock_info)
 	
 	addr=&sock_info->su;
 	sock_info->proto=PROTO_TCP;
-	if (init_su(addr, &sock_info->address, htons(sock_info->port_no))<0){
+	if (init_su(addr, &sock_info->address, sock_info->port_no)<0){
 		LOG(L_ERR, "ERROR: tcp_init: could no init sockaddr_union\n");
 		goto error;
 	}

+ 1 - 1
udp_server.c

@@ -217,7 +217,7 @@ int udp_init(struct socket_info* sock_info)
 	}
 */
 	sock_info->proto=PROTO_UDP;
-	if (init_su(addr, &sock_info->address, htons(sock_info->port_no))<0){
+	if (init_su(addr, &sock_info->address, sock_info->port_no)<0){
 		LOG(L_ERR, "ERROR: udp_init: could not init sockaddr_union\n");
 		goto error;
 	}