blob: c3e9759faa68e835c7ff4ce1acb9c68fd2c41b70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/usr/bin/env bash
set -euo pipefail
if [[ "$(id -u)" -ne 0 ]]; then
echo >&2 "Run with sudo"
exit 1
fi
if [[ $# -eq 0 ]]; then
server_exec=./server
elif [[ $# -eq 1 ]]; then
server_exec="$1"
else
echo >&2 "Usage: $0 [server executable]"
echo >&2 "By default runs ./server"
exit 1
fi
if [[ ! -x "$server_exec" ]]; then
echo >&2 "Cannot execute server executable $server_exec"
exit 1
fi
echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all
trap "echo 0 >/proc/sys/net/ipv4/icmp_echo_ignore_all" EXIT
"$server_exec"
|