Created
September 9, 2015 22:52
-
-
Save joestringer/63a4f3c2bd9d4f6ddac7 to your computer and use it in GitHub Desktop.
M4 to check for conntrack support and load modules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CHECK_CONNTRACK() | |
# | |
# Perform requirements checks for running conntrack tests, and flush the | |
# kernel conntrack tables when the test is finished. | |
# | |
m4_define([CHECK_CONNTRACK], | |
[AT_SKIP_IF([test $HAVE_CONNTRACK = no]) | |
AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
m4_foreach([mod], [[nf_conntrack_ipv4], [nf_conntrack_ipv6]], | |
[modprobe mod || echo "Module mod not loaded." | |
echo "loaded mod" | |
lsmod | grep nf_conn | |
on_exit "modprobe -q -r mod" | |
on_exit "echo 'attempting to unload mod'"]) | |
on_exit 'conntrack -F' | |
] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
on_exit bash function reads the rest of the line in as arguments, so the '])' to close m4_foreach() needs to be on its own line.