diff options
15 files changed, 72 insertions, 34 deletions
diff --git a/debian/changelog b/debian/changelog index 539989b2..e6fd41a1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +vyatta-cfg-system (0.20.44+vyos2+lithium15) unstable; urgency=low + + * Bug #490: use command line options for parameters-only and temporary + * Bug #490: remove priority inversion in dhcpv6-options. + * Bug #491: don't allow temporary and parameters-only + * Bug #492: fail commit in case of DHCPv6 configuration errors. + + -- Daniil Baturin <daniil@baturin.org> Fri, 20 Feb 2015 15:54:29 +0100 + vyatta-cfg-system (0.20.44+vyos2+lithium14) unstable; urgency=low * Bug #356: use VyOS SNMP OID instead of the old Vyatta one. diff --git a/scripts/vyatta-dhcpv6-client.pl b/scripts/vyatta-dhcpv6-client.pl index 3a86f9ba..45318aef 100755 --- a/scripts/vyatta-dhcpv6-client.pl +++ b/scripts/vyatta-dhcpv6-client.pl @@ -61,25 +61,6 @@ sub usage { exit 1; } -sub dhcpv6_options { - my $ifname = shift; - my $intf = new Vyatta::Interface($ifname); - - die "Unknown interface type for $ifname" unless $intf; - - my $config = new Vyatta::Config; - $config->setLevel($intf->path()); - - my $args = ""; - - $args .= " -T" - if ($config->exists("dhcpv6-options temporary")); - - $args .= " -S" - if ($config->exists("dhcpv6-options parameters-only")); - - return $args; -} # # Main Section @@ -90,12 +71,16 @@ my $stop_flag; # Stop the daemon and delete all config files my $release_flag; # Stop the daemon, but leave config file my $renew_flag; # Re-start the daemon. Functionally same as start_flag my $ifname; +my $temporary; +my $params_only; GetOptions("start" => \$start_flag, "stop" => \$stop_flag, "release" => \$release_flag, "renew" => \$renew_flag, "ifname=s" => \$ifname, + "temporary" => \$temporary, + "parameters-only" => \$params_only ) or usage(); die "Error: Interface name must be specified with --ifname parameter.\n" @@ -145,10 +130,15 @@ if (defined($start_flag) || defined ($renew_flag)) { printf("Stopping old daemon...\n"); system("$cmdname -6 -pf $pidfile -x $ifname"); - # start "dhclient -6" on $ifname - my $args = dhcpv6_options($ifname); + if (defined($temporary) && defined($params_only)) { + print "Error: temporary and parameters-only options are mutually exclusive!\n"; + exit 1; + } + + my $temp_opt = defined($temporary) ? "-T" : ""; + my $po_opt = defined($params_only) ? "-S" : ""; printf("Starting new daemon...\n"); - exec "$cmdname -6 -nw -cf $conffile -pf $pidfile -lf $leasefile $args $ifname" + exec "$cmdname -6 $temp_opt $po_opt -nw -cf $conffile -pf $pidfile -lf $leasefile $ifname" or die "Can't exec $cmdname"; } diff --git a/templates/interfaces/bonding/node.tag/dhcpv6-options/node.def b/templates/interfaces/bonding/node.tag/dhcpv6-options/node.def index d9c814ee..225bd926 100644 --- a/templates/interfaces/bonding/node.tag/dhcpv6-options/node.def +++ b/templates/interfaces/bonding/node.tag/dhcpv6-options/node.def @@ -7,7 +7,7 @@ # the DHCPv6 client using the new parameters. -priority: 317 # Run before interface has been configured +priority: 319 # Run before interface has been configured help: DHCPv6 options @@ -44,6 +44,9 @@ end: echo "Re-starting DHCPv6 client on ${ifname}..." sudo /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --start \ --ifname $ifname $arg1 $arg2 + if [ $? != 0 ]; then + exit 1 + fi echo "Done." exit 0 diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcpv6-options/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcpv6-options/node.def index 9cf861b4..86b5560f 100644 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcpv6-options/node.def +++ b/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcpv6-options/node.def @@ -7,7 +7,7 @@ # the DHCPv6 client using the new parameters. -priority: 317 # Run before interface has been configured +priority: 319 # Run before interface has been configured help: DHCPv6 options @@ -43,5 +43,8 @@ end: echo "Re-starting DHCPv6 client on ${ifname}..." sudo /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --start \ --ifname $ifname $arg1 $arg2 + if [ $? != 0 ]; then + exit 1 + fi exit 0 diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def index 805315fc..ef4c13ad 100644 --- a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def +++ b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def @@ -7,7 +7,7 @@ # the DHCPv6 client using the new parameters. -priority: 317 # Run before interface has been configured +priority: 319 # Run before interface has been configured help: DHCPv6 options @@ -43,5 +43,8 @@ end: echo "Re-starting DHCPv6 client on ${ifname}..." sudo /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --start \ --ifname $ifname $arg1 $arg2 + if [ $? != 0 ]; then + exit 1 + fi exit 0 diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/node.def index 9cf861b4..81e7055d 100644 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/node.def +++ b/templates/interfaces/bonding/node.tag/vif/node.tag/dhcpv6-options/node.def @@ -43,5 +43,8 @@ end: echo "Re-starting DHCPv6 client on ${ifname}..." sudo /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --start \ --ifname $ifname $arg1 $arg2 + if [ $? != 0 ]; then + exit 1 + fi exit 0 diff --git a/templates/interfaces/bridge/node.tag/dhcpv6-options/node.def b/templates/interfaces/bridge/node.tag/dhcpv6-options/node.def index d9c814ee..225bd926 100644 --- a/templates/interfaces/bridge/node.tag/dhcpv6-options/node.def +++ b/templates/interfaces/bridge/node.tag/dhcpv6-options/node.def @@ -7,7 +7,7 @@ # the DHCPv6 client using the new parameters. -priority: 317 # Run before interface has been configured +priority: 319 # Run before interface has been configured help: DHCPv6 options @@ -44,6 +44,9 @@ end: echo "Re-starting DHCPv6 client on ${ifname}..." sudo /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --start \ --ifname $ifname $arg1 $arg2 + if [ $? != 0 ]; then + exit 1 + fi echo "Done." exit 0 diff --git a/templates/interfaces/ethernet/node.tag/dhcpv6-options/node.def b/templates/interfaces/ethernet/node.tag/dhcpv6-options/node.def index d9c814ee..225bd926 100644 --- a/templates/interfaces/ethernet/node.tag/dhcpv6-options/node.def +++ b/templates/interfaces/ethernet/node.tag/dhcpv6-options/node.def @@ -7,7 +7,7 @@ # the DHCPv6 client using the new parameters. -priority: 317 # Run before interface has been configured +priority: 319 # Run before interface has been configured help: DHCPv6 options @@ -44,6 +44,9 @@ end: echo "Re-starting DHCPv6 client on ${ifname}..." sudo /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --start \ --ifname $ifname $arg1 $arg2 + if [ $? != 0 ]; then + exit 1 + fi echo "Done." exit 0 diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcpv6-options/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcpv6-options/node.def index 9cf861b4..86b5560f 100644 --- a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcpv6-options/node.def +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcpv6-options/node.def @@ -7,7 +7,7 @@ # the DHCPv6 client using the new parameters. -priority: 317 # Run before interface has been configured +priority: 319 # Run before interface has been configured help: DHCPv6 options @@ -43,5 +43,8 @@ end: echo "Re-starting DHCPv6 client on ${ifname}..." sudo /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --start \ --ifname $ifname $arg1 $arg2 + if [ $? != 0 ]; then + exit 1 + fi exit 0 diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def index 805315fc..ef4c13ad 100644 --- a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def @@ -7,7 +7,7 @@ # the DHCPv6 client using the new parameters. -priority: 317 # Run before interface has been configured +priority: 319 # Run before interface has been configured help: DHCPv6 options @@ -43,5 +43,8 @@ end: echo "Re-starting DHCPv6 client on ${ifname}..." sudo /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --start \ --ifname $ifname $arg1 $arg2 + if [ $? != 0 ]; then + exit 1 + fi exit 0 diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcpv6-options/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcpv6-options/node.def index 9cf861b4..86b5560f 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcpv6-options/node.def +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcpv6-options/node.def @@ -7,7 +7,7 @@ # the DHCPv6 client using the new parameters. -priority: 317 # Run before interface has been configured +priority: 319 # Run before interface has been configured help: DHCPv6 options @@ -43,5 +43,8 @@ end: echo "Re-starting DHCPv6 client on ${ifname}..." sudo /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --start \ --ifname $ifname $arg1 $arg2 + if [ $? != 0 ]; then + exit 1 + fi exit 0 diff --git a/templates/interfaces/pseudo-ethernet/node.tag/dhcpv6-options/node.def b/templates/interfaces/pseudo-ethernet/node.tag/dhcpv6-options/node.def index d9c814ee..225bd926 100644 --- a/templates/interfaces/pseudo-ethernet/node.tag/dhcpv6-options/node.def +++ b/templates/interfaces/pseudo-ethernet/node.tag/dhcpv6-options/node.def @@ -7,7 +7,7 @@ # the DHCPv6 client using the new parameters. -priority: 317 # Run before interface has been configured +priority: 319 # Run before interface has been configured help: DHCPv6 options @@ -44,6 +44,9 @@ end: echo "Re-starting DHCPv6 client on ${ifname}..." sudo /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --start \ --ifname $ifname $arg1 $arg2 + if [ $? != 0 ]; then + exit 1 + fi echo "Done." exit 0 diff --git a/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/dhcpv6-options/node.def b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/dhcpv6-options/node.def index 9cf861b4..86b5560f 100644 --- a/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/dhcpv6-options/node.def +++ b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/dhcpv6-options/node.def @@ -7,7 +7,7 @@ # the DHCPv6 client using the new parameters. -priority: 317 # Run before interface has been configured +priority: 319 # Run before interface has been configured help: DHCPv6 options @@ -43,5 +43,8 @@ end: echo "Re-starting DHCPv6 client on ${ifname}..." sudo /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --start \ --ifname $ifname $arg1 $arg2 + if [ $? != 0 ]; then + exit 1 + fi exit 0 diff --git a/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def index 805315fc..ef4c13ad 100644 --- a/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def +++ b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcpv6-options/node.def @@ -7,7 +7,7 @@ # the DHCPv6 client using the new parameters. -priority: 317 # Run before interface has been configured +priority: 319 # Run before interface has been configured help: DHCPv6 options @@ -43,5 +43,8 @@ end: echo "Re-starting DHCPv6 client on ${ifname}..." sudo /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --start \ --ifname $ifname $arg1 $arg2 + if [ $? != 0 ]; then + exit 1 + fi exit 0 diff --git a/templates/interfaces/pseudo-ethernet/node.tag/vif/node.tag/dhcpv6-options/node.def b/templates/interfaces/pseudo-ethernet/node.tag/vif/node.tag/dhcpv6-options/node.def index 9cf861b4..86b5560f 100644 --- a/templates/interfaces/pseudo-ethernet/node.tag/vif/node.tag/dhcpv6-options/node.def +++ b/templates/interfaces/pseudo-ethernet/node.tag/vif/node.tag/dhcpv6-options/node.def @@ -7,7 +7,7 @@ # the DHCPv6 client using the new parameters. -priority: 317 # Run before interface has been configured +priority: 319 # Run before interface has been configured help: DHCPv6 options @@ -43,5 +43,8 @@ end: echo "Re-starting DHCPv6 client on ${ifname}..." sudo /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --start \ --ifname $ifname $arg1 $arg2 + if [ $? != 0 ]; then + exit 1 + fi exit 0 |
