]> Git Repo - qemu.git/blobdiff - slirp/tcp_subr.c
Merge remote branch 'mst/for_anthony' into staging
[qemu.git] / slirp / tcp_subr.c
index 51b38344ef357b34e4eb84e0129dc98723ddfcd6..b661d2623c52c3d180260d6038b435d7934e7122 100644 (file)
@@ -134,8 +134,8 @@ tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m,
                m->m_len = sizeof (struct tcpiphdr);
                tlen = 0;
 #define xchg(a,b,type) { type t; t=a; a=b; b=t; }
-               xchg(ti->ti_dst.s_addr, ti->ti_src.s_addr, u_int32_t);
-               xchg(ti->ti_dport, ti->ti_sport, u_int16_t);
+               xchg(ti->ti_dst.s_addr, ti->ti_src.s_addr, uint32_t);
+               xchg(ti->ti_dport, ti->ti_sport, uint16_t);
 #undef xchg
        }
        ti->ti_len = htons((u_short)(sizeof (struct tcphdr) + tlen));
@@ -150,9 +150,9 @@ tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m,
        ti->ti_off = sizeof (struct tcphdr) >> 2;
        ti->ti_flags = flags;
        if (tp)
-               ti->ti_win = htons((u_int16_t) (win >> tp->rcv_scale));
+               ti->ti_win = htons((uint16_t) (win >> tp->rcv_scale));
        else
-               ti->ti_win = htons((u_int16_t)win);
+               ti->ti_win = htons((uint16_t)win);
        ti->ti_urp = 0;
        ti->ti_sum = 0;
        ti->ti_sum = cksum(m, tlen);
@@ -325,7 +325,7 @@ int tcp_fconnect(struct socket *so)
   DEBUG_CALL("tcp_fconnect");
   DEBUG_ARG("so = %lx", (long )so);
 
-  if( (ret=so->s=socket(AF_INET,SOCK_STREAM,0)) >= 0) {
+  if( (ret = so->s = qemu_socket(AF_INET,SOCK_STREAM,0)) >= 0) {
     int opt, s=so->s;
     struct sockaddr_in addr;
 
@@ -340,7 +340,8 @@ int tcp_fconnect(struct socket *so)
         slirp->vnetwork_addr.s_addr) {
       /* It's an alias */
       if (so->so_faddr.s_addr == slirp->vnameserver_addr.s_addr) {
-       addr.sin_addr = dns_addr;
+       if (get_dns_addr(&addr.sin_addr) < 0)
+         addr.sin_addr = loopback_addr;
       } else {
        addr.sin_addr = loopback_addr;
       }
@@ -490,7 +491,7 @@ static struct emu_t *tcpemu = NULL;
 /*
  * Return TOS according to the above table
  */
-u_int8_t
+uint8_t
 tcp_tos(struct socket *so)
 {
        int i = 0;
@@ -547,7 +548,7 @@ tcp_emu(struct socket *so, struct mbuf *m)
        Slirp *slirp = so->slirp;
        u_int n1, n2, n3, n4, n5, n6;
         char buff[257];
-       u_int32_t laddr;
+       uint32_t laddr;
        u_int lport;
        char *bptr;
 
@@ -856,7 +857,7 @@ tcp_emu(struct socket *so, struct mbuf *m)
                                if (p == 7071)
                                   p = 0;
                                *(u_char *)bptr++ = (p >> 8) & 0xff;
-                               *(u_char *)bptr++ = p & 0xff;
+                                *(u_char *)bptr = p & 0xff;
                                ra = 0;
                                return 1;   /* port redirected, we're done */
                                break;
This page took 0.025705 seconds and 4 git commands to generate.