gobgp icon indicating copy to clipboard operation
gobgp copied to clipboard

Panic when parsing Ip Address "fe80::1/128"

Open DerDennisOP opened this issue 4 months ago • 0 comments

Dec 12 22:33:10 c gobgpd[803]: panic: ParseAddr("fe80::1/128"): unexpected character, want colon (at "/128")
Dec 12 22:33:10 c gobgpd[803]: goroutine 1 [running]:
Dec 12 22:33:10 c gobgpd[803]: net/netip.MustParseAddr(...)
Dec 12 22:33:10 c gobgpd[803]:         net/netip/netip.go:136
Dec 12 22:33:10 c gobgpd[803]: github.com/osrg/gobgp/v4/internal/pkg/table.(*Statement).ToConfig.func1(...)
Dec 12 22:33:10 c gobgpd[803]:         github.com/osrg/gobgp/v4/internal/pkg/table/policy.go:2914
Dec 12 22:33:10 c gobgpd[803]: github.com/osrg/gobgp/v4/internal/pkg/table.(*Statement).ToConfig(0xc0001e1c20)
Dec 12 22:33:10 c gobgpd[803]:         github.com/osrg/gobgp/v4/internal/pkg/table/policy.go:2937 +0x1151
Dec 12 22:33:10 c gobgpd[803]: github.com/osrg/gobgp/v4/pkg/server.newConfigPolicyFromApiStruct(0xc0001e18b0)
Dec 12 22:33:10 c gobgpd[803]:         github.com/osrg/gobgp/v4/pkg/server/grpc_server.go:2227 +0x1ee
Dec 12 22:33:10 c gobgpd[803]: github.com/osrg/gobgp/v4/pkg/server.newRoutingPolicyFromApiStruct(0xc00016d050)
Dec 12 22:33:10 c gobgpd[803]:         github.com/osrg/gobgp/v4/pkg/server/grpc_server.go:497 +0xdc
Dec 12 22:33:10 c gobgpd[803]: github.com/osrg/gobgp/v4/pkg/server.(*BgpServer).SetPolicies(0xc0001ba488, {0xf8b5db?, 0xc0002ea1e0?}, 0xc000279d50?)
Dec 12 22:33:10 c gobgpd[803]:         github.com/osrg/gobgp/v4/pkg/server/server.go:1887 +0x28
Dec 12 22:33:10 c gobgpd[803]: github.com/osrg/gobgp/v4/pkg/config.InitialConfig({0x10e3510, 0x182e280}, 0xc0001ba488, 0xc0001ba908, 0x0)
Dec 12 22:33:10 c gobgpd[803]:         github.com/osrg/gobgp/v4/pkg/config/config.go:373 +0x192b
Dec 12 22:33:10 c gobgpd[803]: main.main()
Dec 12 22:33:10 c gobgpd[803]:         github.com/osrg/gobgp/v4/cmd/gobgpd/main.go:257 +0x2174
Dec 12 22:33:10 c systemd[1]: gobgpd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
[[defined-sets.prefix-sets]]
prefix-set-name = "c-out-ipv4"
[[defined-sets.prefix-sets.prefix-list]]
ip-prefix = "203.0.113.0/24"
masklength-range = "24..32"

[[defined-sets.prefix-sets]]
prefix-set-name = "c-out-ipv6"
[[defined-sets.prefix-sets.prefix-list]]
ip-prefix = "2001:db8:dead::/48"
masklength-range = "48..128"

[global.apply-policy.config]
default-export-policy = "reject-route"
default-import-policy = "reject-route"
export-policy-list = ["c-out"]
import-policy-list = ["accept-ipv6-ll"]

[global.config]
as = 64498
router-id = "192.0.2.3"

[[neighbors]]
[[neighbors.afi-safis]]
[neighbors.afi-safis.config]
afi-safi-name = "ipv4-unicast"

[[neighbors.afi-safis]]
[neighbors.afi-safis.config]
afi-safi-name = "ipv6-unicast"

[neighbors.config]
neighbor-address = "fe80::1%eth1"
peer-as = 64496

[[neighbors]]
[[neighbors.afi-safis]]
[neighbors.afi-safis.config]
afi-safi-name = "ipv4-unicast"

[[neighbors.afi-safis]]
[neighbors.afi-safis.config]
afi-safi-name = "ipv6-unicast"

[neighbors.config]
neighbor-address = "fe80::2%eth1"
peer-as = 64497

[[policy-definitions]]
name = "accept-ipv6-ll"

[[policy-definitions.statements]]
[policy-definitions.statements.actions]
route-disposition = "accept-route"

[policy-definitions.statements.conditions.bgp-conditions]
next-hop-in-list = ["fe80::1", "fe80::2"]

[[policy-definitions]]
name = "c-out"

[[policy-definitions.statements]]
[policy-definitions.statements.actions]
route-disposition = "accept-route"

[policy-definitions.statements.conditions.match-prefix-set]
match-set-options = "any"
prefix-set = "c-out-ipv4"

