Changeset 2491 for trunk/packages/invirt-dhcp/invirt-dhcpserver
- Timestamp:
- Sep 28, 2009, 10:53:22 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.