diff options
Diffstat (limited to 'templates/protocols')
-rw-r--r-- | templates/protocols/static/route/node.tag/dhcp-interface/node.def | 12 | ||||
-rw-r--r-- | templates/protocols/static/table/node.tag/route/node.tag/dhcp-interface/node.def | 24 |
2 files changed, 24 insertions, 12 deletions
diff --git a/templates/protocols/static/route/node.tag/dhcp-interface/node.def b/templates/protocols/static/route/node.tag/dhcp-interface/node.def index 4942bf5f..3952233d 100644 --- a/templates/protocols/static/route/node.tag/dhcp-interface/node.def +++ b/templates/protocols/static/route/node.tag/dhcp-interface/node.def @@ -7,13 +7,17 @@ allowed: create: sudo /opt/vyatta/sbin/vyatta-update-static-route.pl --interface=$VAR(@) --route=$VAR(../@) --table=main --option=create RIP=$(/opt/vyatta/sbin/vyatta-dhcp-helper.pl --interface=$VAR(@) --want=router) - vtysh -c "configure terminal" \ - -c "ip route $VAR(../@) $RIP" + if [ "$RIP" != "127.0.0.1" ]; then + vtysh -c "configure terminal" \ + -c "ip route $VAR(../@) $RIP" + fi update: sudo /opt/vyatta/sbin/vyatta-update-static-route.pl --interface=$VAR(@) --route=$VAR(../@) --table=main --option=create RIP=$(/opt/vyatta/sbin/vyatta-dhcp-helper.pl --interface=$VAR(@) --want=router) - vtysh -c "configure terminal" \ - -c "ip route $VAR(../@) $RIP" + if [ "$RIP" != "127.0.0.1" ]; then + vtysh -c "configure terminal" \ + -c "ip route $VAR(../@) $RIP" + fi delete: sudo /opt/vyatta/sbin/vyatta-update-static-route.pl --interface=$VAR(@) --route=$VAR(../@) --table=main --option=delete RIP=$(/opt/vyatta/sbin/vyatta-dhcp-helper.pl --interface=$VAR(@) --want=router) 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(@)" |