From 97401e306b1b53216bba96a889dd4654b012814d Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 22 Jan 2018 11:53:19 -0500 Subject: [PATCH] Tolerate disabled IPv4 multicast route Sometimes the IPv4 multicast route isn't playing ball. Tolerate such a scenario and move on. --- confluent_server/confluent/discovery/protocols/slp.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/discovery/protocols/slp.py b/confluent_server/confluent/discovery/protocols/slp.py index 6cd9b5b7..53bbf4f2 100644 --- a/confluent_server/confluent/discovery/protocols/slp.py +++ b/confluent_server/confluent/discovery/protocols/slp.py @@ -222,7 +222,13 @@ def _find_srvtype(net, net4, srvtype, addresses, xid): bcast = i4['broadcast'] net4.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, socket.inet_aton(addr)) - net4.sendto(data, ('239.255.255.253', 427)) + try: + net4.sendto(data, ('239.255.255.253', 427)) + except socket.error as se: + # On occasion, multicasting may be disabled + # tolerate this scenario and move on + if se.errno != 101: + raise net4.sendto(data, (bcast, 427))