Add support for CIDR subnets

This commit is contained in:
Robert Chacón 2022-03-20 17:53:27 -06:00 committed by GitHub
parent b7a99b2234
commit c587b35a3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -204,8 +204,14 @@ def refreshShapers():
if device['ipv4']: if device['ipv4']:
parentString = str(major) + ':' parentString = str(major) + ':'
flowIDstring = str(major) + ':' + str(minor) flowIDstring = str(major) + ':' + str(minor)
print(tabs + ' ', end='') if '/' in device['ipv4']:
shell('./xdp-cpumap-tc/src/xdp_iphash_to_cpu_cmdline --add --ip ' + device['ipv4'] + ' --cpu ' + str(queue-1) + ' --classid ' + flowIDstring) hosts = list(ipaddress.ip_network(device['ipv4']).hosts())
for host in hosts:
print(tabs + ' ', end='')
shell('./xdp-cpumap-tc/src/xdp_iphash_to_cpu_cmdline --add --ip ' + str(host) + ' --cpu ' + str(queue-1) + ' --classid ' + flowIDstring)
else:
print(tabs + ' ', end='')
shell('./xdp-cpumap-tc/src/xdp_iphash_to_cpu_cmdline --add --ip ' + device['ipv4'] + ' --cpu ' + str(queue-1) + ' --classid ' + flowIDstring)
device['qdisc'] = flowIDstring device['qdisc'] = flowIDstring
if device['hostname'] not in devicesShaped: if device['hostname'] not in devicesShaped:
devicesShaped.append(device['hostname']) devicesShaped.append(device['hostname'])