Rev 1166 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1166 | Rev 1170 | ||
---|---|---|---|
Line 42... | Line 42... | ||
42 | DEFEND_INTERVAL equ 10 ; seconds (min. wait between defensive ARPs) |
42 | DEFEND_INTERVAL equ 10 ; seconds (min. wait between defensive ARPs) |
Line 43... | Line 43... | ||
43 | 43 | ||
- | 44 | ||
Line 44... | Line 45... | ||
44 | 45 | ||
Line 133... | Line 134... | ||
133 | 134 | ||
Line 134... | Line 135... | ||
134 | mcall 40, 1 shl 7 ; network event |
135 | mcall 40, 1 shl 7 ; network event |
Line 135... | Line 136... | ||
135 | 136 | ||
Line 136... | Line 137... | ||
136 | ; eth.set_network_drv 0x00000383 |
137 | ; eth.set_network_drv 0x00000383 |
137 | 138 | ||
138 | DEBUGF 1,"Zero-config service:\n" |
139 | DEBUGF 1,">Zero-config service:\n" |
139 | 140 | ||
Line 154... | Line 155... | ||
154 | ; jmp @r |
155 | ; jmp @r |
Line 155... | Line 156... | ||
155 | 156 | ||
156 | ; @@: |
157 | ; @@: |
Line 157... | Line 158... | ||
157 | ; eth.read_mac MAC |
158 | ; eth.read_mac MAC |
158 | 159 | ||
159 | mcall 73, 10 |
160 | mcall 75, 1337 shl 16 + 4 |
Line 160... | Line 161... | ||
160 | mov word[MAC], bx |
161 | mov word[MAC], bx |
Line 161... | Line 162... | ||
161 | mov dword[MAC+2], eax |
162 | mov dword[MAC+2], eax |
162 | 163 | ||
163 | DEBUGF 1,"MAC: %x-%x-%x-%x-%x-%x\n",[MAC]:2,[MAC+1]:2,[MAC+2]:2,[MAC+3]:2,[MAC+4]:2,[MAC+5]:2 |
164 | DEBUGF 1,"->MAC: %x-%x-%x-%x-%x-%x\n",[MAC]:2,[MAC+1]:2,[MAC+2]:2,[MAC+3]:2,[MAC+4]:2,[MAC+5]:2 |
164 | 165 | ||
Line 171... | Line 172... | ||
171 | 172 | ||
172 | mov esi, filename |
173 | mov esi, filename |
173 | movsd |
174 | movsd |
Line 174... | Line 175... | ||
174 | movsb |
175 | movsb |
Line 175... | Line 176... | ||
175 | 176 | ||
Line 176... | Line 177... | ||
176 | DEBUGF 1,"path to ini: %s\n", path |
177 | DEBUGF 1,"->path to ini: %s\n", path |
177 | 178 | ||
Line 213... | Line 214... | ||
213 | mcall -1 |
214 | mcall -1 |
Line 214... | Line 215... | ||
214 | 215 | ||
Line 215... | Line 216... | ||
215 | 216 | ||
Line 216... | Line 217... | ||
216 | skip_ini: |
217 | skip_ini: |
217 | 218 | ||
218 | DEBUGF 1,"Skip ini\n" |
219 | DEBUGF 1,"->Skip ini\n" |
219 | 220 | ||
Line 220... | Line 221... | ||
220 | mcall 74, 0, AF_INET4, 1, 0 ; open socket (parameters: domain, type, protocol) |
221 | mcall 74, 0, AF_INET4, IP_PROTO_UDP, 0 ; open socket (parameters: domain, type, reserved) |
Line 221... | Line 222... | ||
221 | cmp eax, -1 |
222 | cmp eax, -1 |
222 | je error |
223 | je error |
223 | mov [socketNum], eax |
224 | mov [socketNum], eax |
Line 224... | Line 225... | ||
224 | 225 | ||
225 | DEBUGF 1,"socket %x opened\n", eax |
- | |
Line 226... | Line 226... | ||
226 | 226 | DEBUGF 1,"->socket %x opened\n", eax |
|
227 | mcall 74, 2, [socketNum], sockaddr1, 18 ; bind socket to local port 68 |
227 | |
228 | cmp eax, -1 |
228 | mcall 74, 2, [socketNum], sockaddr1, 18 ; bind socket to local port 68 |
Line 229... | Line 229... | ||
229 | je error |
229 | cmp eax, -1 |
Line 230... | Line 230... | ||
230 | 230 | je error |
|
231 | DEBUGF 1,"Socket Bound to local port 68\n" |
231 | |
Line 232... | Line 232... | ||
232 | 232 | DEBUGF 1,"->Socket Bound to local port 68\n" |
|
233 | 233 | ||
234 | mcall 74, 4, [socketNum], sockaddr2, 18 ; connect to 255.255.255.255 on port 67 |
234 | mcall 74, 4, [socketNum], sockaddr2, 18 ; connect to 255.255.255.255 on port 67 |
Line 235... | Line 235... | ||
235 | cmp eax, -1 |
235 | cmp eax, -1 |
Line 236... | Line 236... | ||
236 | je error |
236 | je error |
Line 237... | Line 237... | ||
237 | 237 | ||
238 | DEBUGF 1,"Connected to 255.255.255.255 on port 67\n" |
238 | DEBUGF 1,"->Connected to 255.255.255.255 on port 67\n" |
239 | 239 | ||
240 | mov byte [dhcpMsgType], 0x01 ; DHCP discover |
240 | mov byte [dhcpMsgType], 0x01 ; DHCP discover |
Line 313... | Line 313... | ||
313 | 313 | ||
Line 314... | Line 314... | ||
314 | read_data: ; we have data - this will be the response |
314 | read_data: ; we have data - this will be the response |
Line 315... | Line 315... | ||
315 | 315 | ||
Line 316... | Line 316... | ||
316 | mcall 74, 7, [socketNum], [dhcpMsg], BUFFER ; read data from socket |
316 | mcall 74, 7, [socketNum], [dhcpMsg], BUFFER ; read data from socket |
317 | 317 | ||
318 | DEBUGF 1,"%u bytes received\n", eax |
318 | DEBUGF 1,"->%d bytes received\n", eax |
Line 319... | Line 319... | ||
319 | 319 | ||
320 | push eax |
320 | push eax |
Line 375... | Line 375... | ||
375 | parseResponse: |
375 | parseResponse: |
376 | DEBUGF 1,"Data received, parsing response\n" |
376 | DEBUGF 1,"Data received, parsing response\n" |
377 | mov edx, [dhcpMsg] |
377 | mov edx, [dhcpMsg] |
Line 378... | Line 378... | ||
378 | 378 | ||
379 | pusha |
379 | pusha |
380 | mcall 73, 3, [edx+16] |
380 | mcall 75, 3, [edx+16] |
381 | mov eax,[edx] |
381 | mov eax,[edx] |
382 | mov [dhcpClientIP],eax |
382 | mov [dhcpClientIP],eax |
383 | DEBUGF 1,"Client: %u.%u.%u.%u\n",[edx+16]:1,[edx+17]:1,[edx+18]:1,[edx+19]:1 |
383 | DEBUGF 1,"Client: %u.%u.%u.%u\n",[edx+16]:1,[edx+17]:1,[edx+18]:1,[edx+19]:1 |
Line 429... | Line 429... | ||
429 | @@: |
429 | @@: |
430 | cmp al, dhcp_subnet_mask |
430 | cmp al, dhcp_subnet_mask |
431 | jne @f |
431 | jne @f |
Line 432... | Line 432... | ||
432 | 432 | ||
433 | pusha |
433 | pusha |
434 | mcall 73, 5, [edx] |
434 | mcall 75, 7, [edx] |
435 | DEBUGF 1,"Subnet: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1 |
435 | DEBUGF 1,"Subnet: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1 |
Line 436... | Line 436... | ||
436 | popa |
436 | popa |
Line 437... | Line 437... | ||
437 | 437 | ||
438 | jmp next_option |
438 | jmp next_option |
439 | 439 | ||
Line 440... | Line 440... | ||
440 | @@: |
440 | @@: |
441 | cmp al, dhcp_router |
441 | cmp al, dhcp_router |
442 | jne @f |
442 | jne @f |
443 | 443 | ||
Line 444... | Line 444... | ||
444 | pusha |
444 | pusha |
Line 452... | Line 452... | ||
452 | @@: |
452 | @@: |
453 | cmp al, dhcp_domain_server |
453 | cmp al, dhcp_domain_server |
454 | jne next_option |
454 | jne next_option |
Line 455... | Line 455... | ||
455 | 455 | ||
456 | pusha |
456 | pusha |
457 | mcall 73, 7, [edx] |
457 | mcall 75, 5, [edx] |
458 | DEBUGF 1,"DNS: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1 |
458 | DEBUGF 1,"DNS: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1 |
Line 459... | Line 459... | ||
459 | popa |
459 | popa |