GeekVisit / uproot

A tool to migrate static leases between routers
134 stars 0 forks source link

Presence of DUID field crashes uproot #2

Open akhuraskin opened 2 years ago

akhuraskin commented 2 years ago

Version:

uprt (2021.10.001 running on windows "Windows 10 Pro" 10.0 (Build 19043))

I exported openwrt leases using

grep -hnr -A4 "config host" /etc/config/dhcp

My configuration contains entries with duid in addition to mac such as this one:

115:config host
116-    option mac 'FC:44:82:AA:AA:AA'
117-    option dns '1'
118-    option duid '000100012774439a540xxxxxxxxx'
119-    option ip '192.168.1.244'

They crash uproot. If I remove these entries, export finishes fine. Error output:

> .\uprt.exe .\duid.openwrt -g j
Uprt converting files ...
Scanning duid.openwrt...
Error:#0      _GrowableList.[] (dart:core-patch/growable_array.dart:254)
#1      ValidateLeases.removeBadLeases (package:uprt/src/validate_leases.dart:175)
#2      OpenWrt.getLeaseMap (package:uprt/src/open_wrt.dart:124)
#3      Converter.getSourceLeaseMap (package:uprt/src/converter.dart:228)
#4      Converter.toJson (package:uprt/src/converter.dart:260)
#5      Converter.toOutput (package:uprt/src/converter.dart:70)
#6      Converter.convertFileList (package:uprt/src/converter.dart:29)
#7      main (file:///g:/users/david/documents/mega/projects/dart/convert-ddwrt/cli/bin/uprt.dart:74)
#8      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:281)
#9      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184)