natesales / pathvector

Declarative routing platform that automates BGP route optimization and control plane configuration with secure and repeatable routing policy.
https://pathvector.io
MIT License
220 stars 28 forks source link

panic: runtime error: invalid memory address or nil pointer dereference #40

Closed netfreak98 closed 3 years ago

netfreak98 commented 3 years ago

Hey,

just testing your newest release. Somehow it stops generating at random points:

Example 1:

DEBU[0000] [HURRICANE ELECTRIC DECIX DUS] skipping field PrefixSet6 with ingored default (-)
DEBU[0000] [HURRICANE ELECTRIC DECIX DUS] skipping field ImportStandardCommunities with ingored default (-)
DEBU[0000] [HURRICANE ELECTRIC DECIX DUS] skipping field ImportLargeCommunities with ingored default (-)
DEBU[0000] [HURRICANE ELECTRIC DECIX DUS] skipping field ExportStandardCommunities with ingored default (-)
DEBU[0000] [HURRICANE ELECTRIC DECIX DUS] skipping field ExportLargeCommunities with ingored default (-)
DEBU[0000] [HURRICANE ELECTRIC DECIX DUS] skipping field AnnounceStandardCommunities with ingored default (-)
DEBU[0000] [HURRICANE ELECTRIC DECIX DUS] skipping field AnnounceLargeCommunities with ingored default (-)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x79518c]

goroutine 1 [running]:
main.loadConfig(0xc0003c4000, 0x2b64, 0x2b65, 0x2b64, 0x2b65, 0x0)
        /home/runner/work/wireframe/wireframe/config.go:386 +0x286c
main.run(0xc000012080, 0x4, 0x4)
        /home/runner/work/wireframe/wireframe/main.go:145 +0x409
main.main()
        /home/runner/work/wireframe/wireframe/main.go:305 +0x45

Example 2:

DEBU[0000] [FREIFUNK NORDWEST EV DECIX FRA] skipping field ProtocolName with ingored default (-)
DEBU[0000] [FREIFUNK NORDWEST EV DECIX FRA] skipping field Protocols with ingored default (-)
DEBU[0000] [FREIFUNK NORDWEST EV DECIX FRA] skipping field PrefixSet4 with ingored default (-)
DEBU[0000] [FREIFUNK NORDWEST EV DECIX FRA] skipping field PrefixSet6 with ingored default (-)
DEBU[0000] [FREIFUNK NORDWEST EV DECIX FRA] skipping field ImportStandardCommunities with ingored default (-)
DEBU[0000] [FREIFUNK NORDWEST EV DECIX FRA] skipping field ImportLargeCommunities with ingored default (-)
DEBU[0000] [FREIFUNK NORDWEST EV DECIX FRA] skipping field ExportStandardCommunities with ingored default (-)
DEBU[0000] [FREIFUNK NORDWEST EV DECIX FRA] skipping field ExportLargeCommunities with ingored default (-)
DEBU[0000] [FREIFUNK NORDWEST EV DECIX FRA] skipping field AnnounceStandardCommunities with ingored default (-)
DEBU[0000] [FREIFUNK NORDWEST EV DECIX FRA] skipping field AnnounceLargeCommunities with ingored default (-)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x79518c]

goroutine 1 [running]:
main.loadConfig(0xc0000cc000, 0x2b64, 0x2b65, 0x2b64, 0x2b65, 0x0)
        /home/runner/work/wireframe/wireframe/config.go:386 +0x286c
main.run(0xc000012090, 0x3, 0x3)
        /home/runner/work/wireframe/wireframe/main.go:145 +0x409
main.main()
        /home/runner/work/wireframe/wireframe/main.go:305 +0x45

Example 3:

DEBU[0000] [CLOUDFLARE DECIX FRA] skipping field Protocols with ingored default (-)
DEBU[0000] [CLOUDFLARE DECIX FRA] skipping field PrefixSet4 with ingored default (-)
DEBU[0000] [CLOUDFLARE DECIX FRA] skipping field PrefixSet6 with ingored default (-)
DEBU[0000] [CLOUDFLARE DECIX FRA] skipping field ImportStandardCommunities with ingored default (-)
DEBU[0000] [CLOUDFLARE DECIX FRA] skipping field ImportLargeCommunities with ingored default (-)
DEBU[0000] [CLOUDFLARE DECIX FRA] skipping field ExportStandardCommunities with ingored default (-)
DEBU[0000] [CLOUDFLARE DECIX FRA] skipping field ExportLargeCommunities with ingored default (-)
DEBU[0000] [CLOUDFLARE DECIX FRA] skipping field AnnounceStandardCommunities with ingored default (-)
DEBU[0000] [CLOUDFLARE DECIX FRA] skipping field AnnounceLargeCommunities with ingored default (-)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x79518c]

