I'm walking through the script and I can make sense of most of it, but i'm having a problem figuring out a few things. Mainly, it has to do with setting up the routing tables. I understand where it makes a copy of the table but i'm having a problem figuring out how it knows to delete the vpn routes from the main table. I can't figure out the variables or how they get populated. I tried copying the script to openvpn-event and adding a bunch of echo statement, but it doesn't seem to be getting called during route-up event.
Can someone help me decipher the line?
Thanks
Can someone help me decipher the line?
Thanks
Code:
# Delete existing VPN routes that were pushed by server on table main
NET_LIST=$(ip route show|awk '$2=="via" && $3==ENVIRON["route_vpn_gateway"] && $4=="dev" && $5==ENVIRON["dev"] {print $1}')
for NET in $NET_LIST
do
ip route del $NET dev $dev
logger -t "openvpn-routing" "Removing route for $NET to $dev from routing tables"
done