summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2019-06-30 20:18:15 +0200
committerDaniil Baturin <daniil@baturin.org>2019-06-30 20:24:49 +0200
commit842f2974d483bb37fc32b5766cb4edb5f21ec2fe (patch)
tree2f90127777d915e21003d62cf0f308702d4459e6 /scripts
parent290fc6e53317a26e57a8b91cde808af39e531cea (diff)
downloadvyatta-cfg-system-842f2974d483bb37fc32b5766cb4edb5f21ec2fe.tar.gz
vyatta-cfg-system-842f2974d483bb37fc32b5766cb4edb5f21ec2fe.zip
T1430: initial implementation of IPv4 DHCP client id and hostname options.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-interfaces.pl27
1 files changed, 26 insertions, 1 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index 808015fd..f6fa717a 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -157,16 +157,41 @@ sub get_mtu {
return $intf->mtu();
}
+sub get_dhcp_client_id {
+ my $name = shift;
+ my $intf = new Vyatta::Interface($name);
+ my $config = new Vyatta::Config;
+ $config->setLevel($intf->path());
+ return $config->returnValue("dhcp-options client-id");
+}
+
+sub get_dhcp_hostname {
+ my $name = shift;
+ my $intf = new Vyatta::Interface($name);
+ my $config = new Vyatta::Config;
+ $config->setLevel($intf->path());
+ return $config->returnValue("dhcp-options host-name");
+}
+
sub dhcp_update_config {
my ($conf_file, $intf) = @_;
my $output = dhcp_conf_header();
- my $hostname = get_hostname();
+ my $hostname = get_dhcp_hostname($intf);
+ if (!defined($hostname)) {
+ $hostname = get_hostname();
+ }
$output .= "interface \"$intf\" {\n";
if (defined($hostname)) {
$output .= "\tsend host-name \"$hostname\";\n";
}
+
+ my $client_id = get_dhcp_client_id($intf);
+ if (defined($client_id)) {
+ $output .= "\tsend dhcp-client-identifier \"$client_id\";\n";
+ }
+
$output .= "\trequest subnet-mask, broadcast-address, routers, domain-name-servers";
my $domainname = is_domain_name_set();
if (!defined($domainname)) {