- fixed port byte order bugs introduced last night
authorAndrei Pelinescu-Onciul <andrei@iptel.org>
Sun, 6 Apr 2003 14:05:35 +0000 (14:05 +0000)
committerAndrei Pelinescu-Onciul <andrei@iptel.org>
Sun, 6 Apr 2003 14:05:35 +0000 (14:05 +0000)
- 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)

Makefile.defs
action.c
forward.c
modules/tm/t_fwd.c
modules/tm/uac.c
tcp_main.c
udp_server.c

index d3492a2..30d59ba 100644 (file)
@@ -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]")
index 45b7933..5b72dcc 100644 (file)
--- a/action.c
+++ b/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;
index e1483c9..bba172e 100644 (file)
--- a/forward.c
+++ b/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;
 }
 
index 3a99eb5..72cfd98 100644 (file)
@@ -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) {
index 66af391..36dd178 100644 (file)
@@ -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", 
index 31f1042..0121372 100644 (file)
@@ -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;
        }
index 6c26002..086520b 100644 (file)
@@ -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;
        }