[[policy-definitions.statements]]
[policy-definitions.statements.actions]
route-disposition = "accept-route"

[policy-definitions.statements.conditions.match-prefix-set]
match-set-options = "any"
prefix-set = "c-out-ipv6"

[zebra.config]
enabled = true
redistribute-route-type-list = ["kernel", "directly-connected", "static"]
software-name = "frr9.0"
url = "unix:/run/frr/zserv.api"
version = 6

This panic occurred after i added "accept-ipv6-ll" policy. Since gobgp does not prefere lokal link addresses:

22:19:15.189629 eth1  In  IP6 (class 0xc0, flowlabel 0x29869, hlim 1, next-header TCP (6) payload length: 424) fe80::2.179 > fe80::3.35107: Flags [P.], cksum 0x4961 (correct), seq 87:479, ack 148, win 503, options [nop,nop,TS val 1356424769 ecr 2151841832], length 392: BGP
        Update Message (2), length: 82
          Multi-Protocol Reach NLRI (14), length: 42, Flags [OE]:
            AFI: IPv4 (1), SAFI: Unicast (1)
            nexthop: 0.0.0.0, 0.0.0.0, 0.0.0.0, 0.0.0.0, 254.128.0.0, 0.0.0.0, 0.0.0.0, 0.0.0.2, nh-length: 32, no SNPA
              198.51.100.128/25
            0x0000:  0001 0120 0000 0000 0000 0000 0000 0000
            0x0010:  0000 0000 fe80 0000 0000 0000 0000 0000
            0x0020:  0000 0002 0019 c633 6480
          Origin (1), length: 1, Flags [T]: IGP
            0x0000:  00
          AS Path (2), length: 6, Flags [T]: 64497
            0x0000:  0201 0000 fbf1
        Update Message (2), length: 86
          Multi-Protocol Reach NLRI (14), length: 42, Flags [OE]:
            AFI: IPv4 (1), SAFI: Unicast (1)
            nexthop: 32.1.13.184, 0.1.0.0, 0.0.0.0, 0.0.0.1, 254.128.0.0, 0.0.0.0, 0.0.0.0, 0.0.0.1, nh-length: 32, no SNPA
              198.51.100.0/25
            0x0000:  0001 0120 2001 0db8 0001 0000 0000 0000
            0x0010:  0000 0001 fe80 0000 0000 0000 0000 0000
            0x0020:  0000 0001 0019 c633 6400
          Origin (1), length: 1, Flags [T]: IGP
            0x0000:  00
          AS Path (2), length: 10, Flags [T]: 64497 64496
            0x0000:  0202 0000 fbf1 0000 fbf0
        Update Message (2), length: 23
          End-of-Rib Marker (empty NLRI)
        Update Message (2), length: 84
          Multi-Protocol Reach NLRI (14), length: 44, Flags [OE]:
            AFI: IPv6 (2), SAFI: Unicast (1)
            nexthop: ::, fe80::2, nh-length: 32, no SNPA
              2001:db8:c0de::/48
            0x0000:  0002 0120 0000 0000 0000 0000 0000 0000
            0x0010:  0000 0000 fe80 0000 0000 0000 0000 0000
            0x0020:  0000 0002 0030 2001 0db8 c0de
          Origin (1), length: 1, Flags [T]: IGP
            0x0000:  00
          AS Path (2), length: 6, Flags [T]: 64497
            0x0000:  0201 0000 fbf1
        Update Message (2), length: 88
          Multi-Protocol Reach NLRI (14), length: 44, Flags [OE]:
            AFI: IPv6 (2), SAFI: Unicast (1)
            nexthop: 2001:db8:1::1, fe80::1, nh-length: 32, no SNPA
              2001:db8:beef::/48
            0x0000:  0002 0120 2001 0db8 0001 0000 0000 0000
            0x0010:  0000 0001 fe80 0000 0000 0000 0000 0000
            0x0020:  0000 0001 0030 2001 0db8 beef
          Origin (1), length: 1, Flags [T]: IGP
            0x0000:  00
          AS Path (2), length: 10, Flags [T]: 64497 64496
            0x0000:  0202 0000 fbf1 0000 fbf0
        Update Message (2), length: 29
          Multi-Protocol Unreach NLRI (15), length: 3, Flags [O]:
            AFI: IPv6 (2), SAFI: Unicast (1)
              End-of-Rib Marker (empty NLRI)
            0x0000:  0002 01

resulting in:

> gobgp global -a ipv6 rib
   Network              Next Hop             AS_PATH              Age        Attrs
*  ::/0                 fe80::2                                   00:03:45   [{Origin: i} {Med: 1002}]
*  2001:db8:c0de::/48   :: (should be fe80::2)                  64497                00:12:09   [{Origin: i}]
*  2001:db8:c0de::/48   2001:db8:1::1 (should be fe80::2)       64496 64497          00:12:08   [{Origin: i}]

DerDennisOP avatar Dec 12 '25 22:12 DerDennisOP