2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-01-02 22:22:30 +00:00

Put the recvmsg info into the handler payload

This allows the rest of the discovery infrastructure to operate
with this data.
This commit is contained in:
Jarrod Johnson
2020-03-09 15:14:05 -04:00
parent 49b8e12a01
commit b9fc9b3c19

View File

@@ -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__':