[Dnsmasq-discuss] Length of the classless static routes dhcp-option

Slawek Kaplonski skaplons at redhat.com
Wed Jul 8 10:24:08 BST 2020


Hi,

In OpenStack Neutron we support adding static routes through the DHCP. It is done by adding things like:

tag:tag0,option:classless-static-route,172.16.2.1/32,172.16.1.254

in the opts file.
Now I have a case when user added many such static routes, so it ends up with line like:

tag:tag0,option:classless-static-route,172.16.2.1/32,172.16.1.254,172.16.2.10/32,172.16.1.254,172.16.2.11/32,172.16.1.254,172.16.2.12/32,172.16.1.254,172.16.2.13/32,172.16.1.254,172.16.2.14/32,172.16.1.254,172.16.2.15/32,172.16.1.254,172.16.2.16/32,172.16.1.254,172.16.2.17/32,172.16.1.254,172.16.2.18/32,172.16.1.254,
172.16.2.19/32,172.16.1.254,172.16.2.2/32,172.16.1.254,172.16.2.20/32,172.16.1.254,172.16.2.21/32,172.16.1.254,172.16.2.22/32,172.16.1.254,172.16.2.23/32,172.16.1.254,172.16.2.24/32,172.16.1.254,172.16.2.25/32,172.16.1.254,172.16.2.26/32,172.16.1.254,172.16.2.27/32,172.16.1.254,172.16.2.28/32,172.16.1.254,172.16.2.29
/32,172.16.1.254,172.16.2.3/32,172.16.1.254,172.16.2.4/32,172.16.1.254,172.16.2.5/32,172.16.1.254,172.16.2.6/32,172.16.1.254,172.16.2.7/32,172.16.1.254,172.16.2.8/32,172.16.1.254,172.16.2.9/32,172.16.1.254,169.254.169.254/32,172.16.1.1,0.0.0.0/0,172.16.1.1

And in the logs I have error like:

dnsmasq[405600]: dhcp-option too long at line 2 of /var/lib/neutron/dhcp/82d62efa-f09a-42f2-b53b-df82c2c6a0ae/opts

I found out that dhcp-option is only 8 bits so it can be only 255 chars long.
I also found old email https://www.mail-archive.com/dnsmasq-discuss@lists.thekelleys.org.uk/msg06719.html with advice to use multiple dhcp-option=… fields to workaround this issue. So I did that and now my opts file looks like:

tag:tag0,option:classless-static-route,172.16.2.1/32,172.16.1.254
tag:tag0,249,172.16.2.1/32,172.16.1.254
tag:tag0,option:classless-static-route,172.16.2.10/32,172.16.1.254
tag:tag0,249,172.16.2.10/32,172.16.1.254
tag:tag0,option:classless-static-route,172.16.2.11/32,172.16.1.254
tag:tag0,249,172.16.2.11/32,172.16.1.254
tag:tag0,option:classless-static-route,172.16.2.12/32,172.16.1.254
tag:tag0,249,172.16.2.12/32,172.16.1.254
tag:tag0,option:classless-static-route,172.16.2.13/32,172.16.1.254
tag:tag0,249,172.16.2.13/32,172.16.1.254
tag:tag0,option:classless-static-route,172.16.2.14/32,172.16.1.254
tag:tag0,249,172.16.2.14/32,172.16.1.254
tag:tag0,option:classless-static-route,172.16.2.15/32,172.16.1.254
tag:tag0,249,172.16.2.15/32,172.16.1.254
….

But is seems for me that VM always only get last value set in the file. Is there any way to workaround this somehow and allow more static routes to be passed to the instance?

— 
Slawek Kaplonski
Principal software engineer
Red Hat




More information about the Dnsmasq-discuss mailing list