Skip to content

Commit

Permalink
update cur library version to support mulitprotocol bgp implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcoles committed Jun 19, 2024
1 parent ac4be1a commit 9b01a44
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ type Config struct {
Interfaces []string `json:"interfaces,omitempty"`
}

func (c *Config) bgp(asn uint16) map[string]bgp.Parameters {
func (c *Config) bgp(asn uint16, mp bool) map[string]bgp.Parameters {
if asn > 0 {
return map[string]bgp.Parameters{"127.0.0.1": bgp.Parameters{ASNumber: asn, HoldTime: 4}}
return map[string]bgp.Parameters{"127.0.0.1": bgp.Parameters{ASNumber: asn, HoldTime: 4, Multiprotocol: mp}}
}

return c.BGP
Expand Down
2 changes: 1 addition & 1 deletion cmd/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module vc5
go 1.19

require (
github.com/davidcoles/cue v0.0.13
github.com/davidcoles/cue v0.1.1
github.com/davidcoles/xvs v0.1.15
github.com/elastic/go-elasticsearch/v7 v7.17.10
)
Expand Down
4 changes: 2 additions & 2 deletions cmd/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/davidcoles/cue v0.0.13 h1:7fsH9he0s9R5Yk05GvKuGH7HtJ4xGFsVTuFp4NnUKpw=
github.com/davidcoles/cue v0.0.13/go.mod h1:uUTkCvlkD+nqbmP9XyA63BGMW3g3JJRYC0q8vJKSXMc=
github.com/davidcoles/cue v0.1.1 h1:R2hG4gSVKuCj7UmTQGhZS/ZRmfDULqmA03uXwx7rgOg=
github.com/davidcoles/cue v0.1.1/go.mod h1:26FTBytVHJ1XQWOGC+Cfnx4Q9xV8k1xr6K5uZ7s/EBw=
github.com/davidcoles/xvs v0.1.15 h1:FJ5CN0VEqyoilK/R0Pvc51lKpLsOTqcstPilkkxgbZw=
github.com/davidcoles/xvs v0.1.15/go.mod h1:NQg6Ob9zLr49qH3I6E6zqnGp4tVBu4cT/3vXUB2XA8w=
github.com/elastic/go-elasticsearch/v7 v7.17.10 h1:TCQ8i4PmIJuBunvBS6bwT2ybzVFxxUhhltAs3Gyu1yo=
Expand Down
13 changes: 7 additions & 6 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,14 @@ func main() {
sock := flag.String("s", "", "socket") // used internally
addr := flag.String("a", "", "address")
native := flag.Bool("n", false, "Native mode XDP")
asn := flag.Uint("A", 0, "Autonomous system number for loopback peer") // experimental - may change
delay := flag.Uint("D", 0, "Delay between initialisaton of interfaces") // experimental - may change
flows := flag.Uint("F", 0, "Set maximum number of flows") // experimental - may change
asn := flag.Uint("A", 0, "Autonomous system number to enable loopback BGP") // experimental - may change
mp := flag.Bool("M", false, "Use multiprotocol extensions on loopback BGP") // experimental - may change
delay := flag.Uint("D", 0, "Delay between initialisaton of interfaces") // experimental - may change
flows := flag.Uint("F", 0, "Set maximum number of flows") // experimental - may change

// Changing number of flows will only work on some kernels
// Not supported: 5.4.0-171-generic
// Supported: 5.15.0-112-generic
// Supported: 5.15.0-112-generic, 6.6.28+rpt-rpi-v7

flag.Parse()

Expand Down Expand Up @@ -175,7 +176,7 @@ func main() {
routerID = [4]byte{127, 0, 0, 1}
}

pool := bgp.NewPool(routerID, config.bgp(uint16(*asn)), nil, logs.sub("bgp"))
pool := bgp.NewPool(routerID, config.bgp(uint16(*asn), *mp), nil, logs.sub("bgp"))

if pool == nil {
log.Fatal("BGP pool fail")
Expand Down Expand Up @@ -456,7 +457,7 @@ func main() {
config = conf
client.UpdateVLANs(config.vlans())
director.Configure(config.parse())
pool.Configure(config.bgp(uint16(*asn)))
pool.Configure(config.bgp(uint16(*asn), *mp))
mutex.Unlock()
} else {
logs.ALERT(F, "Couldn't load config file:", file, err)
Expand Down

0 comments on commit 9b01a44

Please sign in to comment.