mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-09-16 13:55:59 +00:00
Remove bootp debug code as it uses varargs macros that are not supported in
all foreign compilers (including preprocessor shipped with MacOS X!). Also fix build on platforms not including <stdint.h> by default.
This commit is contained in:
parent
77446db25d
commit
84c9d99d18
@ -40,13 +40,6 @@ BOOTPClient bootp_clients[NB_ADDR];
|
|||||||
|
|
||||||
static const uint8_t rfc1533_cookie[] = { RFC1533_COOKIE };
|
static const uint8_t rfc1533_cookie[] = { RFC1533_COOKIE };
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
#define dprintf(fmt, args...) \
|
|
||||||
if (slirp_debug & DBG_CALL) { fprintf(dfd, fmt, ## args); fflush(dfd); }
|
|
||||||
#else
|
|
||||||
#define dprintf(fmt, args...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static BOOTPClient *get_new_addr(struct in_addr *paddr)
|
static BOOTPClient *get_new_addr(struct in_addr *paddr)
|
||||||
{
|
{
|
||||||
BOOTPClient *bc;
|
BOOTPClient *bc;
|
||||||
@ -107,7 +100,6 @@ static void dhcp_decode(const uint8_t *buf, int size,
|
|||||||
if (p >= p_end)
|
if (p >= p_end)
|
||||||
break;
|
break;
|
||||||
len = *p++;
|
len = *p++;
|
||||||
dprintf("dhcp: tag=0x%02x len=%d\n", tag, len);
|
|
||||||
|
|
||||||
switch(tag) {
|
switch(tag) {
|
||||||
case RFC2132_MSG_TYPE:
|
case RFC2132_MSG_TYPE:
|
||||||
@ -134,7 +126,6 @@ static void bootp_reply(struct bootp_t *bp)
|
|||||||
|
|
||||||
/* extract exact DHCP msg type */
|
/* extract exact DHCP msg type */
|
||||||
dhcp_decode(bp->bp_vend, DHCP_OPT_LEN, &dhcp_msg_type);
|
dhcp_decode(bp->bp_vend, DHCP_OPT_LEN, &dhcp_msg_type);
|
||||||
dprintf("bootp packet op=%d msgtype=%d\n", bp->bp_op, dhcp_msg_type);
|
|
||||||
|
|
||||||
if (dhcp_msg_type == 0)
|
if (dhcp_msg_type == 0)
|
||||||
dhcp_msg_type = DHCPREQUEST; /* Force reply for old BOOTP clients */
|
dhcp_msg_type = DHCPREQUEST; /* Force reply for old BOOTP clients */
|
||||||
@ -155,10 +146,8 @@ static void bootp_reply(struct bootp_t *bp)
|
|||||||
if (dhcp_msg_type == DHCPDISCOVER) {
|
if (dhcp_msg_type == DHCPDISCOVER) {
|
||||||
new_addr:
|
new_addr:
|
||||||
bc = get_new_addr(&daddr.sin_addr);
|
bc = get_new_addr(&daddr.sin_addr);
|
||||||
if (!bc) {
|
if (!bc)
|
||||||
dprintf("no address left\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
memcpy(bc->macaddr, client_ethaddr, 6);
|
memcpy(bc->macaddr, client_ethaddr, 6);
|
||||||
} else {
|
} else {
|
||||||
bc = find_addr(&daddr.sin_addr, bp->bp_hwaddr);
|
bc = find_addr(&daddr.sin_addr, bp->bp_hwaddr);
|
||||||
@ -168,7 +157,6 @@ static void bootp_reply(struct bootp_t *bp)
|
|||||||
goto new_addr;
|
goto new_addr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dprintf("offered addr=%08x\n", ntohl(daddr.sin_addr.s_addr));
|
|
||||||
|
|
||||||
saddr.sin_addr.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_ALIAS);
|
saddr.sin_addr.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_ALIAS);
|
||||||
saddr.sin_port = htons(BOOTP_SERVER);
|
saddr.sin_port = htons(BOOTP_SERVER);
|
||||||
|
@ -37,6 +37,10 @@ typedef char *caddr_t;
|
|||||||
# define O_BINARY 0
|
# define O_BINARY 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
# include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifdef HAVE_SYS_BITYPES_H
|
#ifdef HAVE_SYS_BITYPES_H
|
||||||
# include <sys/bitypes.h>
|
# include <sys/bitypes.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user