diff options
author | Daniil Baturin <daniil@baturin.org> | 2019-06-30 20:18:15 +0200 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2019-11-17 19:17:08 +0100 |
commit | d8decc882e04012aa6deac46086404ad4b942d8c (patch) | |
tree | 9bfc2aeacad30a7335e38ce46243618a5c948a69 | |
parent | 724e494ad6b8d1fa4d0e67432d43f2214d7d5815 (diff) | |
download | vyatta-cfg-system-d8decc882e04012aa6deac46086404ad4b942d8c.tar.gz vyatta-cfg-system-d8decc882e04012aa6deac46086404ad4b942d8c.zip |
T1430: initial implementation of IPv4 DHCP client id and hostname options.
40 files changed, 91 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)) { diff --git a/templates/interfaces/bonding/node.tag/dhcp-options/client-id/node.def b/templates/interfaces/bonding/node.tag/dhcp-options/client-id/node.def new file mode 100644 index 00000000..85ebe6e3 --- /dev/null +++ b/templates/interfaces/bonding/node.tag/dhcp-options/client-id/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client identifier diff --git a/templates/interfaces/bonding/node.tag/dhcp-options/host-name/node.def b/templates/interfaces/bonding/node.tag/dhcp-options/host-name/node.def new file mode 100644 index 00000000..80d28fbd --- /dev/null +++ b/templates/interfaces/bonding/node.tag/dhcp-options/host-name/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client host name (overrides the system host name) diff --git a/templates/interfaces/bonding/node.tag/dhcp-options/node.def b/templates/interfaces/bonding/node.tag/dhcp-options/node.def new file mode 100644 index 00000000..e90406df --- /dev/null +++ b/templates/interfaces/bonding/node.tag/dhcp-options/node.def @@ -0,0 +1 @@ +help: DHCP options diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/client-id/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/client-id/node.def new file mode 100644 index 00000000..85ebe6e3 --- /dev/null +++ b/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/client-id/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client identifier diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/host-name/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/host-name/node.def new file mode 100644 index 00000000..80d28fbd --- /dev/null +++ b/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/host-name/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client host name (overrides the system host name) diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/node.def new file mode 100644 index 00000000..e90406df --- /dev/null +++ b/templates/interfaces/bonding/node.tag/vif-s/node.tag/dhcp-options/node.def @@ -0,0 +1 @@ +help: DHCP options diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/client-id/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/client-id/node.def new file mode 100644 index 00000000..85ebe6e3 --- /dev/null +++ b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/client-id/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client identifier diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/host-name/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/host-name/node.def new file mode 100644 index 00000000..80d28fbd --- /dev/null +++ b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/host-name/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client host name (overrides the system host name) diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/node.def new file mode 100644 index 00000000..e90406df --- /dev/null +++ b/templates/interfaces/bonding/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/node.def @@ -0,0 +1 @@ +help: DHCP options diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/client-id/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/client-id/node.def new file mode 100644 index 00000000..85ebe6e3 --- /dev/null +++ b/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/client-id/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client identifier diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/host-name/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/host-name/node.def new file mode 100644 index 00000000..80d28fbd --- /dev/null +++ b/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/host-name/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client host name (overrides the system host name) diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/node.def new file mode 100644 index 00000000..e90406df --- /dev/null +++ b/templates/interfaces/bonding/node.tag/vif/node.tag/dhcp-options/node.def @@ -0,0 +1 @@ +help: DHCP options diff --git a/templates/interfaces/bridge/node.tag/dhcp-options/client-id/node.def b/templates/interfaces/bridge/node.tag/dhcp-options/client-id/node.def new file mode 100644 index 00000000..85ebe6e3 --- /dev/null +++ b/templates/interfaces/bridge/node.tag/dhcp-options/client-id/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client identifier diff --git a/templates/interfaces/bridge/node.tag/dhcp-options/host-name/node.def b/templates/interfaces/bridge/node.tag/dhcp-options/host-name/node.def new file mode 100644 index 00000000..80d28fbd --- /dev/null +++ b/templates/interfaces/bridge/node.tag/dhcp-options/host-name/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client host name (overrides the system host name) diff --git a/templates/interfaces/bridge/node.tag/dhcp-options/node.def b/templates/interfaces/bridge/node.tag/dhcp-options/node.def new file mode 100644 index 00000000..e90406df --- /dev/null +++ b/templates/interfaces/bridge/node.tag/dhcp-options/node.def @@ -0,0 +1 @@ +help: DHCP options diff --git a/templates/interfaces/ethernet/node.tag/dhcp-options/client-id/node.def b/templates/interfaces/ethernet/node.tag/dhcp-options/client-id/node.def new file mode 100644 index 00000000..85ebe6e3 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/dhcp-options/client-id/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client identifier diff --git a/templates/interfaces/ethernet/node.tag/dhcp-options/host-name/node.def b/templates/interfaces/ethernet/node.tag/dhcp-options/host-name/node.def new file mode 100644 index 00000000..80d28fbd --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/dhcp-options/host-name/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client host name (overrides the system host name) diff --git a/templates/interfaces/ethernet/node.tag/dhcp-options/node.def b/templates/interfaces/ethernet/node.tag/dhcp-options/node.def new file mode 100644 index 00000000..e90406df --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/dhcp-options/node.def @@ -0,0 +1 @@ +help: DHCP options diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcp-options/client-id/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcp-options/client-id/node.def new file mode 100644 index 00000000..85ebe6e3 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcp-options/client-id/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client identifier diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcp-options/host-name/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcp-options/host-name/node.def new file mode 100644 index 00000000..80d28fbd --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcp-options/host-name/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client host name (overrides the system host name) diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcp-options/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcp-options/node.def new file mode 100644 index 00000000..e90406df --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/dhcp-options/node.def @@ -0,0 +1 @@ +help: DHCP options diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/client-id/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/client-id/node.def new file mode 100644 index 00000000..85ebe6e3 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/client-id/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client identifier diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/host-name/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/host-name/node.def new file mode 100644 index 00000000..80d28fbd --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/host-name/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client host name (overrides the system host name) diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/node.def new file mode 100644 index 00000000..e90406df --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/node.def @@ -0,0 +1 @@ +help: DHCP options diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcp-options/client-id/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcp-options/client-id/node.def new file mode 100644 index 00000000..85ebe6e3 --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcp-options/client-id/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client identifier diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcp-options/host-name/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcp-options/host-name/node.def new file mode 100644 index 00000000..80d28fbd --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcp-options/host-name/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client host name (overrides the system host name) diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcp-options/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcp-options/node.def new file mode 100644 index 00000000..e90406df --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/dhcp-options/node.def @@ -0,0 +1 @@ +help: DHCP options diff --git a/templates/interfaces/pseudo-ethernet/node.tag/dhcp-options/client-id/node.def b/templates/interfaces/pseudo-ethernet/node.tag/dhcp-options/client-id/node.def new file mode 100644 index 00000000..85ebe6e3 --- /dev/null +++ b/templates/interfaces/pseudo-ethernet/node.tag/dhcp-options/client-id/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client identifier diff --git a/templates/interfaces/pseudo-ethernet/node.tag/dhcp-options/host-name/node.def b/templates/interfaces/pseudo-ethernet/node.tag/dhcp-options/host-name/node.def new file mode 100644 index 00000000..80d28fbd --- /dev/null +++ b/templates/interfaces/pseudo-ethernet/node.tag/dhcp-options/host-name/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client host name (overrides the system host name) diff --git a/templates/interfaces/pseudo-ethernet/node.tag/dhcp-options/node.def b/templates/interfaces/pseudo-ethernet/node.tag/dhcp-options/node.def new file mode 100644 index 00000000..e90406df --- /dev/null +++ b/templates/interfaces/pseudo-ethernet/node.tag/dhcp-options/node.def @@ -0,0 +1 @@ +help: DHCP options diff --git a/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/dhcp-options/client-id/node.def b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/dhcp-options/client-id/node.def new file mode 100644 index 00000000..85ebe6e3 --- /dev/null +++ b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/dhcp-options/client-id/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client identifier diff --git a/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/dhcp-options/host-name/node.def b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/dhcp-options/host-name/node.def new file mode 100644 index 00000000..80d28fbd --- /dev/null +++ b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/dhcp-options/host-name/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client host name (overrides the system host name) diff --git a/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/dhcp-options/node.def b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/dhcp-options/node.def new file mode 100644 index 00000000..e90406df --- /dev/null +++ b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/dhcp-options/node.def @@ -0,0 +1 @@ +help: DHCP options diff --git a/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/client-id/node.def b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/client-id/node.def new file mode 100644 index 00000000..85ebe6e3 --- /dev/null +++ b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/client-id/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client identifier diff --git a/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/host-name/node.def b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/host-name/node.def new file mode 100644 index 00000000..80d28fbd --- /dev/null +++ b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/host-name/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client host name (overrides the system host name) diff --git a/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/node.def b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/node.def new file mode 100644 index 00000000..e90406df --- /dev/null +++ b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/dhcp-options/node.def @@ -0,0 +1 @@ +help: DHCP options diff --git a/templates/interfaces/pseudo-ethernet/node.tag/vif/node.tag/dhcp-options/client-id/node.def b/templates/interfaces/pseudo-ethernet/node.tag/vif/node.tag/dhcp-options/client-id/node.def new file mode 100644 index 00000000..85ebe6e3 --- /dev/null +++ b/templates/interfaces/pseudo-ethernet/node.tag/vif/node.tag/dhcp-options/client-id/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client identifier diff --git a/templates/interfaces/pseudo-ethernet/node.tag/vif/node.tag/dhcp-options/host-name/node.def b/templates/interfaces/pseudo-ethernet/node.tag/vif/node.tag/dhcp-options/host-name/node.def new file mode 100644 index 00000000..80d28fbd --- /dev/null +++ b/templates/interfaces/pseudo-ethernet/node.tag/vif/node.tag/dhcp-options/host-name/node.def @@ -0,0 +1,2 @@ +type: txt +help: DHCP client host name (overrides the system host name) diff --git a/templates/interfaces/pseudo-ethernet/node.tag/vif/node.tag/dhcp-options/node.def b/templates/interfaces/pseudo-ethernet/node.tag/vif/node.tag/dhcp-options/node.def new file mode 100644 index 00000000..e90406df --- /dev/null +++ b/templates/interfaces/pseudo-ethernet/node.tag/vif/node.tag/dhcp-options/node.def @@ -0,0 +1 @@ +help: DHCP options |