Index: trunk/packages/invirt-dhcp/debian/changelog
===================================================================
--- trunk/packages/invirt-dhcp/debian/changelog	(revision 2487)
+++ trunk/packages/invirt-dhcp/debian/changelog	(revision 2491)
@@ -1,2 +1,12 @@
+invirt-dhcp (0.0.3) unstable; urgency=low
+
+  * Detect local IP address and pass it as the DHCP server-identifier
+    option, as required by several DHCP clients.
+  * Reuse the existing DHCP socket for replies by binding it to the
+    client VM interface and then restoring its global binding after
+    sendto(); this keeps replies coming from port 67, as is standard.
+
+ -- Joshua Oreman <oremanj@mit.edu>  Mon, 28 Sep 2009 22:46:41 -0400
+
 invirt-dhcp (0.0.2) unstable; urgency=low
 
Index: trunk/packages/invirt-dhcp/invirt-dhcpserver
===================================================================
--- trunk/packages/invirt-dhcp/invirt-dhcpserver	(revision 2487)
+++ trunk/packages/invirt-dhcp/invirt-dhcpserver	(revision 2491)
@@ -163,10 +163,7 @@
         intf = self.backend.find_interface(packet)
         if intf:
-            out_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
-            out_socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST,1)
-            out_socket.setsockopt(socket.SOL_SOCKET, IN.SO_BINDTODEVICE, intf)
-            #out_socket.bind((ip, self.listen_port))
-            ret = out_socket.sendto(packet.EncodePacket(), (To,self.emit_port))
-            out_socket.close()
+            self.dhcp_socket.setsockopt(socket.SOL_SOCKET, IN.SO_BINDTODEVICE, intf)
+            ret = self.dhcp_socket.sendto(packet.EncodePacket(), (To,self.emit_port))
+            self.dhcp_socket.setsockopt(socket.SOL_SOCKET, IN.SO_BINDTODEVICE, '')
             return ret
         else:
@@ -258,4 +255,12 @@
                 "client_listen_port":68,
                 "listen_address":"0.0.0.0"}
+
+    myip = socket.gethostbyname(socket.gethostname())
+    if not myip:
+        print "invirt-dhcpserver: cannot determine local IP address by looking up %s" % socket.gethostname()
+        sys.exit(1)
+    
+    dhcp_options['server_identifier'] = myip
+
     backend = DhcpBackend()
     server = DhcpServer(backend, options)
