Re: [PATCH net-next v5] net: netconsole: selftests: Create a new netconsole selftest

Petr Machata
2024-08-21T10:51:14Z

Jakub Kicinski <kuba@kernel.org> writes:

> On Mon, 19 Aug 2024 02:03:53 -0700 Breno Leitao wrote:
>> +function check_for_dependencies() {
>> + if [ "$(id -u)" -ne 0 ]; then
>> + echo "This test must be run as root" >&2
>> + exit "${ksft_skip}"
>> + fi
>> +
>> + if ! which socat > /dev/null ; then
>> + echo "SKIP: socat(1) is not available" >&2
>> + exit "${ksft_skip}"
>> + fi
>> +
>> + if ! which ip > /dev/null ; then
>> + echo "SKIP: ip(1) is not available" >&2
>> + exit "${ksft_skip}"
>> + fi
>> +
>> + if ! which udevadm > /dev/null ; then
>> + echo "SKIP: udevadm(1) is not available" >&2
>> + exit "${ksft_skip}"
>> + fi
>> +
>> + if [ ! -d "${NETCONS_CONFIGFS}" ]; then
>> + echo "SKIP: directory ${NETCONS_CONFIGFS} does not exist. Check if NETCONSOLE_DYNAMIC is enabled" >&2
>> + exit "${ksft_skip}"
>> + fi
>> +
>> + if ip link show "${DSTIF}" 2> /dev/null; then
>> + echo "SKIP: interface ${DSTIF} exists in the system. Not overwriting it." >&2
>> + exit "${ksft_skip}"
>> + fi
>
> nit: maybe ip addr list to see if the 192.168.1.x network is already in
> use?

Or alternatively use 192.0.2.0/24 subnet, that shouldn't be used in the
wild.