From 6284929fb9b7714a0da1098575422da56a1519a8 Mon Sep 17 00:00:00 2001 From: Carl Byington Date: Fri, 8 May 2015 09:39:54 -0700 Subject: avoid routing thru 127.0.0.1 Signed-off-by: Alex Harpin --- .../route/node.tag/dhcp-interface/node.def | 24 ++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'templates/protocols/static/table') diff --git a/templates/protocols/static/table/node.tag/route/node.tag/dhcp-interface/node.def b/templates/protocols/static/table/node.tag/route/node.tag/dhcp-interface/node.def index a1b1d08c..cef919eb 100644 --- a/templates/protocols/static/table/node.tag/route/node.tag/dhcp-interface/node.def +++ b/templates/protocols/static/table/node.tag/route/node.tag/dhcp-interface/node.def @@ -10,12 +10,16 @@ create: table="$VAR(../../@)" sudo /opt/vyatta/sbin/vyatta-update-static-route.pl --interface=$ifc --route=$route --table=$table --option=create RIP=$(/opt/vyatta/sbin/vyatta-dhcp-helper.pl --interface=$ifc --want=router) - vtysh -c "configure terminal" \ - -c "ip route $route $RIP table $table" + if [ "$RIP" != "127.0.0.1" ]; then + vtysh -c "configure terminal" \ + -c "ip route $route $RIP table $table" + fi if [ "$route" == "0.0.0.0/0" ]; then LIP=$(/opt/vyatta/sbin/vyatta-dhcp-helper.pl --interface=$ifc --want=local) - MARK=$(dc 0x7fffffff $table + p) - sudo /sbin/iptables -t mangle -A OUTPUT -s $LIP/32 -j MARK --set-mark $MARK + if [ "$LIP" != "127.0.0.1" ]; then + MARK=$(dc 0x7fffffff $table + p) + sudo /sbin/iptables -t mangle -I OUTPUT -s $LIP/32 -j MARK --set-mark $MARK + fi fi update: ifc="$VAR(@)" @@ -23,12 +27,16 @@ update: table="$VAR(../../@)" sudo /opt/vyatta/sbin/vyatta-update-static-route.pl --interface=$ifc --route=$route --table=$table --option=create RIP=$(/opt/vyatta/sbin/vyatta-dhcp-helper.pl --interface=$ifc --want=router) - vtysh -c "configure terminal" \ - -c "ip route $route $RIP table $table" + if [ "$RIP" != "127.0.0.1" ]; then + vtysh -c "configure terminal" \ + -c "ip route $route $RIP table $table" + fi if [ "$route" == "0.0.0.0/0" ]; then LIP=$(/opt/vyatta/sbin/vyatta-dhcp-helper.pl --interface=$ifc --want=local) - MARK=$(dc 0x7fffffff $table + p) - sudo /sbin/iptables -t mangle -A OUTPUT -s $LIP/32 -j MARK --set-mark $MARK + if [ "$LIP" != "127.0.0.1" ]; then + MARK=$(dc 0x7fffffff $table + p) + sudo /sbin/iptables -t mangle -I OUTPUT -s $LIP/32 -j MARK --set-mark $MARK + fi fi delete: ifc="$VAR(@)" -- cgit v1.2.3