Bugfixes for ZeroConf

git-svn-id: svn://kolibrios.org@3735 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2013-06-30 20:25:38 +00:00
parent 95a615f8dd
commit 0f8bff0b72

View File

@ -272,7 +272,7 @@ build_request: ; Creates a DHCP request
mov [edx+240+15], word 0x0437 ; option request list mov [edx+240+15], word 0x0437 ; option request list
mov [edx+240+17], dword 0x0f060301 mov [edx+240+17], dword 0x0f060301
cmp [dhcpMsgType], byte 0x01 ; Check which msg we are sending cmp [dhcpMsgType], 0x01 ; Check which msg we are sending
jne request_options jne request_options
mov [edx+240+21], byte 0xff ; end of options marker mov [edx+240+21], byte 0xff ; end of options marker
@ -292,12 +292,15 @@ request_options:
send_dhcpmsg: send_dhcpmsg:
DEBUGF 1,"Sending DHCP discover/request\n" DEBUGF 1,"Sending DHCP discover/request\n"
mcall 75, 6, [socketNum], [dhcpMsg], [dhcpMsgLen] ; write to socket ( send broadcast request ) mcall 75, 6, [socketNum], [dhcpMsg], [dhcpMsgLen] ; write to socket ( send broadcast request )
.wait:
mcall 23, TIMEOUT*100 ; wait for data mcall 23, TIMEOUT*100 ; wait for data
read_data: ; we have data - this will be the response read_data: ; we have data - this will be the response
mcall 75, 7, [socketNum], [dhcpMsg], BUFFER, MSG_DONTWAIT ; read data from socket mcall 75, 7, [socketNum], [dhcpMsg], BUFFER, MSG_DONTWAIT ; read data from socket
cmp eax, -1 cmp eax, -1
jne @f jne @f
cmp ebx, 6 ; EWOULDBLOCK
je send_dhcpmsg.wait
DEBUGF 1,"No answer from DHCP server\n" DEBUGF 1,"No answer from DHCP server\n"
dec [tries] dec [tries]
jnz send_dhcpmsg ; try again jnz send_dhcpmsg ; try again
@ -329,7 +332,7 @@ read_data: ; we have data -
discover: discover:
call parse_response call parse_response
cmp [dhcpMsgType], 0x02 ; Was the response an offer? cmp [dhcpMsgType2], 0x02 ; Was the response an offer?
je send_request je send_request
call dhcp_end call dhcp_end
@ -343,7 +346,7 @@ send_request:
request: request:
call parse_response call parse_response
cmp [dhcpMsgType], 0x05 ; Was the response an ACK? It should be cmp [dhcpMsgType2], 0x05 ; Was the response an ACK? It should be
jne read_data ; NO - read next packets jne read_data ; NO - read next packets
DEBUGF 2, "Setting IP using DHCP\n" DEBUGF 2, "Setting IP using DHCP\n"
@ -385,6 +388,7 @@ parse_response:
DEBUGF 1,"Data received, parsing response\n" DEBUGF 1,"Data received, parsing response\n"
mov edx, [dhcpMsg] mov edx, [dhcpMsg]
mov [dhcpMsgType2], 0
push dword [edx+16] push dword [edx+16]
pop [dhcp.ip] pop [dhcp.ip]
@ -441,7 +445,7 @@ parse_response:
.msgtype: .msgtype:
mov al, [edx] mov al, [edx]
mov [dhcpMsgType], al mov [dhcpMsgType2], al
DEBUGF 1,"DHCP Msg type: %u\n", al DEBUGF 1,"DHCP Msg type: %u\n", al
jmp .next_option ; Get next option jmp .next_option ; Get next option
@ -558,6 +562,7 @@ link_local:
error: error:
DEBUGF 2,"Socket error\n" DEBUGF 2,"Socket error\n"
exit: ; we should, instead of closing, detect ARP conflicts and detect if cable keeps connected ;) exit: ; we should, instead of closing, detect ARP conflicts and detect if cable keeps connected ;)
DEBUGF 2,"Exiting\n"
mcall -1 mcall -1
@ -620,7 +625,8 @@ device db 1
inibuf rb 16 inibuf rb 16
tries db ? tries db ?
dhcpMsgType db ? dhcpMsgType db ? ; sent
dhcpMsgType2 db ? ; received
dhcpLease dd ? dhcpLease dd ?
dhcpServerIP dd ? dhcpServerIP dd ?