aboutsummaryrefslogtreecommitdiffstats
path: root/slirp/bootp.c
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
commit55f4e4a5ec657a017e3bf75299ad71fd1c968dd3 (patch)
tree550ce922ea0e125ac6a9738210ce2939bf2fe901 /slirp/bootp.c
parent413f05aaf54fa08c0ae7e997327a4f4a473c0a8d (diff)
downloadexternal_qemu-55f4e4a5ec657a017e3bf75299ad71fd1c968dd3.zip
external_qemu-55f4e4a5ec657a017e3bf75299ad71fd1c968dd3.tar.gz
external_qemu-55f4e4a5ec657a017e3bf75299ad71fd1c968dd3.tar.bz2
Initial Contribution
Diffstat (limited to 'slirp/bootp.c')
-rw-r--r--slirp/bootp.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/slirp/bootp.c b/slirp/bootp.c
index 62cbcfd..79f5f9f 100644
--- a/slirp/bootp.c
+++ b/slirp/bootp.c
@@ -38,6 +38,8 @@ typedef struct {
BOOTPClient bootp_clients[NB_ADDR];
+const char *bootp_filename;
+
static const uint8_t rfc1533_cookie[] = { RFC1533_COOKIE };
#ifdef DEBUG
@@ -125,7 +127,7 @@ static void dhcp_decode(const uint8_t *buf, int size,
static void bootp_reply(struct bootp_t *bp)
{
BOOTPClient *bc;
- struct mbuf *m;
+ MBuf m;
struct bootp_t *rbp;
struct sockaddr_in saddr, daddr;
struct in_addr dns_addr;
@@ -145,7 +147,7 @@ static void bootp_reply(struct bootp_t *bp)
/* XXX: this is a hack to get the client mac address */
memcpy(client_ethaddr, bp->bp_hwaddr, 6);
- if ((m = m_get()) == NULL)
+ if ((m = mbuf_alloc()) == NULL)
return;
m->m_data += if_maxlinkhdr;
rbp = (struct bootp_t *)m->m_data;
@@ -168,6 +170,9 @@ static void bootp_reply(struct bootp_t *bp)
goto new_addr;
}
}
+ if (bootp_filename)
+ snprintf((char*)rbp->bp_file, sizeof(rbp->bp_file), "%s", bootp_filename);
+
dprintf("offered addr=%08x\n", ntohl(daddr.sin_addr.s_addr));
saddr.sin_addr.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_ALIAS);
@@ -244,9 +249,9 @@ static void bootp_reply(struct bootp_t *bp)
udp_output2(NULL, m, &saddr, &daddr, IPTOS_LOWDELAY);
}
-void bootp_input(struct mbuf *m)
+void bootp_input(MBuf m)
{
- struct bootp_t *bp = mtod(m, struct bootp_t *);
+ struct bootp_t *bp = MBUF_TO(m, struct bootp_t *);
if (bp->bp_op == BOOTP_REQUEST) {
bootp_reply(bp);