Skip to content

Commit

Permalink
Merge pull request #194 from zachomedia/feat-next-hop-self
Browse files Browse the repository at this point in the history
feat: Add peer settings for `next-hop-self-ebgp` and `next-hop-self-ibgp`
  • Loading branch information
natesales authored Oct 22, 2023
2 parents a46aa31 + 14208cf commit bda0448
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,22 @@ Should BGP next-hop-self be enabled?
|------|---------|------------|
| bool | false | |

### `next-hop-self-ebgp`

Should BGP next-hop-self for eBGP be enabled?

| Type | Default | Validation |
|------|---------|------------|
| bool | false | |

### `next-hop-self-ibgp`

Should BGP next-hop-self for iBGP be enabled?

| Type | Default | Validation |
|------|---------|------------|
| bool | false | |

### `bfd`

Should BFD be enabled?
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ type Peer struct {
Passive *bool `yaml:"passive" description:"Should we listen passively?" default:"false"`
Direct *bool `yaml:"direct" description:"Specify that the neighbor is directly connected" default:"false"`
NextHopSelf *bool `yaml:"next-hop-self" description:"Should BGP next-hop-self be enabled?" default:"false"`
NextHopSelfEBGP *bool `yaml:"next-hop-self-ebgp" description:"Should BGP next-hop-self for eBGP be enabled?" default:"false"`
NextHopSelfIBGP *bool `yaml:"next-hop-self-ibgp" description:"Should BGP next-hop-self for iBGP be enabled?" default:"false"`
BFD *bool `yaml:"bfd" description:"Should BFD be enabled?" default:"false"`
Password *string `yaml:"password" description:"BGP MD5 password" default:"-"`
RSClient *bool `yaml:"rs-client" description:"Should this peer be a route server client?" default:"false"`
Expand Down
2 changes: 2 additions & 0 deletions pkg/embed/templates/peer.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ protocol bgp {{ UniqueProtocolName $peer.ProtocolName $peerName $af $peer.ASN $p
{{ end }}

{{ if BoolDeref $peer.NextHopSelf }}next hop self;{{ end }}
{{ if BoolDeref $peer.NextHopSelfEBGP }}next hop self ebgp;{{ end }}
{{ if BoolDeref $peer.NextHopSelfIBGP }}next hop self ibgp;{{ end }}
{{ if BoolDeref $peer.AddPathTx }}add paths tx;{{ end }}
{{ if BoolDeref $peer.AddPathRx }}add paths rx;{{ end }}
{{ if BoolDeref $peer.AdvertiseHostname }}advertise hostname on;{{ end }}
Expand Down
16 changes: 16 additions & 0 deletions tests/generate-complex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,19 @@ peers:
65510,20,30: 300
tags:
- ixp

Internal:
neighbors:
- 192.0.2.3
- 2001:db8::3
asn: 65530
announce-all: true
filter-irr: false
filter-rpki: false
filter-bogon-asns: false
filter-bogon-routes: false
filter-blocklist: false
filter-prefix-length: false
enforce-first-as: false
enforce-peer-nexthop: false
next-hop-self-ebgp: true

0 comments on commit bda0448

Please sign in to comment.