From b9fc9b3c19081028eec981a321dc33113c8b0ece Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 9 Mar 2020 15:14:05 -0400 Subject: [PATCH] Put the recvmsg info into the handler payload This allows the rest of the discovery infrastructure to operate with this data. --- confluent_server/confluent/discovery/protocols/pxe.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/discovery/protocols/pxe.py b/confluent_server/confluent/discovery/protocols/pxe.py index 44bee8b2..f69e16dd 100644 --- a/confluent_server/confluent/discovery/protocols/pxe.py +++ b/confluent_server/confluent/discovery/protocols/pxe.py @@ -217,7 +217,8 @@ def snoop(handler, protocol=None): # with try/except if i < 64: continue - peer = ipfromint(clientaddr.sin_addr.s_addr) + #peer = ipfromint(clientaddr.sin_addr.s_addr) + # We don't need peer yet, generally it's 0.0.0.0 _, level, typ = struct.unpack('QII', cmsgarr[:16]) if level == socket.IPPROTO_IP and typ == IP_PKTINFO: idx, recv, targ = struct.unpack('III', cmsgarr[16:28]) @@ -251,6 +252,7 @@ def snoop(handler, protocol=None): handler({'hwaddr': netaddr, 'uuid': uuid, 'architecture': vivso.get('arch', ''), 'services': (vivso['service-type'],), + 'netinfo': {'ifidx': idx, 'recvip': recv}, 'attributes': {'enclosure-machinetype-model': [vivso.get('machine', '')]}}) continue if uuid is None: @@ -259,6 +261,7 @@ def snoop(handler, protocol=None): # but the nature of the beast is that we do not have peers, # so that will not be present for a pxe snoop handler({'hwaddr': netaddr, 'uuid': uuid, 'architecture': arch, + 'netinfo': {'ifidx': idx, 'recvip': recv}, 'services': ('pxe-client',)}) if __name__ == '__main__':