Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bio-rd
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
bio-rd
Commits
e12b31e4
Commit
e12b31e4
authored
7 years ago
by
Christoph Petrausch
Browse files
Options
Downloads
Patches
Plain Diff
Don't announce own ASN in ASPath if iBGP
parent
1337ccc9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
protocols/bgp/server/update_sender.go
+14
-3
14 additions, 3 deletions
protocols/bgp/server/update_sender.go
protocols/bgp/server/update_sender_add_path.go
+5
-4
5 additions, 4 deletions
protocols/bgp/server/update_sender_add_path.go
with
19 additions
and
7 deletions
protocols/bgp/server/update_sender.go
+
14
−
3
View file @
e12b31e4
...
...
@@ -15,18 +15,20 @@ import (
// UpdateSender converts table changes into BGP update messages
type
UpdateSender
struct
{
routingtable
.
ClientManager
fsm
*
FSM
fsm
*
FSM
iBGP
bool
}
func
newUpdateSender
(
fsm
*
FSM
)
*
UpdateSender
{
return
&
UpdateSender
{
fsm
:
fsm
,
fsm
:
fsm
,
iBGP
:
fsm
.
localASN
==
fsm
.
remoteASN
,
}
}
// AddPath serializes a new path and sends out a BGP update message
func
(
u
*
UpdateSender
)
AddPath
(
pfx
net
.
Prefix
,
p
*
route
.
Path
)
error
{
asPathPA
,
err
:=
packet
.
ParseASPathStr
(
strings
.
TrimRight
(
fmt
.
Sprintf
(
"%d %s"
,
u
.
fsm
.
localASN
,
p
.
BGPPath
.
ASPath
)
,
" "
)
)
asPathPA
,
err
:=
packet
.
ParseASPathStr
(
asPathString
(
u
.
iBGP
,
u
.
fsm
.
localASN
,
p
.
BGPPath
.
ASPath
))
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Unable to parse AS path: %v"
,
err
)
}
...
...
@@ -74,3 +76,12 @@ func (u *UpdateSender) UpdateNewClient(client routingtable.RouteTableClient) err
log
.
Warningf
(
"BGP Update Sender: UpdateNewClient() not supported"
)
return
nil
}
func
asPathString
(
iBGP
bool
,
localASN
uint16
,
asPath
string
)
string
{
ret
:=
""
if
iBGP
{
ret
=
ret
+
fmt
.
Sprintf
(
"%d "
,
localASN
)
}
ret
=
ret
+
asPath
return
strings
.
TrimRight
(
ret
,
" "
)
}
This diff is collapsed.
Click to expand it.
protocols/bgp/server/update_sender_add_path.go
+
5
−
4
View file @
e12b31e4
...
...
@@ -2,7 +2,6 @@ package server
import
(
"fmt"
"strings"
log
"github.com/sirupsen/logrus"
...
...
@@ -15,18 +14,20 @@ import (
// UpdateSenderAddPath converts table changes into BGP update messages with add path
type
UpdateSenderAddPath
struct
{
routingtable
.
ClientManager
fsm
*
FSM
fsm
*
FSM
iBGP
bool
}
func
newUpdateSenderAddPath
(
fsm
*
FSM
)
*
UpdateSenderAddPath
{
return
&
UpdateSenderAddPath
{
fsm
:
fsm
,
fsm
:
fsm
,
iBGP
:
fsm
.
localASN
==
fsm
.
remoteASN
,
}
}
// AddPath serializes a new path and sends out a BGP update message
func
(
u
*
UpdateSenderAddPath
)
AddPath
(
pfx
net
.
Prefix
,
p
*
route
.
Path
)
error
{
asPathPA
,
err
:=
packet
.
ParseASPathStr
(
strings
.
TrimRight
(
fmt
.
Sprintf
(
"%d %s"
,
u
.
fsm
.
localASN
,
p
.
BGPPath
.
ASPath
)
,
" "
)
)
asPathPA
,
err
:=
packet
.
ParseASPathStr
(
asPathString
(
u
.
iBGP
,
u
.
fsm
.
localASN
,
p
.
BGPPath
.
ASPath
))
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Unable to parse AS path: %v"
,
err
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment