Changeset 2491 for trunk/packages
- Timestamp:
- Sep 28, 2009, 10:53:22 PM (15 years ago)
- Location:
- trunk/packages/invirt-dhcp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/invirt-dhcp/debian/changelog
r2362 r2491 1 invirt-dhcp (0.0.3) unstable; urgency=low 2 3 * Detect local IP address and pass it as the DHCP server-identifier 4 option, as required by several DHCP clients. 5 * Reuse the existing DHCP socket for replies by binding it to the 6 client VM interface and then restoring its global binding after 7 sendto(); this keeps replies coming from port 67, as is standard. 8 9 -- Joshua Oreman <oremanj@mit.edu> Mon, 28 Sep 2009 22:46:41 -0400 10 1 11 invirt-dhcp (0.0.2) unstable; urgency=low 2 12 -
trunk/packages/invirt-dhcp/invirt-dhcpserver
r2362 r2491 163 163 intf = self.backend.find_interface(packet) 164 164 if intf: 165 out_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 166 out_socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST,1) 167 out_socket.setsockopt(socket.SOL_SOCKET, IN.SO_BINDTODEVICE, intf) 168 #out_socket.bind((ip, self.listen_port)) 169 ret = out_socket.sendto(packet.EncodePacket(), (To,self.emit_port)) 170 out_socket.close() 165 self.dhcp_socket.setsockopt(socket.SOL_SOCKET, IN.SO_BINDTODEVICE, intf) 166 ret = self.dhcp_socket.sendto(packet.EncodePacket(), (To,self.emit_port)) 167 self.dhcp_socket.setsockopt(socket.SOL_SOCKET, IN.SO_BINDTODEVICE, '') 171 168 return ret 172 169 else: … … 258 255 "client_listen_port":68, 259 256 "listen_address":"0.0.0.0"} 257 258 myip = socket.gethostbyname(socket.gethostname()) 259 if not myip: 260 print "invirt-dhcpserver: cannot determine local IP address by looking up %s" % socket.gethostname() 261 sys.exit(1) 262 263 dhcp_options['server_identifier'] = myip 264 260 265 backend = DhcpBackend() 261 266 server = DhcpServer(backend, options)
Note: See TracChangeset
for help on using the changeset viewer.