Failed to commit with specific dhcpv6-options parameter

Dear all,

This is my first post in this community, and not english native. Sorry if I could be not understandable :innocent:. Feel free to correct if needed.

This post to warn about an error seen while trying to commit settings using dhcpv6-option, as shown below (trying to setup a VyOS router to replace router provided by French ISP called “FREE”):

vyos@vyos# commit
[ interfaces ethernet eth0 ]
VyOS had an issue completing a command.

We are sorry that you encountered a problem while using VyOS.
There are a few things you can do to help us (and yourself):

  • Make sure you are running the latest version of the code available at
    blablal lurl link imitation
  • Consult the forum to see how to handle this issue
    to this magnificent forum
  • Join our community on slack where our users exchange help and advice
    vyos slack

When reporting problems, please include as much information as possible:

  • do not obfuscate any data (feel free to contact us privately if your
    business policy requires it)
  • and include all the information presented below

Report Time: 2020-09-23 21:51:43
Image Version: VyOS 1.3-rolling-202009220118
Release Train: equuleus

Built by: autobuild@vyos.net
Built on: Tue 22 Sep 2020 01:18 UTC
Build UUID: 981c6e74-4a07-452a-80b9-8c2d49712f1a
Build Commit ID: d571b383797719

Architecture: x86_64
Boot via: installed image
System type: bare metal

Hardware vendor: Default string
Hardware model: Default string
Hardware S/N: Default string
Hardware UUID: 03000200-0400-0500-0006-000700080009

Traceback (most recent call last):
File “/usr/libexec/vyos/conf_mode/interfaces-ethernet.py”, line 87, in
verify(c)
File “/usr/libexec/vyos/conf_mode/interfaces-ethernet.py”, line 69, in verify
verify_vlan_config(ethernet)
File “/usr/lib/python3/dist-packages/vyos/configverify.py”, line 124, in verify_vlan_config
verify_dhcpv6(vlan)
File “/usr/lib/python3/dist-packages/vyos/configverify.py”, line 105, in verify_dhcpv6
for interface in vyos_dict_search(f’dhcpv6_options.pd.{pd}.interface’, config):
TypeError: ‘NoneType’ object is not iterable

[[interfaces ethernet eth0]] failed
Commit failed
[edit]
vyos@vyos#

focusing on this part:

File “/usr/lib/python3/dist-packages/vyos/configverify.py”, line 105, in verify_dhcpv6
for interface in vyos_dict_search(f’dhcpv6_options.pd.{pd}.interface’, config):

I took a look and changed dict name from config variable from dhcpv6_options to dhcpv6-options (see the underscore versus dash caracter )

(sorry i may misuse proper Python code naming, not Python specialist and not yet get used to its programming terms)

def verify_dhcpv6(config):
“”"
Common helper function used by interface implementations to perform
recurring validation of DHCPv6 options which are mutually exclusive.
“”"

if '**dhcpv6-options**' in config:
    from vyos.util import vyos_dict_search

    if {'parameters_only', 'temporary'} <= set(config['**dhcpv6-options**']):
        raise ConfigError('DHCPv6 temporary and parameters-only options '
                          'are mutually exclusive!')

    # It is not allowed to have duplicate SLA-IDs as those identify an
    # assigned IPv6 subnet from a delegated prefix
    for pd in vyos_dict_search('**dhcpv6-options**.pd', config):
        sla_ids = []
        for interface in vyos_dict_search(f'**dhcpv6-options**.pd.{pd}.interface', config):
            sla_id = vyos_dict_search(
                f'**dhcpv6-options**.pd.{pd}.interface.{interface}.sla_id', config)
            sla_ids.append(sla_id)

Once modification done and file saved, I can commit as expected:

[edit]
vyos@vyos# sho int eth eth0
description WAN
mac f4:ca:e5:53:dd:8f
mtu 1700
vif 835 {
address dhcp
mtu 1700
}
vif 836 {
address 2a01:e0a:2d6:d050:0:ffff:ffff:0/128
dhcpv6-options {
pd 0 {
length 64
}
}
ipv6 {
address {
autoconf
}
}
}
[edit]

Could you please take a look?

Many thanks. Feel free to ask if you need furter info

/tien

Hi,

the problem is that when you rename dhcpv6_options to dhcpv6-options the entire code path will never be run. Jinja does not like a hypen in a variable name thus we replace every occurrence of a hypen in the CLI by a underscore in den generated dictionary.

When looking at your config I see you have indeed specified IPv6 PD and request a /64 assignment from your ISP but you have not configured any interface where the delegated prefix should be assigned, which triggers the TypeError: 'NoneType' object is not iterable which is clearly a bug which will be handled here: ⚓ T2923 Configuring DHCPv6-PD without a interface to delegate to raises TypeError

Thanks for reporting and testing!

It will be fixed in the next rolling release.

1 Like