if [ "${tgt}" = local ]
then
- # OpenWrt: local 127.0.0.1 dev lo src 127.0.0.1
- # iproute2: local 127.0.0.1 dev lo src 127.0.0.1 uid 1000
printf 'FATAL: Target address is local to this host.\n' >&2
_cleanup 1
elif [ "${tgt}" != "${nchost}" ]
if [ "${kind}" = dev ]
then
: IPv4 local
- # OpenWrt: 172.18.3.199 dev br-lan src 172.18.3.254
- # iproute2: 172.18.3.199 dev enp3s0 src 172.18.3.138 uid 1000
read tgt kind dev l_src srcaddr _ < "${tfile}"
eval "$(_gethwaddr "${tgt}")"
mode='IPv4 local'
elif [ "${kind}" = via ]
then
: IPv4 routed
- # OpenWrt: 8.8.8.8 via 100.126.0.243 dev pppoe-wan src 193.238.236.243
- # iproute2: 8.8.8.8 via 172.18.3.254 dev enp3s0 src 172.18.3.138 uid 1000
read tgt kind gw l_dev dev l_src srcaddr _ < "${tfile}"
eval "$(_gethwaddr "${gw}")"
mode='IPv4 routed'
if [ "${label_diff}" = dev ]
then
: IPv6 local
- # OpenWrt: 2a02:1748:fafe:cf3f::111 from :: dev br-lan src 2a02:1748:fafe:cf3f::1 metric 1024
- # iproute2: 2a02:1748:fafe:cf3f::111 from :: dev enp3s0 proto ra src 2a02:1748:fafe:cf3f::127 metric 100 pref medium
read tgt kind colons l_dev dev l_proto proto l_src srcaddr _ < "${tfile}"
if [ "${l_proto}" != proto ]
then
elif [ "${label_diff}" = via ]
then
: IPv6 routed
- # OpenWrt: 2a03:4000:21:3::1:1337 from :: dev pppoe-wan src 2a02:1748:fafe:cf30::1 metric 1024
- # iproute2: 2a03:4000:21:3::1:1337 from :: via fe80::2e0:5cff:fe68:14ff dev enp3s0 proto ra src 2a02:1748:fafe:cf3f::127 metric 100 pref medium
read tgt kind colons l_via gw l_dev dev l_proto proto l_src srcaddr _ < "${tfile}"
if [ "${l_proto}" != proto ]
then