From 86ed339b48e32e0c48c41e7a63e9d1a06cddc3b8 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 9 Jun 2017 12:24:35 -0400 Subject: [PATCH] Add localonly mode to SLP Sometimes in a likely mismatched IP situation, some SLP things will manage to reply and slow down. For now in the case of mismatched IPv4 being likely, provide a mode fixated on link local. --- confluent_server/confluent/discovery/protocols/slp.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/discovery/protocols/slp.py b/confluent_server/confluent/discovery/protocols/slp.py index c037a815..65111011 100644 --- a/confluent_server/confluent/discovery/protocols/slp.py +++ b/confluent_server/confluent/discovery/protocols/slp.py @@ -28,6 +28,8 @@ _slp_services = set([ 'service:management-hardware.IBM:integrated-management-module2', 'service:lenovo-smm', 'service:management-hardware.Lenovo:lenovo-xclarity-controller', + 'service:management-hardware.IBM:chassis-management-module', + 'service:management-hardware.Lenovo:chassis-management-module', ]) # SLP has a lot of ambition that was unfulfilled in practice. @@ -468,7 +470,7 @@ def active_scan(handler): handler(scanned) -def scan(srvtypes=_slp_services, addresses=None): +def scan(srvtypes=_slp_services, addresses=None, localonly=False): """Find targets providing matching requested srvtypes This is a generator that will iterate over respondants to the SrvType @@ -508,6 +510,12 @@ def scan(srvtypes=_slp_services, addresses=None): _grab_rsps((net, net4), rsps, 1, xidmap) # now to analyze and flesh out the responses for id in rsps: + if localonly: + for addr in rsps[id]['addresses']: + if 'fe80' in addr[0]: + break + else: + continue _add_attributes(rsps[id]) del rsps[id]['payload'] del rsps[id]['function']