Line number in route error is incorrect

Bug #1908944 reported by Michael Atkins
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Netplan
Triaged
Low
Unassigned
One Hundred Papercuts
Triaged
Low
Unassigned

Bug Description

The following yaml produces an error during generation, but the wrong line number is reported which means I had to debug this error with gdb and a source build :/

============ BEGIN FILE =====================
network:
  version: 2
  renderer: networkd
  ethernets:
    switch:
      dhcp4: false
      addresses: [ 192.168.50.1/24 ]
      routing-policy:
        - from: 192.168.50.0/24
          table: 128
      routes:
        - to: 0.0.0.0/0
          via: 0.0.0.0
          type: prohibit
          table: 128
          scope: global
        - table: 128
          to: 192.168.50.0/24
          from: 192.168.50.1
          on-link: true
=========== END FILE ===================

The line number in the error reported will be line 12 (the to:0.0.0.0) as shown below:

===================
test.yaml:12:9: Error in network definition: unicast route must include both a 'to' and 'via' IP
        - to: 0.0.0.0/0
        ^
===================

However, this route is actually processed correctly and the error is in the following route starting on line 17.

Perhaps the first parameter to the code:

return yaml_error(node, error, "unicast route must include both a 'to' and 'via' IP");

should be the variable 'entry' rather than 'node'

Lukas Märdian (slyon)
Changed in netplan:
importance: Undecided → Low
status: New → Triaged
Paul White (paulw2u)
Changed in hundredpapercuts:
status: New → Triaged
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.