The network namespace scenario requires a kernel patch in 4.19 and 4.20 kernels (the fix is included in 5.0 kernels).
19 lines
552 B
Bash
Executable File
19 lines
552 B
Bash
Executable File
#!/bin/bash
|
|
|
|
IF_NAME="xfrmi-${PLUTO_IF_ID_IN}"
|
|
|
|
case "${PLUTO_VERB}" in
|
|
up-client)
|
|
/usr/local/libexec/ipsec/xfrmi -n "${IF_NAME}" -i "${PLUTO_IF_ID_IN}" -d eth0
|
|
ip link set "${IF_NAME}" up
|
|
ip route add 10.1.0.0/16 dev "${IF_NAME}"
|
|
iptables -A FORWARD -i "${IF_NAME}" -j ACCEPT
|
|
iptables -A FORWARD -o "${IF_NAME}" -j ACCEPT
|
|
;;
|
|
down-client)
|
|
iptables -D FORWARD -i "${IF_NAME}" -j ACCEPT
|
|
iptables -D FORWARD -o "${IF_NAME}" -j ACCEPT
|
|
ip link del "${IF_NAME}"
|
|
;;
|
|
esac
|