-# $OpenBSD: Makefile,v 1.2 2017/02/21 16:31:58 bluhm Exp $
-TEST_CASES_OK+= pfioctl1
-TEST_CASES_FAILED+= pfioctl2
+# $OpenBSD: Makefile,v 1.3 2022/02/26 20:14:06 bluhm Exp $
-REGRESS_TARGETS= tests_ok tests_failed do-unfdpass1
-WARNINGS= Yes
-CFLAGS+= -Wall -Wundef -Werror
-CLEANFILES+= ${TEST_CASES_OK} ${TEST_CASES_FAILED} *.core \
- file1 file2 file3 output test-sock unfdpass
+PROGS= pfioctl1 pfioctl2 unfdpass
+WARNINGS= Yes
-tests_ok: ${TEST_CASES_OK}
- @for test in $>; do \
- ${SUDO} ./$$test; \
- done
+run-regress-pfioctl1: pfioctl1
+ ${SUDO} ./pfioctl1
-tests_failed: ${TEST_CASES_FAILED}
- @for test in $>; do \
- rm -f ./$$test.core; \
- if ${SUDO} ./$$test; then false; else true; fi; \
- rm -f ./$$test.core; \
- done
+run-regress-pfioctl2: pfioctl2
+ ${SUDO} rm -f pfioctl2.core
+ ulimit -c unlimited; ! ${SUDO} ./pfioctl2
+ ${SUDO} rm pfioctl2.core
-do-unfdpass1: unfdpass
- ${SUDO} ./unfdpass > output
- cmp -s ${.CURDIR}/expected output
-# ${SUDO} ./unfdpass -f > output
-# cmp -s ${.CURDIR}/expectedfail output
+run-regress-unfdpass: unfdpass
+ ${SUDO} ./unfdpass
+ ${SUDO} ./unfdpass -f
.include <bsd.regress.mk>
+++ /dev/null
-pf is running
-/* $OpenBSD: pfioctl1.c,v 1.2 2017/03/24 21:18:00 benno Exp $ */
+/* $OpenBSD: pfioctl1.c,v 1.3 2022/02/26 20:14:06 bluhm Exp $ */
/*
* Copyright (c) 2016 Sebastian Benoit <benno@openbsd.org>
*
if (ioctl(s, DIOCGETSTATUS, &status) == -1)
err(1, "%s: DIOCGETSTATUS", __func__);
if (!status.running)
- errx(1, "%s: pf is disabled", __func__);
+ warnx("%s: pf is disabled", __func__);
return (ret);
}
test_pf_status(s);
if (pledge("stdio pf", NULL) == -1)
- errx(1, "pledge");
+ err(1, "pledge");
printf("pf ioctl with file opened before pledge succeeds (2)\n");
test_pf_status(s);
-/* $OpenBSD: pfioctl2.c,v 1.2 2017/03/24 21:18:00 benno Exp $ */
+/* $OpenBSD: pfioctl2.c,v 1.3 2022/02/26 20:14:06 bluhm Exp $ */
/*
* Copyright (c) 2016 Sebastian Benoit <benno@openbsd.org>
*
if (ioctl(s, DIOCGETSTATUS, &status) == -1)
err(1, "%s: DIOCGETSTATUS", __func__);
if (!status.running)
- errx(1, "%s: pf is disabled", __func__);
+ warnx("%s: pf is disabled", __func__);
return (ret);
}
printf("pf ioctl with file opened after pledge fails\n");
if (pledge("stdio pf", NULL) == -1)
- errx(1, "pledge");
+ err(1, "pledge");
/* this fd is not fdpledged, test should fail */
if ((s = open(PF_SOCKET, O_RDWR)) == -1) {
-/* $OpenBSD: unfdpass.c,v 1.2 2021/12/13 16:56:50 deraadt Exp $ */
+/* $OpenBSD: unfdpass.c,v 1.3 2022/02/26 20:14:06 bluhm Exp $ */
/* $NetBSD: unfdpass.c,v 1.3 1998/06/24 23:51:30 thorpej Exp $ */
/*-
if (pledge("stdio rpath wpath sendfd recvfd proc pf", NULL)
== -1)
- errx(1, "pledge");
+ err(1, "pledge");
if ((fdpf_postpledge = open("/dev/pf", O_RDWR)) == -1) {
err(1, "%s: cannot open pf socket", __func__);
}
if (pledge("stdio recvfd pf", NULL) == -1)
- errx(1, "pledge");
+ err(1, "pledge");
/*
* Give sender a chance to run. We will get going again
* Read the files and print their contents.
*/
if (files == NULL)
- warnx("didn't get fd control message");
- else {
- if (ioctl(files[0], DIOCGETSTATUS, &status) == -1)
- err(1, "%s: DIOCGETSTATUS", __func__);
- if (!status.running)
- errx(1, "%s: pf is disabled", __func__);
- else
- printf("pf is running\n");
- }
+ errx(1, "didn't get fd control message");
+
+ if (ioctl(files[0], DIOCGETSTATUS, &status) == -1)
+ err(1, "%s: DIOCGETSTATUS", __func__);
+ if (!status.running)
+ warnx("%s: pf is disabled", __func__);
/*
* All done!
*/
- exit(0);
+ return 0;
}
void
/*
* All done!
*/
- exit(0);
+ _exit(0);
}