Subversion Repositories Kolibri OS

Rev

Rev 3704 | Rev 3842 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                                 ;;
  3. ;; Copyright (C) KolibriOS team 2010-2013. All rights reserved.    ;;
  4. ;; Distributed under terms of the GNU General Public License       ;;
  5. ;;                                                                 ;;
  6. ;;  zeroconfig.asm - Zeroconfig service for KolibriOS              ;;
  7. ;;                                                                 ;;
  8. ;;  Written by hidnplayr@kolibrios.org                             ;;
  9. ;;    Some code contributed by Derpenguin                          ;;
  10. ;;                                                                 ;;
  11. ;;  DHCP code is based on that by Mike Hibbet                      ;;
  12. ;;      (DHCP client for menuetos)                                 ;;
  13. ;;                                                                 ;;
  14. ;;          GNU GENERAL PUBLIC LICENSE                             ;;
  15. ;;             Version 2, June 1991                                ;;
  16. ;;                                                                 ;;
  17. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  18.  
  19. format binary as ""
  20.  
  21. ; CONFIGURATION
  22.  
  23. TIMEOUT                 = 3             ; in seconds
  24. BUFFER                  = 1024          ; in bytes
  25. DHCP_TRIES              = 3             ; number of times to try contacting DHCP server
  26. __DEBUG__               = 1             ; enable/disable
  27. __DEBUG_LEVEL__         = 2             ; 1 = all, 2 = errors
  28.  
  29. ; CONFIGURATION FOR LINK-LOCAL
  30.  
  31. PROBE_WAIT              = 1             ; second  (initial random delay)
  32. PROBE_MIN               = 1             ; second  (minimum delay till repeated probe)
  33. PROBE_MAX               = 2             ; seconds (maximum delay till repeated probe)
  34. PROBE_NUM               = 3             ;         (number of probe packets)
  35.  
  36. ANNOUNCE_NUM            = 2             ;         (number of announcement packets)
  37. ANNOUNCE_INTERVAL       = 2             ; seconds (time between announcement packets)
  38. ANNOUNCE_WAIT           = 2             ; seconds (delay before announcing)
  39.  
  40. MAX_CONFLICTS           = 10            ;         (max conflicts before rate limiting)
  41.  
  42. RATE_LIMIT_INTERVAL     = 60            ; seconds (delay between successive attempts)
  43.  
  44. DEFEND_INTERVAL         = 10            ; seconds (min. wait between defensive ARPs)
  45.  
  46. use32
  47.         org     0x0
  48.  
  49.         db      'MENUET01'              ; 8 byte id
  50.         dd      0x01                    ; header version
  51.         dd      START                   ; start of code
  52.         dd      IM_END                  ; size of image
  53.         dd      (I_END+0x100)           ; memory for app
  54.         dd      (I_END+0x100)           ; esp
  55.         dd      0, 0                    ; I_Param, I_Path
  56.  
  57.  
  58. include '../../proc32.inc'
  59. include '../../macros.inc'
  60. include '../../debug-fdo.inc'
  61. include '../../network.inc'
  62. include 'dhcp.inc'
  63. include '../../dll.inc'
  64.  
  65.  
  66. Ip2dword:
  67.     push    edx
  68.  
  69.     ; This code validates if the query is an IP containing 4 numbers and 3 dots
  70.  
  71.     xor     al, al            ; make al (dot count) zero
  72.  
  73.    @@:
  74.     cmp     byte[edx],'0'     ; check if this byte is a number, if not jump to no_IP
  75.     jl      no_IP             ;
  76.     cmp     byte[edx],'9'     ;
  77.     jg      no_IP             ;
  78.  
  79.     inc     edx               ; the byte was a number, so lets check the next byte
  80.  
  81.     cmp     byte[edx],0       ; is this byte zero? (have we reached end of query?)
  82.     jz      @f                ; jump to next @@ then
  83.     cmp     byte[edx],':'
  84.     jz      @f
  85.  
  86.     cmp     byte[edx],'.'     ; is this byte a dot?
  87.     jne     @r                ; if not, jump to previous @@
  88.  
  89.     inc     al                ; the byte was a dot so increment al(dot count)
  90.     inc     edx               ; next byte
  91.     jmp     @r                ; lets check for numbers again (jump to previous @@)
  92.  
  93.    @@:                        ; we reach this when end of query reached
  94.     cmp     al,3              ; check if there where 3 dots
  95.     jnz     no_IP             ; if not, jump to no_IP
  96.  
  97.     ; The following code will convert this IP into a dword and output it in eax
  98.     ; If there is also a port number specified, this will be returned in ebx, otherwise ebx is -1
  99.  
  100.     pop     esi               ; edx (query address) was pushed onto stack and is now popped in esi
  101.  
  102.     xor     edx, edx          ; result
  103.     xor     eax, eax          ; current character
  104.     xor     ebx, ebx          ; current byte
  105.  
  106.   .outer_loop:
  107.     shl     edx, 8
  108.     add     edx, ebx
  109.     xor     ebx, ebx
  110.   .inner_loop:
  111.     lodsb
  112.     test    eax, eax
  113.     jz      .finish
  114.     cmp     al, '.'
  115.     jz      .outer_loop
  116.     sub     eax, '0'
  117.     imul    ebx, 10
  118.     add     ebx, eax
  119.     jmp     .inner_loop
  120.   .finish:
  121.     shl     edx, 8
  122.     add     edx, ebx
  123.  
  124.     bswap   edx               ; we want little endian order
  125.  
  126.     ret
  127.  
  128. no_IP:
  129.     pop     edx
  130.     xor     edx, edx
  131.  
  132.     ret
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139. START:
  140.         mcall   40, EVM_STACK2
  141.  
  142.         DEBUGF  1,">Zero-config service loaded\n"
  143.  
  144.   .wait:
  145.         mov     ebx, API_ETH + 0
  146.         mov     bh, [device]
  147.         mcall   76                              ; get MAC of ethernet interface 1
  148.         cmp     eax, -1
  149.         jne     .start
  150.  
  151.         mcall   10
  152.         jmp     .wait
  153.  
  154.   .start:
  155.         mov     word[MAC], bx
  156.         mov     dword[MAC+2], eax
  157.         DEBUGF  1,"->MAC: %x-%x-%x-%x-%x-%x\n", [MAC+0]:2, [MAC+1]:2, [MAC+2]:2, [MAC+3]:2, [MAC+4]:2, [MAC+5]:2
  158.  
  159.         mcall   40, EVM_STACK
  160.  
  161.         mcall   68, 11
  162.  
  163.         stdcall dll.Load,@IMPORT
  164.         or      eax, eax
  165.         jnz     try_dhcp
  166.  
  167.         invoke  ini.get_str, path, str_ipconfig, str_type, inibuf, 16, 0
  168.  
  169.         cmp     dword[inibuf], 'stat'
  170.         jne     try_dhcp
  171.  
  172.         invoke  ini.get_str, path, str_ipconfig, str_ip, inibuf, 16, 0
  173.         mov     edx, inibuf
  174.         call    Ip2dword
  175.         mcall   76, API_IPv4 + 3, edx
  176.  
  177.         invoke  ini.get_str, path, str_ipconfig, str_gateway, inibuf, 16, 0
  178.         mov     edx, inibuf
  179.         call    Ip2dword
  180.         mcall   76, API_IPv4 + 9, edx
  181.  
  182.         invoke  ini.get_str, path, str_ipconfig, str_dns, inibuf, 16, 0
  183.         mov     edx, inibuf
  184.         call    Ip2dword
  185.         mcall   76, API_IPv4 + 5, edx
  186.  
  187.         invoke  ini.get_str, path, str_ipconfig, str_subnet, inibuf, 16, 0
  188.         mov     edx, inibuf
  189.         call    Ip2dword
  190.         mcall   76, API_IPv4 + 7, edx
  191.  
  192.  
  193.         mcall   -1
  194.  
  195.  
  196. try_dhcp:
  197.  
  198.         DEBUGF  1,"->Trying DHCP\n"
  199.  
  200.         mcall   75, 0, AF_INET4, SOCK_DGRAM, 0          ; open socket (parameters: domain, type, reserved)
  201.         cmp     eax, -1
  202.         je      error
  203.         mov     [socketNum], eax
  204.  
  205.         DEBUGF  1,"->Socket %x opened\n", eax
  206.  
  207.         mcall   75, 2, [socketNum], sockaddr1, 18       ; bind socket to local port 68
  208.         cmp     eax, -1
  209.         je      error
  210.  
  211.         DEBUGF  1,"->Socket Bound to local port 68\n"
  212.  
  213.         mcall   75, 4, [socketNum], sockaddr2, 18       ; connect to 255.255.255.255 on port 67
  214.         cmp     eax, -1
  215.         je      error
  216.  
  217.         DEBUGF  1,"->Connected to 255.255.255.255 on port 67\n"
  218.  
  219.         mov     [dhcpMsgType], 0x01                     ; DHCP discover
  220.         mov     [dhcpLease], esi                        ; esi is still -1 (-1 = forever)
  221.  
  222.         mcall   26, 9                                   ; Get system time
  223.         imul    eax, 100
  224.         mov     [currTime], eax
  225.  
  226. build_request:                                          ; Creates a DHCP request packet.
  227.  
  228.         mov     [tries], DHCP_TRIES
  229.  
  230.         DEBUGF  1,"->Building request\n"
  231.  
  232.         stdcall mem.Alloc, BUFFER
  233.         mov     [dhcpMsg], eax
  234.         test    eax, eax
  235.         jz      dhcp_error
  236.  
  237.             ;;; todo: skip this bullcrap
  238.  
  239.         mov     edi, eax
  240.         mov     ecx, BUFFER
  241.         xor     eax, eax
  242.         rep     stosb
  243.  
  244.             ;; todo: put this in a buffer instead of writing bytes and words!
  245.  
  246.         mov     edx, [dhcpMsg]
  247.  
  248.         ; Boot protocol legacy
  249.         mov     [edx], byte 0x01                ; Boot request
  250.         mov     [edx+1], byte 0x01              ; Ethernet
  251.         mov     [edx+2], byte 0x06              ; Ethernet h/w len
  252.         mov     [edx+4], dword 0x11223344       ; xid                 ;;;;;;;
  253.         mov     eax, [currTime]
  254.         mov     [edx+8], eax                    ; secs, our uptime
  255.         mov     [edx+10], byte 0x80             ; broadcast flag set
  256.         mov     eax, dword [MAC]                ; first 4 bytes of MAC
  257.         mov     [edx+28],dword eax
  258.         mov     ax, word [MAC+4]                ; last 2 bytes of MAC
  259.         mov     [edx+32],word ax
  260.  
  261.         ; DHCP extension
  262.         mov     [edx+236], dword 0x63538263     ; magic cookie
  263.         mov     [edx+240], word 0x0135          ; option DHCP msg type
  264.         mov     al, [dhcpMsgType]
  265.         mov     [edx+240+2], al
  266.         mov     [edx+240+3], word 0x0433        ; option Lease time = infinity
  267.         mov     eax, [dhcpLease]
  268.         mov     [edx+240+5], eax
  269.         mov     [edx+240+9], word 0x0432        ; option requested IP address
  270.         mov     eax, [dhcp.ip]
  271.         mov     [edx+240+11], eax
  272.         mov     [edx+240+15], word 0x0437       ; option request list
  273.         mov     [edx+240+17], dword 0x0f060301
  274.  
  275.         cmp     [dhcpMsgType], 0x01             ; Check which msg we are sending
  276.         jne     request_options
  277.  
  278.         mov     [edx+240+21], byte 0xff         ; end of options marker
  279.  
  280.         mov     [dhcpMsgLen], 262               ; length
  281.         jmp     send_dhcpmsg
  282.  
  283. request_options:
  284.         mov     [edx+240+21], word 0x0436       ; server IP
  285.         mov     eax, [dhcpServerIP]
  286.         mov     [edx+240+23], eax
  287.  
  288.         mov     [edx+240+27], byte 0xff         ; end of options marker
  289.  
  290.         mov     [dhcpMsgLen], 268               ; length
  291.  
  292. send_dhcpmsg:
  293.         DEBUGF  1,"Sending DHCP discover/request\n"
  294.         mcall   75, 6, [socketNum], [dhcpMsg], [dhcpMsgLen]     ; write to socket ( send broadcast request )
  295.   .wait:
  296.         mcall   23, TIMEOUT*100                                 ; wait for data
  297.  
  298. read_data:                                                      ; we have data - this will be the response
  299.         mcall   75, 7, [socketNum], [dhcpMsg], BUFFER, MSG_DONTWAIT     ; read data from socket
  300.         cmp     eax, -1
  301.         jne     @f
  302.         cmp     ebx, 6  ; EWOULDBLOCK
  303.         je      send_dhcpmsg.wait
  304.         DEBUGF  1,"No answer from DHCP server\n"
  305.         dec     [tries]
  306.         jnz     send_dhcpmsg                    ; try again
  307.         jmp     dhcp_error                      ; fail
  308.  
  309.   @@:
  310.         DEBUGF  1,"->%d bytes received\n", eax
  311.         mov     [dhcpMsgLen], eax
  312.  
  313. ; depending on which msg we sent, handle the response
  314. ; accordingly.
  315. ; If the response is to a dhcp discover, then:
  316. ;  1) If response is DHCP OFFER then
  317. ;  1.1) record server IP, lease time & IP address.
  318. ;  1.2) send a request packet
  319. ; If the response is to a dhcp request, then:
  320. ;  1) If the response is DHCP ACK then
  321. ;  1.1) extract the DNS & subnet fields. Set them in the stack
  322.  
  323.         cmp     [dhcpMsgType], 0x01             ; did we send a discover?
  324.         je      discover
  325.  
  326.         cmp     [dhcpMsgType], 0x03             ; did we send a request?
  327.         je      request
  328.  
  329.         call    dhcp_end                        ; we should never reach here ;)
  330.         jmp     exit
  331.  
  332. discover:
  333.         call    parse_response
  334.  
  335.         cmp     [dhcpMsgType2], 0x02            ; Was the response an offer?
  336.         je      send_request
  337.  
  338.         call    dhcp_end
  339.         jmp     link_local
  340.  
  341. send_request:
  342.         DEBUGF  1, "Got offer, making request\n"
  343.         mov     [dhcpMsgType], 0x03             ; make it a request
  344.         jmp     build_request
  345.  
  346. request:
  347.         call    parse_response
  348.  
  349.         cmp     [dhcpMsgType2], 0x05            ; Was the response an ACK? It should be
  350.         jne     read_data                       ; NO - read next packets
  351.  
  352.         DEBUGF  2, "Setting IP using DHCP\n"
  353.  
  354.         call    dhcp_end
  355.  
  356.         mov     ebx, API_IPv4 + 3
  357.         mov     bh, [device]
  358.         mcall   76, , [dhcp.ip]                 ; ip
  359.         mov     bl, 5
  360.         mcall   76, , [dhcp.dns]                ; dns
  361.         mov     bl, 7
  362.         mcall   76, , [dhcp.subnet]             ; subnet
  363.         mov     bl, 9
  364.         mcall   76, , [dhcp.gateway]            ; gateway
  365.  
  366.         jmp     exit
  367.  
  368. dhcp_end:
  369.         mcall   close, [socketNum]
  370.         stdcall mem.Free, [dhcpMsg]
  371.  
  372.         ret
  373.  
  374. ;***************************************************************************
  375. ;   Function
  376. ;      parseResponse
  377. ;
  378. ;   Description
  379. ;      extracts the fields ( client IP address and options ) from
  380. ;      a DHCP response
  381. ;      The values go into
  382. ;       dhcpMsgType,dhcpLease,dhcpClientIP,dhcpServerIP,
  383. ;       dhcpDNSIP, dhcpSubnet
  384. ;      The message is stored in dhcpMsg
  385. ;
  386. ;***************************************************************************
  387. parse_response:
  388.  
  389.         DEBUGF  1,"Data received, parsing response\n"
  390.         mov     edx, [dhcpMsg]
  391.         mov     [dhcpMsgType2], 0
  392.  
  393.         push    dword [edx+16]
  394.         pop     [dhcp.ip]
  395.         DEBUGF  1,"Client: %u.%u.%u.%u\n", [edx+16]:1, [edx+17]:1, [edx+18]:1, [edx+19]:1
  396.  
  397. ; TODO: check if there really are options
  398.  
  399.         mov     al, 240                         ; Point to first option
  400.         movzx   ecx, al
  401.  
  402.   .next_option:
  403.         add     edx, ecx
  404.  
  405.         mov     al, [edx]                       ; get message identifier
  406.  
  407.         cmp     al, 0xff                        ; End of options?
  408.         je      .done
  409.  
  410.         cmp     al, 0
  411.         je      .pad
  412.  
  413. ; TODO: check if we still are inside the buffer
  414.  
  415.         inc     edx
  416.         movzx   ecx, byte [edx]                 ; get data length
  417.         inc     edx                             ; point to data
  418.  
  419.         cmp     al, dhcp_msg_type               ; Msg type is a single byte option
  420.         je      .msgtype
  421.  
  422.         cmp     al, dhcp_dhcp_server_id
  423.         je      .server
  424.  
  425.         cmp     al, dhcp_address_time
  426.         je      .lease
  427.  
  428.         cmp     al, dhcp_subnet_mask
  429.         je      .subnet
  430.  
  431.         cmp     al, dhcp_router
  432.         je      .router
  433.  
  434.         cmp     al, dhcp_domain_server
  435.         je      .dns
  436.  
  437.         DEBUGF  1,"Unsupported DHCP option: %u\n", al
  438.  
  439.         jmp     .next_option
  440.  
  441.   .pad:
  442.         xor     ecx, ecx
  443.         inc     ecx
  444.         jmp     .next_option
  445.  
  446.   .msgtype:
  447.         mov     al, [edx]
  448.         mov     [dhcpMsgType2], al
  449.  
  450.         DEBUGF  1,"DHCP Msg type: %u\n", al
  451.         jmp     .next_option                    ; Get next option
  452.  
  453.   .server:
  454.         mov     eax, [edx]
  455.         mov     [dhcpServerIP], eax
  456.         DEBUGF  1,"Server: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1
  457.         jmp     .next_option
  458.  
  459.   .lease:
  460.         pusha
  461.         mov     eax,[edx]
  462.         bswap   eax
  463.         mov     [dhcpLease],eax
  464.         DEBUGF  1,"lease: %d\n",eax
  465.         popa
  466.         jmp     .next_option
  467.  
  468.   .subnet:
  469.         push    dword [edx]
  470.         pop     [dhcp.subnet]
  471.         DEBUGF  1,"Subnet: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1
  472.         jmp     .next_option
  473.  
  474.   .router:
  475.         push    dword [edx]
  476.         pop     [dhcp.gateway]
  477.         DEBUGF  1,"Gateway: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1
  478.         jmp     .next_option
  479.  
  480.   .dns:
  481.         push    dword [edx]
  482.         pop     [dhcp.dns]
  483.         DEBUGF  1,"DNS: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1
  484.         jmp     .next_option
  485.  
  486.   .done:
  487.         ret
  488.  
  489.  
  490.  
  491. dhcp_error:
  492.         call    dhcp_end
  493.  
  494. link_local:
  495.         call    random
  496.         mov     cx, ax
  497.         shl     ecx, 16
  498.         mov     cx, 0xfea9                              ; IP 169.254.0.0 link local net, see RFC3927
  499.         mov     ebx, API_IPv4 + 3
  500.         mov     bh, [device]
  501.         mcall   76, , ecx                   ; mask is 255.255.0.0
  502.         DEBUGF  2,"Link Local IP assigned: 169.254.%u.%u\n", [generator+0]:1, [generator+1]:1
  503.         mov     bl, 7
  504.         mcall   76, , 0xffff
  505.         mov     bl, 9
  506.         mcall   76, , 0x0
  507.         mov     bl, 5
  508.         mcall   76, , 0x0
  509.  
  510.         mcall   5, PROBE_WAIT*100
  511.  
  512.         xor     esi, esi
  513.    probe_loop:
  514.         call    random                                  ; create a pseudo random number in eax (seeded by MAC)
  515.  
  516.         cmp     al, PROBE_MIN*100                       ; check if al is bigger then PROBE_MIN
  517.         jae     @f                                      ; all ok
  518.         add     al, (PROBE_MAX-PROBE_MIN)*100           ; al is too small
  519.    @@:
  520.  
  521.         cmp     al, PROBE_MAX*100
  522.         jbe     @f
  523.         sub     al, (PROBE_MAX-PROBE_MIN)*100
  524.    @@:
  525.  
  526.         movzx   ebx,al
  527.         DEBUGF  1,"Waiting %u0ms\n",ebx
  528.         mcall   5
  529.  
  530.         DEBUGF  1,"Sending Probe\n"
  531.         mov     ebx, API_ARP + 6
  532.         mov     bh, [device]
  533.         mcall   76
  534.         inc     esi
  535.  
  536.         cmp     esi, PROBE_NUM
  537.         jb      probe_loop
  538.  
  539. ; now we wait further ANNOUNCE_WAIT seconds and send ANNOUNCE_NUM ARP announces. If any other host has assingned
  540. ; IP within this time, we should create another adress, that have to be done later
  541.  
  542.         DEBUGF  1,"Waiting %us\n", ANNOUNCE_WAIT
  543.         mcall   5, ANNOUNCE_WAIT*100
  544.         xor   esi, esi
  545.    announce_loop:
  546.  
  547.         DEBUGF  1,"Sending Announce\n"
  548.         mov     ebx, API_ARP + 6
  549.         mov     bh, [device]
  550.         mcall   76
  551.  
  552.         inc     esi
  553.         cmp     esi,ANNOUNCE_NUM
  554.         je      @f
  555.  
  556.         DEBUGF  1,"Waiting %us\n", ANNOUNCE_INTERVAL
  557.         mcall   5, ANNOUNCE_INTERVAL*100
  558.         jmp     announce_loop
  559.    @@:
  560.  
  561.  
  562. error:
  563.         DEBUGF  2,"Socket error\n"
  564. exit:   ; we should, instead of closing, detect ARP conflicts and detect if cable keeps connected ;)
  565.         DEBUGF  2,"Exiting\n"
  566.         mcall   -1
  567.  
  568.  
  569. random:  ; Pseudo random actually
  570.  
  571.         mov     eax, [generator]
  572.         add     eax, -43ab45b5h
  573.         ror     eax, 1
  574.         bswap   eax
  575.         xor     eax, dword[MAC]
  576.         ror     eax, 1
  577.         xor     eax, dword[MAC+2]
  578.         mov     [generator], eax
  579.  
  580.         ret
  581.  
  582. ; DATA AREA
  583.  
  584. align 16
  585. @IMPORT:
  586.  
  587. library \
  588.         libini,'libini.obj'
  589.  
  590. import  libini, \
  591.         ini.get_str,'ini_get_str'
  592.  
  593. include_debug_strings
  594.  
  595. str_ip          db 'ip', 0
  596. str_subnet      db 'subnet', 0
  597. str_gateway     db 'gateway', 0
  598. str_dns         db 'dns', 0
  599. str_ipconfig    db 'ipconfig', 0
  600. str_type        db 'type', 0
  601.  
  602.  
  603. sockaddr1:
  604.  
  605.         dw AF_INET4
  606.         dw 68 shl 8     ; local port
  607.         dd 0            ; local IP
  608.  
  609.         rb 10
  610.  
  611.  
  612. sockaddr2:
  613.  
  614.         dw AF_INET4
  615.         dw 67 shl 8     ; destination port
  616.         dd -1           ; destination IP
  617.  
  618.         rb 10
  619.  
  620. path            db  '/sys/network.ini'
  621.  
  622. IM_END:
  623.  
  624. device          db 1
  625. inibuf          rb 16
  626. tries           db ?
  627.  
  628. dhcpMsgType     db ?    ; sent
  629. dhcpMsgType2    db ?    ; received
  630. dhcpLease       dd ?
  631. dhcpServerIP    dd ?
  632.  
  633. dhcp:
  634. .ip             dd ?
  635. .subnet         dd ?
  636. .dns            dd ?
  637. .gateway        dd ?
  638.  
  639.  
  640. dhcpMsgLen      dd ?
  641. socketNum       dd ?
  642.  
  643. MAC             dp ?
  644.  
  645. currTime        dd ?
  646. generator       dd ?
  647.  
  648. dhcpMsg         dd ?
  649.  
  650. I_END: