anchor.diff:  	 (packet (build-dhcp-packet :mac-address (mezzano.network.ethernet:ethernet-mac iface) :options options :siaddr siaddr)))
       (send-broadcast-dhcp-packet packet iface)))
   
  -(defun receive-broadcast-dhcp-packet ()
  +(defun get-option (alist option)
  +  (cdr (find option alist :key #'car)))
  +
  +(defun acquire-lease ()
     (let ((connection (make-instance 'mezzano.network.udp::udp4-connection
   				   :remote-address +ipv4-broadcast-source+ ;;not necessary, just to avoid the stack down choking
   				   :remote-port +dhcp-server-port+
   				   :local-address +ipv4-broadcast-local-network+
  -				   :local-port +dhcp-client-port+))
  -	packet)
  +				   :local-port +dhcp-client-port+)))
       (mezzano.supervisor:with-mutex (mezzano.network.udp::*udp-connection-lock*)
         (push connection mezzano.network.udp::*udp-connections*))
  -    (unwind-protect (setf packet (sys.net:receive connection 4))
  -      (sys.net:disconnect connection))
  -    packet))
  -
  -(defun acquire-lease ()
  -  (dhcp-send (list (make-dhcp-option 53 :size 1 :value 1)
  -		   (make-dhcp-option 55 :size 5 :value #(1 4 3 15 6))))
  -  (let* ((offer (receive-broadcast-dhcp-packet))
  -	 (siaddr (ub32ref/be offer 20))
  -	 (yiaddr (ub32ref/be offer 16))
  -	 (oaddr (make-array 4 :element-type '(unsigned-byte 8)))
  -	 (options (decode-all-options offer)))
  -    (setf (ub32ref/be oaddr 0) yiaddr)
  -    (if (zerop yiaddr)
  -	nil
  -	(dhcp-send (list (make-dhcp-option 53 :size 1 :value 3)
  -			 (make-dhcp-option 50 :size 4 :value oaddr)
  -			 (make-dhcp-option 54 :size 4 :value dhcpserver))
  -		   :siaddr siaddr))))
  +    (dhcp-send (list (make-dhcp-option 53 :size 1 :value 1)
  +		     (make-dhcp-option 55 :size 5 :value #(1 4 3 15 6))))
  +    (unwind-protect
  +	 (let* ((offer (sys.net:receive connection 4))
  +		(siaddr (ub32ref/be offer 20))
  +		(yiaddr (ub32ref/be offer 16))
  +		(oaddr (make-array 4 :element-type '(unsigned-byte 8)))
  +		(options (decode-all-options offer))
  +		(dhcpserver (get-option options +opt-dhcp-server+)))
  +	   (setf (ub32ref/be oaddr 0) yiaddr)
  +	   (if (zerop yiaddr)
  +	       nil
  +	       (progn
  +		 (dhcp-send (list (make-dhcp-option +opt-dhcp-message-type+ +dhcp-request+)
  +				  (make-dhcp-option +opt-ip-address+ oaddr)
  +				  (make-dhcp-option +opt-dhcp-server+ dhcpserver))
  +			    :siaddr siaddr)
  +		 (let* ((ack (sys.net:receive connection 4))
  +			(ack-options (decode-all-options ack))
  +			(confirmation (get-option ack-options +opt-dhcp-message-type+)))
  +		   (if (= confirmation +dhcp-ack+)
  +		       (values yiaddr (get-option options +opt-netmask+) (get-option options +opt-router+)
  +			       (get-option options +opt-dns-servers+) (get-option options +opt-dhcp-server+)
  +			       (get-option options +opt-ntp-server+))
  +		       nil)))))
  +      (sys.net:disconnect connection))))
  
positive.code: 	      (+ position 2 (aref buffer (1+ position))))))
  
  (defun decode-all-options (buffer)
    ())
  
  (defun make-dhcp-option (type &key (size 0) value)
    (if (zerop type)
        (make-array 1 :element-type '(unsigned-byte 8) :initial-element 0)
        (let ((option (make-array (+ 2 size) :element-type '(unsigned-byte 8) :initial-element 0)))
  	(setf (aref option 0) type
  	      (aref option 1) size)
  	(if (= 1 size)
  	    (setf (aref option 2) value) ;assume scalar
  	    (setf (subseq option 2) value))
  	option)))
  
  (defun send-broadcast-dhcp-packet (sequence interface)
    (let* ((header (make-array 8 :element-type '(unsigned-byte 8)))
  
negative.code: (defconstant +ipv4-broadcast-local-network+ (mezzano.network.ip:make-ipv4-address #xffffffff))
  (defconstant +dhcp-client-port+ 68)
  (defconstant +dhcp-server-port+ 67)
  
  (defconstant +dhcp-discover+ 1)
  (defconstant +dhcp-offer+ 2)
  (defconstant +dhcp-request+ 3)
  (defconstant +dhcp-ack+ 5)
  (defconstant +dhcp-nak+ 6)
  
  (defconstant +opt-dhcp-server+ 54)
  (defconstant +opt-ntp-server+ 4)
  (defconstant +opt-netmask+ 1)
  (defconstant +opt-router+ 3)
  (defconstant +opt-dns-servers+ 6)
  (defconstant +opt-lease-time+ 51)
  (defconstant +opt-ip-address+ 50)
  (defconstant +opt-dhcp-message-type+ 53)
  (defconstant +opt-tftp-server+ 66)
  (defconstant +opt-parameter-request-list+ 55)
  (defconstant +opt-host-name+ 12)
  (defconstant +opt-end+ 255)
  
  (defun build-dhcp-packet (&key mac-address options (siaddr 0))
    (assert (typep mac-address '(simple-array (unsigned-byte 8) (6))))
  