Page MenuHomeVyOS Platform

Add missing documentation on how to use quote characters inside dhcp-server raw parameters
Closed, ResolvedPublic

Description

Host specific options can be added by raw static-mapping-parameters, but this is ugly, and cannot add string with quote.
this new parameter add options node tag.

static-mapping foo {
    ip-address 192.168.50.43
    mac-address 00:15:17:44:2D:AA
    option pxelinux.configfile {
        value pxelinux.cfg/01-00-15-17-44-2d-aa
    }
}

the generated result:

host VLAN7_foo {
    fixed-address 192.168.50.43;
    hardware ethernet 00:15:17:44:2D:AA;
    option pxelinux.configfile "pxelinux.cfg/01-00-15-17-44-2d-aa";
}

https://github.com/Elbandi/vyos-1x/commit/91bc03219c3e62c1b3b328f28198c6342e9b4859

Details

Difficulty level
Unknown (require assessment)
Version
1.2
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)

Event Timeline

elbandi created this object in space S1 VyOS Public.

The current static-mapping-parameters can be used to add a quoted value, e.g.

static-mapping test {
                    ip-address x.x.x.x
                    mac-address yy:yy:yy:yy:yy:yy
                    static-mapping-parameters "option domain-name-servers 1.1.1.1, 9.9.9.9;"
                }

command

set service dhcp-server shared-network-name dhcpexample subnet 192.0.2.0/24 static-mapping example static-mapping-parameters "option domain-name-servers 192.0.2.11, 192.0.2.12;"

The documentation on docs.vyos.io is lacking the explanation of this option, I have an update on hold for it for when I get some free time.
I have this running on 1.2-rolling, but it should work on all versions.

Your proposed change adds a node which duplicates the functionality of an already existing one (static-mapping-parameters can be used multiple times to add multiple options if so desired). If we'd change the way we do raw parameters, this would need to be done everywhere, and an universal solution would need to take non-option parameters, as well as strings without quotes as values.

Sorry, I misunderstood your issue, indeed adding quotes inside the parameters is not possible now. A reimplementation would be needed.

Yepp, the issue is the quotes in dhcp server config (like the sample line i wrote).
i think, duplicates functionality doesnt matter, there are already such duplications: global-parameters, subnet-parameters, etc. That are for raw settings, if someone want a magic things in dhcp. But adding normal options to static-mapping-parameters are just a workaround.

This was discussed previously: https://phabricator.vyos.net/T1129
Use """ which will be replaced with quotes when generating the isc dhcpd config.
https://github.com/vyos/vyos-1x/blob/current/src/conf_mode/dhcp_server.py#L813-L815

I will add that to the docs.

jjakob changed the task status from Open to In progress.Dec 21 2019, 11:54 AM
jjakob triaged this task as Low priority.

Added explanation on how to use quotes inside raw parameters to the docs.
https://github.com/vyos/vyos-documentation/pull/163

jjakob renamed this task from Host-specific settings for static-mapping in dhcp-server to Add missing documentation on how to use quote characters inside dhcp-server raw parameters.Dec 21 2019, 10:26 PM
jjakob closed this task as Resolved.
jjakob edited projects, added Restricted Project; removed vyatta-cfg-dhcp-server.