diff options
17 files changed, 113 insertions, 70 deletions
diff --git a/Makefile.am b/Makefile.am index 753ee650..d0dd7885 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,6 +7,8 @@ sbin_SCRIPTS += scripts/vyatta_quagga_utils.pl sbin_SCRIPTS += scripts/policy/vyatta-check-as-prepend.pl sbin_SCRIPTS += scripts/vyatta-policy-action-verify.pl sbin_SCRIPTS += scripts/vyatta-gateway-static_route-check.pl +sbin_SCRIPTS += scripts/vyatta-link-detect + sbin_PROGRAMS = src/check_prefix_boundary src_check_prefix_boundary = src/check_prefix_boundary.c diff --git a/debian/rules b/debian/rules index c865fd4f..5732e44d 100755 --- a/debian/rules +++ b/debian/rules @@ -88,7 +88,11 @@ binary-indep: build install dh_compress dh_fixperms dh_installdeb - dh_gencontrol + if [ -f "../.VYATTA_DEV_BUILD" ]; then \ + dh_gencontrol -- -v999.dev; \ + else \ + dh_gencontrol; \ + fi dh_md5sums dh_builddeb diff --git a/scripts/bgp/vyatta-bgp.pl b/scripts/bgp/vyatta-bgp.pl index 6f72a5c5..6ca3480e 100755 --- a/scripts/bgp/vyatta-bgp.pl +++ b/scripts/bgp/vyatta-bgp.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl use lib "/opt/vyatta/share/perl5/"; -use VyattaConfig; -use VyattaMisc; +use Vyatta::Config; +use Vyatta::Misc; use Getopt::Long; GetOptions("check-peer-name=s" => \$peername, @@ -61,7 +61,7 @@ sub check_peer_name() { # Make sure we aren't deleteing a peer-group that has # neighbors configured to us it sub check_for_peer_groups() { - my $config = new VyattaConfig; + my $config = new Vyatta::Config; my $pg = shift; my $as = shift; my $node = $pg; @@ -100,7 +100,7 @@ sub check_as() { my $pg = shift; my $neighbor = shift; my $as = shift; - my $config = new VyattaConfig; + my $config = new Vyatta::Config; my $pgtest = $neighbor; # if this is peer-group then short circuit this diff --git a/scripts/policy/vyatta-policy.pl b/scripts/policy/vyatta-policy.pl index 8fd94843..4a1ea4d8 100755 --- a/scripts/policy/vyatta-policy.pl +++ b/scripts/policy/vyatta-policy.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl use lib "/opt/vyatta/share/perl5/"; -use VyattaConfig; -use VyattaMisc; +use Vyatta::Config; +use Vyatta::Misc; use Getopt::Long; my $VTYSH='/usr/bin/vyatta-vtysh'; @@ -47,7 +47,7 @@ sub is_community_list { sub update_community_list() { my $num = shift; - my $config = new VyattaConfig; + my $config = new Vyatta::Config; my @rules = (); my $rule; @@ -97,7 +97,7 @@ sub is_as_path_list { sub update_as_path() { my $word = shift; - my $config = new VyattaConfig; + my $config = new Vyatta::Config; my @rules = (); my $rule; @@ -147,7 +147,7 @@ sub is_access_list { sub update_access_list() { my $list = shift; - my $config = new VyattaConfig; + my $config = new Vyatta::Config; my @rules = (); my $rule; @@ -221,7 +221,7 @@ sub update_access_list() { # $1 = policy route-map <name> rule <num> action sub check_routemap_action() { my $routemap = shift; - my $config = new VyattaConfig; + my $config = new Vyatta::Config; my $action = $config->setLevel("$routemap"); my $origvalue = $config->returnOrigValue(); @@ -241,7 +241,7 @@ sub check_routemap_action() { # $1 = policy route-map <name> rule <num> sub check_delete_routemap_action() { my $routemap = shift; - my $config = new VyattaConfig; + my $config = new Vyatta::Config; my @nodes = $config->listNodes("$routemap"); if (defined @nodes) { diff --git a/scripts/vyatta-gateway-static_route-check.pl b/scripts/vyatta-gateway-static_route-check.pl index b90fca92..51de1604 100644 --- a/scripts/vyatta-gateway-static_route-check.pl +++ b/scripts/vyatta-gateway-static_route-check.pl @@ -33,12 +33,12 @@ use warnings; use lib "/opt/vyatta/share/perl5/"; use NetAddr::IP; -use VyattaConfig; +use Vyatta::Config; if (($#ARGV == 1) && ($ARGV[0] eq '0.0.0.0/0')) { # check when deleting static-route - my $vcCHECK_GATEWAY = new VyattaConfig(); + my $vcCHECK_GATEWAY = new Vyatta::Config(); $vcCHECK_GATEWAY->setLevel('system'); if ( $vcCHECK_GATEWAY->exists('.') ) { my $gateway_ip = $vcCHECK_GATEWAY->returnValue('gateway-address'); @@ -49,7 +49,7 @@ if (($#ARGV == 1) && ($ARGV[0] eq '0.0.0.0/0')) { } elsif ($#ARGV == 0) { # check when deleting gateway-address - my $vcCHECK_STATIC_ROUTE = new VyattaConfig(); + my $vcCHECK_STATIC_ROUTE = new Vyatta::Config(); $vcCHECK_STATIC_ROUTE->setLevel('protocols static'); if ( $vcCHECK_STATIC_ROUTE->exists('.') ) { my @routes = $vcCHECK_STATIC_ROUTE->listNodes("route"); diff --git a/scripts/vyatta-link-detect b/scripts/vyatta-link-detect new file mode 100755 index 00000000..8981d7f4 --- /dev/null +++ b/scripts/vyatta-link-detect @@ -0,0 +1,21 @@ +#! /bin/bash +# +# Usage: vyatta-link-detect devicename on|off +# + +usage() { + echo "Usage: $0 devicename {on|off}" + exit 1 +} + +if [ $# -ne 2 ]; then + usage +fi + +case $2 in +on) cmd="link-detect" ;; +off) cmd="no link-detect" ;; +*) usage;; +esac + +exec vyatta-vtysh -c "configure terminal" -c "interface $1" -c "$cmd" diff --git a/scripts/vyatta-policy-action-verify.pl b/scripts/vyatta-policy-action-verify.pl index 5ddd2974..acb7d272 100644 --- a/scripts/vyatta-policy-action-verify.pl +++ b/scripts/vyatta-policy-action-verify.pl @@ -23,8 +23,8 @@ # **** End License **** # use lib "/opt/vyatta/share/perl5/"; -use VyattaConfig; -use VyattaMisc; +use Vyatta::Config; +use Vyatta::Misc; use warnings; use strict; @@ -41,7 +41,7 @@ if (!defined($rule) || !defined($route_map)) { exit 1; } -my $config = new VyattaConfig; +my $config = new Vyatta::Config; $config->setLevel('policy route-map $route_map rule $rule'); if ($config->exists("action")) { diff --git a/scripts/vyatta_quagga_utils.pl b/scripts/vyatta_quagga_utils.pl index 8806e120..eaf83649 100644 --- a/scripts/vyatta_quagga_utils.pl +++ b/scripts/vyatta_quagga_utils.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl use lib "/opt/vyatta/share/perl5/"; -use VyattaConfig; -use VyattaMisc; +use Vyatta::Config; +use Vyatta::Misc; use NetAddr::IP; use Getopt::Long; @@ -36,7 +36,7 @@ sub check_prefix_boundry() { sub check_exists() { my $node = shift; - my $config = new VyattaConfig; + my $config = new Vyatta::Config; if ( $config->exists("$node") ) { exit 0; @@ -47,7 +47,7 @@ sub check_exists() { sub check_not_exists() { my $node = shift; - my $config = new VyattaConfig; + my $config = new Vyatta::Config; if (! $config->exists("$node") ) { exit 0; diff --git a/templates/interfaces/ethernet/node.tag/disable-link-detect/node.def b/templates/interfaces/ethernet/node.tag/disable-link-detect/node.def index d4b4ceaa..22eec7cf 100644 --- a/templates/interfaces/ethernet/node.tag/disable-link-detect/node.def +++ b/templates/interfaces/ethernet/node.tag/disable-link-detect/node.def @@ -1,8 +1,3 @@ help: Set to ignore link state changes on this interface -update:vyatta-vtysh -c "configure terminal" \ - -c "interface $VAR(../@)" \ - -c "no link-detect" -delete:vyatta-vtysh -c "configure terminal" \ - -c "interface $VAR(../@)" \ - -c "link-detect" - +update:vyatta-link-detect $VAR(../@) on +delete:vyatta-link-detect $VAR(../@) off diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/disable-link-detect/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/disable-link-detect/node.def index 250c9a41..97a74ccc 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/disable-link-detect/node.def +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/disable-link-detect/node.def @@ -1,9 +1,3 @@ help: Set to ignore link state changes on this interface -update:vyatta-vtysh -c "configure terminal\" \ - -c "interface $VAR(../../@).$VAR(../@)" \ - -c "no link-detect" - -delete:vyatta-vtysh -c "configure terminal" \ - -c "interface $VAR(../../@).$VAR(../@)" \ - -c "link-detect" - +update:vyatta-link-detect "$VAR(../../@).$VAR(../@)" on +delete:vyatta-link-detect "$VAR(../../@).$VAR(../@)" off diff --git a/templates/interfaces/multilink/node.tag/vif/node.tag/disable-link-detect/node.def b/templates/interfaces/multilink/node.tag/vif/node.tag/disable-link-detect/node.def index ed220d3d..4cd557d9 100644 --- a/templates/interfaces/multilink/node.tag/vif/node.tag/disable-link-detect/node.def +++ b/templates/interfaces/multilink/node.tag/vif/node.tag/disable-link-detect/node.def @@ -1,8 +1,3 @@ help: ignore link state changes on this interface -update: vyatta-vtysh -c "configure terminal" \ - -c "interface $VAR(../../@).$VAR(../@)" \ - -c "no link-detect" -delete: vyatta-vtysh -c "configure terminal" \ - -c "interface $VAR(../../@).$VAR(../@)" \ - -c "link-detect" - +update:vyatta-link-detect "$VAR(../../@).$VAR(../@)" on +delete:vyatta-link-detect "$VAR(../../@).$VAR(../@)" off diff --git a/templates/interfaces/serial/node.tag/cisco-hdlc/vif/node.tag/disable-link-detect/node.def b/templates/interfaces/serial/node.tag/cisco-hdlc/vif/node.tag/disable-link-detect/node.def index 0bf660e1..7992791f 100644 --- a/templates/interfaces/serial/node.tag/cisco-hdlc/vif/node.tag/disable-link-detect/node.def +++ b/templates/interfaces/serial/node.tag/cisco-hdlc/vif/node.tag/disable-link-detect/node.def @@ -1,8 +1,3 @@ help: ignore link state changes on this interface -update: vyatta-vtysh -c "configure terminal" \ - -c "interface $VAR(../../../@).$VAR(../@)" \ - -c "no link-detect" -delete: vyatta-vtysh -c "configure terminal" \ - -c "interface $VAR(../../../@).$VAR(../@)" \ - -c "link-detect" - +update:vyatta-link-detect "$VAR(../../../@).$VAR(../@)" on +delete:vyatta-link-detect "$VAR(../../../@).$VAR(../@)" off diff --git a/templates/interfaces/serial/node.tag/disable-link-detect/node.def b/templates/interfaces/serial/node.tag/disable-link-detect/node.def index 2fc84bdd..03317ea1 100644 --- a/templates/interfaces/serial/node.tag/disable-link-detect/node.def +++ b/templates/interfaces/serial/node.tag/disable-link-detect/node.def @@ -1,6 +1,3 @@ help: ignore link state changes on this interface -update: vyatta-vtysh -c "configure terminal" -c "interface $VAR(../@)" \ - -c "no link-detect" -delete: vyatta-vtysh -c "configure terminal" -c "interface $VAR(../@)" \ - -c "link-detect " - +update: vyatta-link-detect $VAR(../@) off +delete: vyatta-link-detect $VAR(../@) on diff --git a/templates/interfaces/serial/node.tag/frame-relay/vif/node.tag/disable-link-detect/node.def b/templates/interfaces/serial/node.tag/frame-relay/vif/node.tag/disable-link-detect/node.def index 0bf660e1..7992791f 100644 --- a/templates/interfaces/serial/node.tag/frame-relay/vif/node.tag/disable-link-detect/node.def +++ b/templates/interfaces/serial/node.tag/frame-relay/vif/node.tag/disable-link-detect/node.def @@ -1,8 +1,3 @@ help: ignore link state changes on this interface -update: vyatta-vtysh -c "configure terminal" \ - -c "interface $VAR(../../../@).$VAR(../@)" \ - -c "no link-detect" -delete: vyatta-vtysh -c "configure terminal" \ - -c "interface $VAR(../../../@).$VAR(../@)" \ - -c "link-detect" - +update:vyatta-link-detect "$VAR(../../../@).$VAR(../@)" on +delete:vyatta-link-detect "$VAR(../../../@).$VAR(../@)" off diff --git a/templates/interfaces/serial/node.tag/ppp/vif/node.tag/disable-link-detect/node.def b/templates/interfaces/serial/node.tag/ppp/vif/node.tag/disable-link-detect/node.def index 0bf660e1..94c73270 100644 --- a/templates/interfaces/serial/node.tag/ppp/vif/node.tag/disable-link-detect/node.def +++ b/templates/interfaces/serial/node.tag/ppp/vif/node.tag/disable-link-detect/node.def @@ -1,8 +1,3 @@ help: ignore link state changes on this interface -update: vyatta-vtysh -c "configure terminal" \ - -c "interface $VAR(../../../@).$VAR(../@)" \ - -c "no link-detect" -delete: vyatta-vtysh -c "configure terminal" \ - -c "interface $VAR(../../../@).$VAR(../@)" \ - -c "link-detect" - +update:vyatta-link-detect "$VAR(../../../@).$VAR(../@)" on +delete:vyatta-link-detect "$VAR(../../@).$VAR(../@)" off diff --git a/templates/protocols/static/arp/node.def b/templates/protocols/static/arp/node.def new file mode 100644 index 00000000..cf028611 --- /dev/null +++ b/templates/protocols/static/arp/node.def @@ -0,0 +1,43 @@ +# +# Vyatta configuration template for protocols.static.arp +# +# Author: Bob Gilligan (gilligan@vyatta.com) +# + +tag: + +type: ipv4 + +help: Set a static ARP translation + +comp_help: Possible completions: + <ipv4>\tIPv4 destination address + +# +# All the work is done here in the "end:" tag. There are four possible cases: +# +# 1) A new node and possibly sub-tree with hwaddr has been created +# 2) Value of hwaddr node in sub-tree has been changed +# 3) The hwaddr node in sub-tree has been deleted +# 4) This node (and hence entire sub-tree) has been deleted +# +# The flow is the same in all cases. First, we delete any +# previous static ARP translation that may be in place for this +# IP addr. This will typically fail in case (1) and in case (4) if the +# hwaddr node had been previously deleted. Then, if a hwaddr is defined, +# we add a new startic ARP translation for this IP addr pointing to that +# hwaddr. This should always succeed, so we don't try to hide error +# messages from the user. +# +# We always force a successful return in order to prevent transient +# failures of the "arp" command from failing the commit. +# +end: + ipaddr=$VAR(@) + hwaddr=$VAR(hwaddr/@) + + arp -d $ipaddr > /dev/null + if [ -n "$hwaddr" ]; then + arp -s $ipaddr $hwaddr + fi + exit 0
\ No newline at end of file diff --git a/templates/protocols/static/arp/node.tag/hwaddr/node.def b/templates/protocols/static/arp/node.tag/hwaddr/node.def new file mode 100644 index 00000000..a6677795 --- /dev/null +++ b/templates/protocols/static/arp/node.tag/hwaddr/node.def @@ -0,0 +1,7 @@ +type: macaddr + +help: Set hardware protocol (e.g. MAC) address to translate to + +comp_help: Possible completions: + <macaddr>\tHardware protocol (e.g. MAC) address to translate to + |