goroutine 1 [running]:
main.loadConfig(0xc000412000, 0x2b64, 0x2b65, 0x2b64, 0x2b65, 0x0)
        /home/runner/work/wireframe/wireframe/config.go:386 +0x286c
main.run(0xc00009c060, 0x3, 0x3)
        /home/runner/work/wireframe/wireframe/main.go:145 +0x409
main.main()
        /home/runner/work/wireframe/wireframe/main.go:305 +0x45

Do you have any idea where the issue is? :/

Thanks

Best, Joey

OS: Debian 10 Kernel: 5.10.0-0.bpo.3-amd64 Wireframe: 4.0.0

netfreak98 commented 3 years ago

maybe this helps:

I've noticed a lot of those messages:

DEBU[0000] [AKAMAI TECHNOLOGIES DECIX FRA] (before defaulting, after templating) field Multihop value <invalid reflect.Value>
DEBU[0000] [AKAMAI TECHNOLOGIES DECIX FRA] (before defaulting, after templating) field RSClient value <invalid reflect.Value>
DEBU[0000] [RS2 DECIX DUS] (before defaulting, after templating) field BFD value <invalid reflect.Value>
DEBU[0000] [TILMAN SCHAEFERS DECIX DUS] (before defaulting, after templating) field MPUnicast46 value <invalid reflect.Value>
natesales commented 3 years ago

At first glance this looks like a config issue that isn't properly validated by wireframe. Can you post your YAML config file?

netfreak98 commented 3 years ago

Sure:

asn: 49697
router-id: 185.121.69.149
irr-server: rr.ntt.net
rtr-server: 127.0.0.1:8282
source4: 185.121.69.149
source6: 2001:678:a00:1000::a
keep-filtered: true

prefixes:
  - 46.251.230.0/24
  - 2001:678:974::/48
  - 2001:678:97c::/48
  - 2001:67c:1250::/48

augments:
  accept4:
    - OSPF4_AREA10_AS49697
  accept6:
    - OSPF6_AREA10_AS49697

templates:
  upstream:
    next-hop-self: true
    local-pref: 110
    auto-as-set: true
    auto-import-limits: true
    filter-irr: false
    import-communities:
      - 49697,2500
    filter-tier1-asns: true
    announce-communities:
      - 49697,3500
    max-prefix-action: restart
  peering:
    next-hop-self: true
    local-pref: 210
    auto-as-set: true
    auto-import-limits: true
    filter-irr: true
    import-communities:
      - 49697,3000
    filter-tier1-asns: true
    announce-communities:
      - 49697,3500
    max-prefix-action: restart
  downstream:
    next-hop-self: true
    local-pref: 500
    auto-as-set: true
    auto-import-limits: true
    announce-default: true
    filter-irr: true
    import-communities:
      - 49697,3500
    announce-communities:
      - 49697,2500
      - 49697,3000
      - 49697,3500
    max-prefix-action: restart

peers:

  MARBIS GMBH TRANSIT:
    asn: 199610
    local-pref: 100
    template: upstream
    neighbors:
      - "46.251.230.229"
      - "2001:67c:1250:1337::1005"

  HURRICANE ELECTRIC DECIX FRA TRANSIT:
    asn: 6939
    local-pref: 100
    template: upstream
    neighbors:
      - "2001:7f8::1b1b:0:1"

  HURRICANE ELECTRIC DECIX DUS TRANSIT:
    asn: 6939
    local-pref: 100
    template: upstream
    neighbors:
      - "2001:7f8:9e::1b1b:0:1"

  JULIAN SCHUH PNI:
    asn: 202539
    local-pref: 500
    template: downstream
    neighbors:
      - "46.251.230.225"
      - "2001:67c:1250:1337::1001"

  JAN-PHILIPP BENECKE PNI:
    asn: 206479
    local-pref: 500
    template: downstream
    neighbors:
      - "185.120.22.200"
      - "2a06:e881:2100:ffff:4969:7:1:0"

  ERIC DORR PNI:
    asn: 51861
    local-pref: 500
    template: downstream
    neighbors:
      - "46.251.230.233"
      - "2001:67c:1250:1337::1011"

  AFNIC DECIX FRA:
    asn: 2484
    local-pref: 500
    template: downstream
    neighbors:
      - "80.81.194.155"
      - "2001:7f8::9b4:0:1"

  RIPE RIS DECIX FRA:
    asn: 12654
    local-pref: 500
    template: downstream
    neighbors:
      - "80.81.192.152"
      - "2001:7f8::316e:0:1"
natesales commented 3 years ago

Fixed in v4.0.1, with the one change being filter-tier1-asns is now filter-transit-asns. Let me know if this solved the issue!