Created
May 25, 2018 14:22
-
-
Save zoidyzoidzoid/fc2c7911df9a6abb361a7f7c6696a287 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
REQUIRED = { | |
"CONFIG_BPF": "y", | |
"CONFIG_BPF_SYSCALL": "y" | |
} | |
OPTIONAL = { | |
'tc filters': { | |
'CONFIG_NET_CLS_BPF': 'm' | |
}, | |
'tc actions': { | |
'CONFIG_BPF_JIT': 'y', | |
'CONFIG_HAVE_BPF_JIT': 'y', | |
'CONFIG_NET_ACT_BPF': 'm' | |
}, | |
'kprobes': { | |
'CONFIG_BPF_EVENTS': 'y' | |
}, | |
"networking examples": { | |
'CONFIG_NET_ACT_GACT': 'm', | |
'CONFIG_NET_ACT_POLICE': 'm', | |
'CONFIG_NET_SCH_SFQ': 'm', | |
'CONFIG_DUMMY': 'm', | |
'CONFIG_VXLAN': 'm' | |
} | |
} | |
config = os.path.join('/boot', 'config-{}'.format(os.uname().release)) | |
with open(config) as f: | |
data = f.read().splitlines() | |
data = dict(tuple(i.split("=")) for i in data if "=" in i) | |
for k, v in REQUIRED.items(): | |
if data[k] != v: | |
print('{} needs to be {}, not {}'.format(k, v, data[k])) | |
for feature, config in OPTIONAL.items(): | |
for k, v in config.items(): | |
if data[k] != v: | |
print('{} needs to be {}, not {}, {} may not work'.format(k, v, data[k], feature)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment