Some 64-bit fixes to bootp, icmp, udp (cu-seeme). However, it can happen

that on certain occasions, it doesn't work. Some timing problem?
This commit is contained in:
gbeauche 2005-05-13 14:02:37 +00:00
parent 745bc86678
commit fdfcd3eb86
6 changed files with 21 additions and 16 deletions

View File

@ -45,10 +45,9 @@
#include <net/if_tun.h>
#endif
// XXX: slirp is currently not 64-bit clean
#if SIZEOF_VOID_P == 4
// XXX: slirp works on 64-bit platforms, sometimes
#define HAVE_SLIRP 1
#endif
#include "libslirp.h"
#include "cpu_emulation.h"
#include "main.h"
@ -57,7 +56,6 @@
#include "user_strings.h"
#include "ether.h"
#include "ether_defs.h"
#include "libslirp.h"
#ifndef NO_STD_NAMESPACE
using std::map;

View File

@ -238,7 +238,7 @@ static void bootp_reply(struct bootp_t *bp)
void bootp_input(struct mbuf *m)
{
struct bootp_t *bp = (struct bootp_t *)m->m_data;
struct bootp_t *bp = mtod(m, struct bootp_t *);
if (bp->bp_op == BOOTP_REQUEST) {
bootp_reply(bp);

View File

@ -97,9 +97,9 @@ struct bootp_t {
uint8_t bp_htype;
uint8_t bp_hlen;
uint8_t bp_hops;
unsigned long bp_xid;
unsigned short bp_secs;
unsigned short unused;
uint32_t bp_xid;
uint16_t bp_secs;
uint16_t unused;
struct in_addr bp_ciaddr;
struct in_addr bp_yiaddr;
struct in_addr bp_siaddr;

View File

@ -83,8 +83,8 @@ struct icmp {
struct ip idi_ip;
/* options and then 64 bits of data */
} id_ip;
u_long id_mask;
char id_data[1];
uint32_t id_mask;
char id_data[1];
} icmp_dun;
#define icmp_otime icmp_dun.id_ts.its_otime
#define icmp_rtime icmp_dun.id_ts.its_rtime

View File

@ -420,10 +420,16 @@ struct talk_request {
#endif
struct cu_header {
char dest[8];
short family;
u_short port;
u_long addr;
uint16_t d_family; // destination family
uint16_t d_port; // destination port
uint32_t d_addr; // destination address
uint16_t s_family; // source family
uint16_t s_port; // source port
uint32_t s_addr; // source address
uint32_t seqn; // sequence number
uint16_t message; // message
uint16_t data_type; // data type
uint16_t pkt_len; // packet length
} *cu_head;
switch(so->so_emu) {
@ -610,8 +616,8 @@ struct cu_header {
if (getsockname(so->s, (struct sockaddr *)&addr, &addrlen) < 0)
return;
cu_head = mtod(m, struct cu_header *);
cu_head->port = addr.sin_port;
cu_head->addr = (u_long) our_addr.s_addr;
cu_head->s_port = addr.sin_port;
cu_head->s_addr = our_addr.s_addr;
}
return;

View File

@ -94,6 +94,7 @@ struct udpstat {
extern struct udpstat udpstat;
extern struct socket udb;
struct mbuf;
void udp_init _P((void));
void udp_input _P((register struct mbuf *, int));