]> git.ipfire.org Git - thirdparty/systemd.git/commit
firewall-util: reject NULL source or address with prefixlen 0
authorFlorian Westphal <fw@strlen.de>
Wed, 24 Jun 2020 09:55:14 +0000 (11:55 +0200)
committerFlorian Westphal <fw@strlen.de>
Tue, 15 Dec 2020 23:35:56 +0000 (00:35 +0100)
commit47ed20e1e08d800e722b05a3fb33ba6be4b48afc
tree7bb43b776909f5f66e06c41e2c7ba07d506da14d
parent937e305e9305a9104cfb1362f318d9df5943b8a5
firewall-util: reject NULL source or address with prefixlen 0

Make sure we don't add masquerading rules without a explicitly
specified network range we should be masquerading for.

The only caller aside from test case is
networkd-address.c which never passes a NULL source.

As it also passes the network prefix, that should always be > 0 as well.

This causes expected test failure:
Failed to modify firewall: Invalid argument
Failed to modify firewall: Invalid argument
Failed to modify firewall: Invalid argument
Failed to modify firewall: Protocol not available
Failed to modify firewall: Protocol not available
Failed to modify firewall: Protocol not available
Failed to modify firewall: Protocol not available

The failing test cases are amended to expect failure on
NULL source or prefix instead of success.
src/shared/firewall-util.c
src/test/test-firewall-util.c