Rev 1542 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1542 | Rev 2364 | ||
---|---|---|---|
Line 127... | Line 127... | ||
127 | 127 | ||
Line 128... | Line 128... | ||
128 | mcall 40, 1 shl 7 ; network event |
128 | mcall 40, 1 shl 7 ; network event |
Line 129... | Line 129... | ||
129 | 129 | ||
Line 130... | Line 130... | ||
130 | DEBUGF 1,">Zero-config service:\n" |
130 | DEBUGF 1,">Zero-config service:\n" |
131 | 131 | ||
Line 132... | Line 132... | ||
132 | mcall 75, 1337 shl 16 + 4 |
132 | mcall 76, 1337 shl 16 + 4 |
Line 167... | Line 167... | ||
167 | jne skip_ini |
167 | jne skip_ini |
Line 168... | Line 168... | ||
168 | 168 | ||
169 | invoke ini.get_str, path, str_ipconfig, str_ip, inibuf, 16, 0 |
169 | invoke ini.get_str, path, str_ipconfig, str_ip, inibuf, 16, 0 |
170 | mov edx, inibuf |
170 | mov edx, inibuf |
171 | call Ip2dword |
171 | call Ip2dword |
Line 172... | Line 172... | ||
172 | mcall 75, 3, edx |
172 | mcall 76, 3, edx |
173 | 173 | ||
174 | invoke ini.get_str, path, str_ipconfig, str_gateway, inibuf, 16, 0 |
174 | invoke ini.get_str, path, str_ipconfig, str_gateway, inibuf, 16, 0 |
175 | mov edx, inibuf |
175 | mov edx, inibuf |
Line 176... | Line 176... | ||
176 | call Ip2dword |
176 | call Ip2dword |
177 | mcall 75, 9, edx |
177 | mcall 76, 9, edx |
178 | 178 | ||
179 | invoke ini.get_str, path, str_ipconfig, str_dns, inibuf, 16, 0 |
179 | invoke ini.get_str, path, str_ipconfig, str_dns, inibuf, 16, 0 |
Line 180... | Line 180... | ||
180 | mov edx, inibuf |
180 | mov edx, inibuf |
181 | call Ip2dword |
181 | call Ip2dword |
182 | mcall 75, 5, edx |
182 | mcall 76, 5, edx |
183 | 183 | ||
Line 184... | Line 184... | ||
184 | invoke ini.get_str, path, str_ipconfig, str_subnet, inibuf, 16, 0 |
184 | invoke ini.get_str, path, str_ipconfig, str_subnet, inibuf, 16, 0 |
Line 185... | Line 185... | ||
185 | mov edx, inibuf |
185 | mov edx, inibuf |
Line 186... | Line 186... | ||
186 | call Ip2dword |
186 | call Ip2dword |
Line 187... | Line 187... | ||
187 | mcall 75, 7, edx |
187 | mcall 76, 7, edx |
188 | 188 | ||
189 | 189 | ||
190 | mcall -1 |
190 | mcall -1 |
Line 191... | Line 191... | ||
191 | 191 | ||
Line 192... | Line 192... | ||
192 | 192 | ||
193 | skip_ini: |
193 | skip_ini: |
194 | 194 | ||
Line 195... | Line 195... | ||
195 | DEBUGF 1,"->Skip ini\n" |
195 | DEBUGF 1,"->Skip ini\n" |
Line 196... | Line 196... | ||
196 | 196 | ||
197 | mcall 74, 0, AF_INET4, SOCK_DGRAM, 0 ; open socket (parameters: domain, type, reserved) |
197 | mcall 75, 0, AF_INET4, SOCK_DGRAM, 0 ; open socket (parameters: domain, type, reserved) |
198 | cmp eax, -1 |
198 | cmp eax, -1 |
Line 199... | Line 199... | ||
199 | je error |
199 | je error |
Line 281... | Line 281... | ||
281 | mov [edx+240+27], byte 0xff ; end of options marker |
281 | mov [edx+240+27], byte 0xff ; end of options marker |
Line 282... | Line 282... | ||
282 | 282 | ||
Line 283... | Line 283... | ||
283 | mov [dhcpMsgLen], dword 268 |
283 | mov [dhcpMsgLen], dword 268 |
284 | 284 | ||
Line 285... | Line 285... | ||
285 | send_request: |
285 | send_request: |
286 | mcall 74, 6, [socketNum], [dhcpMsg], [dhcpMsgLen] ; write to socket ( send broadcast request ) |
286 | mcall 75, 6, [socketNum], [dhcpMsg], [dhcpMsgLen] ; write to socket ( send broadcast request ) |
Line 287... | Line 287... | ||
287 | 287 | ||
Line 288... | Line 288... | ||
288 | mov eax, [dhcpMsg] ; Setup the DHCP buffer to receive response |
288 | mov eax, [dhcpMsg] ; Setup the DHCP buffer to receive response |
289 | mov [dhcpMsgLen], eax ; Used as a pointer to the data |
289 | mov [dhcpMsgLen], eax ; Used as a pointer to the data |
Line 290... | Line 290... | ||
290 | 290 | ||
Line 291... | Line 291... | ||
291 | mcall 23, TIMEOUT*10 ; wait for data |
291 | mcall 23, TIMEOUT*10 ; wait for data |
292 | 292 | ||
293 | read_data: ; we have data - this will be the response |
293 | read_data: ; we have data - this will be the response |
Line 294... | Line 294... | ||
294 | mcall 74, 7, [socketNum], [dhcpMsg], BUFFER ; read data from socket |
294 | mcall 75, 7, [socketNum], [dhcpMsg], BUFFER ; read data from socket |
295 | 295 | ||
Line 353... | Line 353... | ||
353 | parseResponse: |
353 | parseResponse: |
354 | DEBUGF 1,"Data received, parsing response\n" |
354 | DEBUGF 1,"Data received, parsing response\n" |
355 | mov edx, [dhcpMsg] |
355 | mov edx, [dhcpMsg] |
Line 356... | Line 356... | ||
356 | 356 | ||
357 | pusha |
357 | pusha |
358 | mcall 75, 3, [edx+16] |
358 | mcall 76, 3, [edx+16] |
359 | mov eax,[edx] |
359 | mov eax,[edx] |
360 | mov [dhcpClientIP],eax |
360 | mov [dhcpClientIP],eax |
361 | DEBUGF 1,"Client: %u.%u.%u.%u\n",[edx+16]:1,[edx+17]:1,[edx+18]:1,[edx+19]:1 |
361 | DEBUGF 1,"Client: %u.%u.%u.%u\n",[edx+16]:1,[edx+17]:1,[edx+18]:1,[edx+19]:1 |
Line 407... | Line 407... | ||
407 | @@: |
407 | @@: |
408 | cmp al, dhcp_subnet_mask |
408 | cmp al, dhcp_subnet_mask |
409 | jne @f |
409 | jne @f |
Line 410... | Line 410... | ||
410 | 410 | ||
411 | pusha |
411 | pusha |
412 | mcall 75, 7, [edx] |
412 | mcall 76, 7, [edx] |
413 | DEBUGF 1,"Subnet: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1 |
413 | DEBUGF 1,"Subnet: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1 |
Line 414... | Line 414... | ||
414 | popa |
414 | popa |
Line 415... | Line 415... | ||
415 | 415 | ||
416 | jmp next_option |
416 | jmp next_option |
417 | 417 | ||
Line 418... | Line 418... | ||
418 | @@: |
418 | @@: |
419 | cmp al, dhcp_router |
419 | cmp al, dhcp_router |
420 | jne @f |
420 | jne @f |
421 | 421 | ||
Line 422... | Line 422... | ||
422 | pusha |
422 | pusha |
Line 430... | Line 430... | ||
430 | @@: |
430 | @@: |
431 | cmp al, dhcp_domain_server |
431 | cmp al, dhcp_domain_server |
432 | jne next_option |
432 | jne next_option |
Line 433... | Line 433... | ||
433 | 433 | ||
434 | pusha |
434 | pusha |
435 | mcall 75, 5, [edx] |
435 | mcall 76, 5, [edx] |
436 | DEBUGF 1,"DNS: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1 |
436 | DEBUGF 1,"DNS: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1 |
Line 437... | Line 437... | ||
437 | popa |
437 | popa |
Line 450... | Line 450... | ||
450 | 450 | ||
451 | link_local: |
451 | link_local: |
452 | call random |
452 | call random |
453 | mov ecx,0xfea9 ; IP 169.254.0.0 link local net, see RFC3927 |
453 | mov ecx,0xfea9 ; IP 169.254.0.0 link local net, see RFC3927 |
454 | mov cx,ax |
454 | mov cx,ax |
455 | mcall 75, 3, ecx ; mask is 255.255.0.0 |
455 | mcall 76, 3, ecx ; mask is 255.255.0.0 |
456 | DEBUGF 1,"Link Local IP assinged: 169.254.%u.%u\n",[generator+2]:1,[generator+3]:1 |
456 | DEBUGF 1,"Link Local IP assinged: 169.254.%u.%u\n",[generator+2]:1,[generator+3]:1 |
457 | mcall 75, 5, 0xffff |
457 | mcall 76, 5, 0xffff |
458 | mcall 75, 9, 0x0 |
458 | mcall 76, 9, 0x0 |
Line 459... | Line 459... | ||
459 | mcall 75, 7, 0x0 |
459 | mcall 76, 7, 0x0 |
Line 460... | Line 460... | ||
460 | 460 | ||
461 | mcall 5, PROBE_WAIT*100 |
461 | mcall 5, PROBE_WAIT*100 |