diff options
author | Abhishek Vijeev <abhishek.vijeev@gmail.com> | 2020-07-25 13:47:07 +0300 |
---|---|---|
committer | Andrei Vagin <avagin@gmail.com> | 2020-10-20 10:18:24 +0300 |
commit | 4b8186cb6eedda5c71a3319ca339a50278653c8c (patch) | |
tree | 2d296e8784c1a2baa6d05c4796d5e53bae6e1857 /lib | |
parent | b924394ccdab4830013a5f4364f1c05a5cdc0d15 (diff) |
crit: add BPF map data decoding
This commit enables CRIT to decode the contents of a protobuf image
that stores information related to BPF map
Signed-off-by: Abhishek Vijeev <abhishek.vijeev@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/py/images/images.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/py/images/images.py b/lib/py/images/images.py index 7faefbb96..9c8e1447d 100644 --- a/lib/py/images/images.py +++ b/lib/py/images/images.py @@ -353,6 +353,19 @@ class tcp_stream_extra_handler: f.seek(0, os.SEEK_END) return pbuff.inq_len + pbuff.outq_len +class bpfmap_data_extra_handler: + def load(self, f, pload): + size = pload.keys_bytes + pload.values_bytes + data = f.read(size) + return base64.encodebytes(data) + + def dump(self, extra, f, pload): + data = base64.decodebytes(extra) + f.write(data) + + def skip(self, f, pload): + f.seek(pload.bytes, os.SEEK_CUR) + return pload.bytes class ipc_sem_set_handler: def load(self, f, pbuff): @@ -526,6 +539,9 @@ handlers = { 'CPUINFO': entry_handler(pb.cpuinfo_entry), 'MEMFD_FILE': entry_handler(pb.memfd_file_entry), 'MEMFD_INODE': entry_handler(pb.memfd_inode_entry), + 'BPFMAP_FILE': entry_handler(pb.bpfmap_file_entry), + 'BPFMAP_DATA': entry_handler(pb.bpfmap_data_entry, + bpfmap_data_extra_handler()), } |