osrg / gobgp

BGP implemented in the Go Programming Language
https://osrg.github.io/gobgp/
Apache License 2.0
3.59k stars 684 forks source link

Default policy if statement was not found #2759

Open sebasttiano opened 7 months ago

sebasttiano commented 7 months ago

Hi, everybody.

Is it correct that gobgp starts with default policies (no policies) if some set for example is missing in the config by mistake?

Part of the config:

 ........
  defined-sets:
    neighbor-sets:
      - neighbor-set-name: all_borders
         neighbor-info-list: ['10.12.3.1']
 ......
      - name: flowspec_to_universal_routers
        conditions:
          match-neighbor-set:
            neighbor-set: universal_routers                <---- missing in neighbor-sets statement
            match-set-options: any
          bgp-conditions:
            match-large-community-set:
              large-community-set: common_access_flowspec
              match-set-options: any
            afi-safi-in-list: ['ipv4-flowspec']
        actions:
          route-disposition: accept-route
          bgp-actions:
            set-large-community:
              options: remove
              set-large-community-method:
                communities-list: ['902:902:902']
   .....

For example, universal_routers is missing in the neighbor-set, this leads to an error at startup: {"Error":"not found neighbor set universal_routers","Topic":"Policy","level":"error","msg":"failed to create routing policy","time":"2024-01-17T15:19:05+01:00"}

But gobgp still runs without any policy at all, which leads to unexpected behavior

What I expect from gobgp: not to run with invalid config

fujita commented 7 months ago

Please send a pull request.