summaryrefslogtreecommitdiffstats
path: root/src/test/test-firewall-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/test-firewall-util.c')
-rw-r--r--src/test/test-firewall-util.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/test/test-firewall-util.c b/src/test/test-firewall-util.c
index 25c5a6cbf5..f223c0a4d9 100644
--- a/src/test/test-firewall-util.c
+++ b/src/test/test-firewall-util.c
@@ -9,16 +9,30 @@
int main(int argc, char *argv[]) {
int r;
test_setup_logging(LOG_DEBUG);
+ uint8_t prefixlen = 32;
r = fw_add_masquerade(true, AF_INET, NULL, 0);
+ if (r == 0)
+ log_error("Expected failure: NULL source");
+
+ r = fw_add_masquerade(true, AF_INET, &MAKE_IN_ADDR_UNION(10,1,2,0), 0);
+ if (r == 0)
+ log_error("Expected failure: 0 prefixlen");
+
+ r = fw_add_masquerade(true, AF_INET, &MAKE_IN_ADDR_UNION(10,1,2,3), prefixlen);
if (r < 0)
log_error_errno(r, "Failed to modify firewall: %m");
- r = fw_add_masquerade(true, AF_INET, NULL, 0);
+ prefixlen = 28;
+ r = fw_add_masquerade(true, AF_INET, &MAKE_IN_ADDR_UNION(10,0,2,0), prefixlen);
+ if (r < 0)
+ log_error_errno(r, "Failed to modify firewall: %m");
+
+ r = fw_add_masquerade(false, AF_INET, &MAKE_IN_ADDR_UNION(10,0,2,0), prefixlen);
if (r < 0)
log_error_errno(r, "Failed to modify firewall: %m");
- r = fw_add_masquerade(false, AF_INET, NULL, 0);
+ r = fw_add_masquerade(false, AF_INET, &MAKE_IN_ADDR_UNION(10,1,2,3), 32);
if (r < 0)
log_error_errno(r, "Failed to modify firewall: %m");