Commit 101c59356292c30ed5c8f7138c7680b4dc3d4811

Authored by bellard
1 parent b6853697

64 bit fixes (initial patch by Gwenole Beauchesne)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1458 c046a42c-6fe2-441c-8c8c-71466251a162
slirp/bootp.c
@@ -238,7 +238,7 @@ static void bootp_reply(struct bootp_t *bp) @@ -238,7 +238,7 @@ static void bootp_reply(struct bootp_t *bp)
238 238
239 void bootp_input(struct mbuf *m) 239 void bootp_input(struct mbuf *m)
240 { 240 {
241 - struct bootp_t *bp = (struct bootp_t *)m->m_data; 241 + struct bootp_t *bp = mtod(m, struct bootp_t *);
242 242
243 if (bp->bp_op == BOOTP_REQUEST) { 243 if (bp->bp_op == BOOTP_REQUEST) {
244 bootp_reply(bp); 244 bootp_reply(bp);
slirp/bootp.h
@@ -97,9 +97,9 @@ struct bootp_t { @@ -97,9 +97,9 @@ struct bootp_t {
97 uint8_t bp_htype; 97 uint8_t bp_htype;
98 uint8_t bp_hlen; 98 uint8_t bp_hlen;
99 uint8_t bp_hops; 99 uint8_t bp_hops;
100 - unsigned long bp_xid;  
101 - unsigned short bp_secs;  
102 - unsigned short unused; 100 + uint32_t bp_xid;
  101 + uint16_t bp_secs;
  102 + uint16_t unused;
103 struct in_addr bp_ciaddr; 103 struct in_addr bp_ciaddr;
104 struct in_addr bp_yiaddr; 104 struct in_addr bp_yiaddr;
105 struct in_addr bp_siaddr; 105 struct in_addr bp_siaddr;
slirp/ip_icmp.h
@@ -83,8 +83,8 @@ struct icmp { @@ -83,8 +83,8 @@ struct icmp {
83 struct ip idi_ip; 83 struct ip idi_ip;
84 /* options and then 64 bits of data */ 84 /* options and then 64 bits of data */
85 } id_ip; 85 } id_ip;
86 - u_long id_mask;  
87 - char id_data[1]; 86 + uint32_t id_mask;
  87 + char id_data[1];
88 } icmp_dun; 88 } icmp_dun;
89 #define icmp_otime icmp_dun.id_ts.its_otime 89 #define icmp_otime icmp_dun.id_ts.its_otime
90 #define icmp_rtime icmp_dun.id_ts.its_rtime 90 #define icmp_rtime icmp_dun.id_ts.its_rtime
slirp/libslirp.h
@@ -9,6 +9,10 @@ int inet_aton(const char *cp, struct in_addr *ia); @@ -9,6 +9,10 @@ int inet_aton(const char *cp, struct in_addr *ia);
9 #include <arpa/inet.h> 9 #include <arpa/inet.h>
10 #endif 10 #endif
11 11
  12 +#ifdef __cplusplus
  13 +extern "C" {
  14 +#endif
  15 +
12 void slirp_init(void); 16 void slirp_init(void);
13 17
14 void slirp_select_fill(int *pnfds, 18 void slirp_select_fill(int *pnfds,
@@ -29,4 +33,8 @@ int slirp_add_exec(int do_pty, const char *args, int addr_low_byte, @@ -29,4 +33,8 @@ int slirp_add_exec(int do_pty, const char *args, int addr_low_byte,
29 33
30 extern const char *tftp_prefix; 34 extern const char *tftp_prefix;
31 35
  36 +#ifdef __cplusplus
  37 +}
  38 +#endif
  39 +
32 #endif 40 #endif
slirp/slirp_config.h
@@ -149,8 +149,7 @@ @@ -149,8 +149,7 @@
149 #define SIZEOF_INT 4 149 #define SIZEOF_INT 4
150 150
151 /* Define to sizeof(char *) */ 151 /* Define to sizeof(char *) */
152 -/* XXX: patch it */  
153 -#define SIZEOF_CHAR_P 4 152 +#define SIZEOF_CHAR_P (HOST_LONG_BITS / 8)
154 153
155 /* Define if you have random() */ 154 /* Define if you have random() */
156 #undef HAVE_RANDOM 155 #undef HAVE_RANDOM
slirp/udp.c
@@ -420,10 +420,16 @@ struct talk_request { @@ -420,10 +420,16 @@ struct talk_request {
420 #endif 420 #endif
421 421
422 struct cu_header { 422 struct cu_header {
423 - char dest[8];  
424 - short family;  
425 - u_short port;  
426 - u_long addr; 423 + uint16_t d_family; // destination family
  424 + uint16_t d_port; // destination port
  425 + uint32_t d_addr; // destination address
  426 + uint16_t s_family; // source family
  427 + uint16_t s_port; // source port
  428 + uint32_t s_addr; // source address
  429 + uint32_t seqn; // sequence number
  430 + uint16_t message; // message
  431 + uint16_t data_type; // data type
  432 + uint16_t pkt_len; // packet length
427 } *cu_head; 433 } *cu_head;
428 434
429 switch(so->so_emu) { 435 switch(so->so_emu) {
@@ -610,8 +616,8 @@ struct cu_header { @@ -610,8 +616,8 @@ struct cu_header {
610 if (getsockname(so->s, (struct sockaddr *)&addr, &addrlen) < 0) 616 if (getsockname(so->s, (struct sockaddr *)&addr, &addrlen) < 0)
611 return; 617 return;
612 cu_head = mtod(m, struct cu_header *); 618 cu_head = mtod(m, struct cu_header *);
613 - cu_head->port = addr.sin_port;  
614 - cu_head->addr = (u_long) our_addr.s_addr; 619 + cu_head->s_port = addr.sin_port;
  620 + cu_head->s_addr = our_addr.s_addr;
615 } 621 }
616 622
617 return; 623 return;
slirp/udp.h
@@ -94,6 +94,7 @@ struct udpstat { @@ -94,6 +94,7 @@ struct udpstat {
94 94
95 extern struct udpstat udpstat; 95 extern struct udpstat udpstat;
96 extern struct socket udb; 96 extern struct socket udb;
  97 +struct mbuf;
97 98
98 void udp_init _P((void)); 99 void udp_init _P((void));
99 void udp_input _P((register struct mbuf *, int)); 100 void udp_input _P((register struct mbuf *, int));