"Cannot use the double quote (") character in a value string" with DHCP Server "shared-network-parameters"

dhcp-server

#1

I’m trying to get some custom options into dhcpd.conf and I’m 99% there, but I can’t figure out how to get this into the shared network declaration:

option vendor.foo “value”;

When I run this command:

set service dhcp-server shared-network-name my_network shared-network-parameters “option vendor.foo “value”;”

I get this error:

Cannot use the double quote (") character in a value string
Value validation failed
Set failed

I tried escaping the quote (") and using single quotes (’) and nothing seems to work… any thoughts or guidance on how to get this shared-network-parameter which requires quotes around the value working?

vyos@vyos:~$ show version
Version: VyOS 1.2.0-rolling+201811160337

Thanks!


#2

Try set service dhcp-server shared-network-name my_network shared-network-parameters "option vendor "foo=value";"


#3

I can’t imagine the quote is relevant or necessary, and making it the literal “"” would probably probably break it, or at least not do what is desired. It’s doubtful isc-dhcp would know what to do with an HTML quote.

Seems like the following would accomplish what the OP wants here:

set shared-network-parameters 'option vendor.foo value'

#4

I got that info from one of the EdgeOS devs, so figured it would work here…


#5

& quot; passes the commit check but it goes into dhcpd.conf literally so DHCPd subsequently errors out:

Dec 16 21:00:55 vyos dhcpd: /etc/dhcp/dhcpd.conf line 25: semicolon expected.
Dec 16 21:00:55 vyos dhcpd: option vendor.foo & quot;value value&
Dec 16 21:00:55 vyos dhcpd: ^
Dec 16 21:00:55 vyos dhcpd: /etc/dhcp/dhcpd.conf line 25: expecting a parameter or declaration
Dec 16 21:00:55 vyos dhcpd: option vendor.foo & quot;value value& quot;;
Dec 16 21:00:55 vyos dhcpd: ^

As for “I can’t imagine the quote is relevant or necessary,” how about we look at dhcp-option(5) and/or try it?

I need to use either text or string for my purposes, and both of them require double quotes around the value.

Dec 16 21:06:23 vyos isc-dhcp-server[2588]: /etc/dhcp/dhcpd.conf line 25: semicolon expected.
Dec 16 21:06:23 vyos isc-dhcp-server[2588]: option vendor.demo value value;
Dec 16 21:06:23 vyos isc-dhcp-server[2588]: ^
Dec 16 21:06:23 vyos isc-dhcp-server[2588]: Configuration file errors encountered – exiting

Another other thoughts? This looks/feels like a defect to me…

Thanks!


#7

Created a phabricator task at T1129. The quote thing is definitely an issue, though it may open up another can of worms.

As a secondary note here, notice that option vendor.foo “value”; isn’t just free-form. It’s got to be from a specific list, meaning vendor.foo would always be invalid without first defining it.

You could add it as a valid option if you defined it first under:

service dhcp-server global-parameters

with

option option.foo code new-code = text ;,

though you would probably run into the same quote issue.

Also note that the reason this passes validation is per this note in the tab completion:

Additional shared-network parameters for DHCP server.
      You must use the syntax of dhcpd.conf in this text-field.
      Using this without proper knowledge may result in a crashed
      DHCP server. Check system log to look for errors.