Commit d981b88344e2c2b21683bea2af63a7bd519df21d

Authored by bellard
1 parent 4a4883b8

give a new address at DHCPREQUEST too (useful if the OS remembers its IP address


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1081 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 4 additions and 2 deletions
slirp/bootp.c
@@ -150,6 +150,7 @@ static void bootp_reply(struct bootp_t *bp) @@ -150,6 +150,7 @@ static void bootp_reply(struct bootp_t *bp)
150 memset(rbp, 0, sizeof(struct bootp_t)); 150 memset(rbp, 0, sizeof(struct bootp_t));
151 151
152 if (dhcp_msg_type == DHCPDISCOVER) { 152 if (dhcp_msg_type == DHCPDISCOVER) {
  153 + new_addr:
153 bc = get_new_addr(&daddr.sin_addr); 154 bc = get_new_addr(&daddr.sin_addr);
154 if (!bc) { 155 if (!bc) {
155 dprintf("no address left\n"); 156 dprintf("no address left\n");
@@ -159,8 +160,9 @@ static void bootp_reply(struct bootp_t *bp) @@ -159,8 +160,9 @@ static void bootp_reply(struct bootp_t *bp)
159 } else { 160 } else {
160 bc = find_addr(&daddr.sin_addr, bp->bp_hwaddr); 161 bc = find_addr(&daddr.sin_addr, bp->bp_hwaddr);
161 if (!bc) { 162 if (!bc) {
162 - dprintf("no address assigned\n");  
163 - return; 163 + /* if never assigned, behaves as if it was already
  164 + assigned (windows fix because it remembers its address) */
  165 + goto new_addr;
164 } 166 }
165 } 167 }
166 dprintf("offered addr=%08x\n", ntohl(daddr.sin_addr.s_addr)); 168 dprintf("offered addr=%08x\n", ntohl(daddr.sin_addr.s_addr));