Firewall / Alias - when reading current alias content using pfctl, make sure to ignore empty lines. closes https://github.com/opnsense/core/issues/5788

This commit is contained in:
Ad Schellevis 2022-05-26 10:53:44 +02:00
parent 11e8c26079
commit 021786612c

View File

@ -158,8 +158,10 @@ if __name__ == '__main__':
if alias.get_parser():
# only try to replace the contents of this alias if we're responsible for it (know how to parse)
sp = subprocess.run(['/sbin/pfctl', '-t', alias_name, '-T', 'show'], capture_output=True, text=True)
for line in sp.stdout.strip().split('\n'):
alias_pf_content.append(line.strip())
tmp = sp.stdout.strip()
if len(tmp) > 0:
for line in tmp.split('\n'):
alias_pf_content.append(line.strip())
if (len(alias_content) != len(alias_pf_content) or alias_changed_or_expired):
# if the alias is changed, expired or the one in memory has a different number of items, load table