Fix usage of IP_MULTICAST_LOOP; from fgsch@

This commit is contained in:
ajacoutot 2013-01-26 19:38:00 +00:00
parent f145c63647
commit 76f4a30501
3 changed files with 14 additions and 22 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.66 2013/01/26 14:50:17 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.67 2013/01/26 19:38:00 ajacoutot Exp $
SHARED_ONLY= Yes
@ -17,7 +17,7 @@ PKGNAME-hpcups= hpcups-${V}
PKGNAME-libs= hplip-libs-${V}
PKGNAME-gui= hplip-gui-${V}
REVISION-main= 5
REVISION-main= 6
REVISION-libs= 0
REVISION-gui= 2
REVISION-hpcups=1

View File

@ -1,10 +1,10 @@
$OpenBSD: patch-base_mdns_py,v 1.3 2013/01/26 12:25:54 ajacoutot Exp $
$OpenBSD: patch-base_mdns_py,v 1.4 2013/01/26 19:38:00 ajacoutot Exp $
XXX Unable to setup multicast socket... [Errno 22] Invalid argument
--- base/mdns.py.orig Tue Nov 20 10:55:15 2012
+++ base/mdns.py Sat Jan 26 10:17:55 2013
@@ -211,12 +211,12 @@ def detectNetworkDevices(ttl=4, timeout=10):
+++ base/mdns.py Sat Jan 26 19:13:23 2013
@@ -211,9 +211,9 @@ def detectNetworkDevices(ttl=4, timeout=10):
pass
try:
@ -12,12 +12,8 @@ XXX Unable to setup multicast socket... [Errno 22] Invalid argument
- s.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_IF, socket.inet_aton(intf) + socket.inet_aton('0.0.0.0'))
- s.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_LOOP ,1)
+ s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, ttl)
+ s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, socket.inet_aton(intf) + socket.inet_aton('0.0.0.0'))
+ s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_LOOP ,1)
+ s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, socket.inet_aton(intf))
+ s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_LOOP, struct.pack('B', 1))
except Exception, e:
log.error("Unable to setup multicast socket for mDNS: %s" % e)
- return {}
+ pass
now = time.time()
next = now
return {}

View File

@ -1,10 +1,10 @@
$OpenBSD: patch-base_slp_py,v 1.3 2013/01/26 14:50:17 ajacoutot Exp $
$OpenBSD: patch-base_slp_py,v 1.4 2013/01/26 19:38:00 ajacoutot Exp $
XXX Unable to setup multicast socket... [Errno 22] Invalid argument
--- base/slp.py.orig Tue Nov 20 10:55:15 2012
+++ base/slp.py Sat Jan 26 15:04:25 2013
@@ -69,12 +69,12 @@ def detectNetworkDevices(ttl=4, timeout=10): #, xid=No
+++ base/slp.py Sat Jan 26 19:13:18 2013
@@ -69,9 +69,9 @@ def detectNetworkDevices(ttl=4, timeout=10): #, xid=No
pass
try:
@ -12,12 +12,8 @@ XXX Unable to setup multicast socket... [Errno 22] Invalid argument
- s.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_IF, socket.inet_aton(intf) + socket.inet_aton('0.0.0.0'))
- s.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_LOOP ,1)
+ s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, ttl)
+ s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, socket.inet_aton(intf) + socket.inet_aton('0.0.0.0'))
+ s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_LOOP ,1)
+ s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, socket.inet_aton(intf))
+ s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_LOOP, struct.pack('B', 1))
except Exception, e:
log.error("Unable to setup multicast socket for SLP: %s" % e)
- return {}
+ pass
packet = ''.join(['\x01\x06\x00\x2c\x00\x00\x65\x6e\x00\x03',
struct.pack('!H', random.randint(1, 65535)), '\x00\x00\x00\x18service:x-hpnp-discover:\x00\x00\x00\x00'])
return {}