mirror of
https://github.com/eblot/pybootd.git
synced 2024-09-11 22:17:44 +03:00
Fix socket's bindtodevice
for Linux hosts
This commit is contained in:
parent
b96e352c34
commit
45f79fc53f
@ -335,9 +335,9 @@ class BootpServer:
|
|||||||
raise BootpError('Unable to retrieve binding interface')
|
raise BootpError('Unable to retrieve binding interface')
|
||||||
if platform == 'linux':
|
if platform == 'linux':
|
||||||
from socket import SO_BINDTODEVICE
|
from socket import SO_BINDTODEVICE
|
||||||
sock.setsockopt(socket, SOL_SOCKET, SO_BINDTODEVICE, iface)
|
sock.setsockopt(SOL_SOCKET, SO_BINDTODEVICE, iface.encode())
|
||||||
elif platform == 'darwin':
|
elif platform == 'darwin':
|
||||||
IP_BOUND_IF = 25
|
IP_BOUND_IF = 25 # unfortunately not mapped to Python
|
||||||
sock.setsockopt(IPPROTO_IP, IP_BOUND_IF, if_nametoindex(iface))
|
sock.setsockopt(IPPROTO_IP, IP_BOUND_IF, if_nametoindex(iface))
|
||||||
else:
|
else:
|
||||||
raise BootpError('Bind to interface not supported on %s' %
|
raise BootpError('Bind to interface not supported on %s' %
|
||||||
|
Loading…
Reference in New Issue
Block a user