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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
bio-rd
Commits
5378049b
Unverified
Commit
5378049b
authored
Jun 26, 2018
by
Daniel Czerwonk
Committed by
GitHub
Jun 26, 2018
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into feature/unknown_attr_pass
parents
cd68c8be
a5b7e046
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
protocols/bgp/server/fsm_established.go
+1
-0
1 addition, 0 deletions
protocols/bgp/server/fsm_established.go
route/bgp_path.go
+29
-1
29 additions, 1 deletion
route/bgp_path.go
routingtable/adjRIBOut/adj_rib_out.go
+11
-9
11 additions, 9 deletions
routingtable/adjRIBOut/adj_rib_out.go
with
41 additions
and
10 deletions
protocols/bgp/server/fsm_established.go
+
1
−
0
View file @
5378049b
...
...
@@ -217,6 +217,7 @@ func (s *establishedState) updates(u *packet.BGPUpdate) {
Type
:
route
.
BGPPathType
,
BGPPath
:
&
route
.
BGPPath
{
Source
:
bnet
.
IPv4ToUint32
(
s
.
fsm
.
peer
.
addr
),
EBGP
:
s
.
fsm
.
peer
.
localASN
!=
s
.
fsm
.
peer
.
peerASN
,
},
}
...
...
...
...
This diff is collapsed.
Click to expand it.
route/bgp_path.go
+
29
−
1
View file @
5378049b
...
...
@@ -41,6 +41,9 @@ func (b *BGPPath) Compare(c *BGPPath) int8 {
return
-
1
}
// 9.1.2.2. Breaking Ties (Phase 2)
// a)
if
c
.
ASPathLen
>
b
.
ASPathLen
{
return
1
}
...
...
@@ -49,6 +52,7 @@ func (b *BGPPath) Compare(c *BGPPath) int8 {
return
-
1
}
// b)
if
c
.
Origin
>
b
.
Origin
{
return
1
}
...
...
@@ -57,6 +61,7 @@ func (b *BGPPath) Compare(c *BGPPath) int8 {
return
-
1
}
// c)
if
c
.
MED
>
b
.
MED
{
return
1
}
...
...
@@ -65,6 +70,18 @@ func (b *BGPPath) Compare(c *BGPPath) int8 {
return
-
1
}
// d)
if
c
.
EBGP
&&
!
b
.
EBGP
{
return
-
1
}
if
!
c
.
EBGP
&&
b
.
EBGP
{
return
1
}
// e) TODO: interiour cost (hello IS-IS and OSPF)
// f)
if
c
.
BGPIdentifier
<
b
.
BGPIdentifier
{
return
1
}
...
...
@@ -73,6 +90,7 @@ func (b *BGPPath) Compare(c *BGPPath) int8 {
return
-
1
}
// g)
if
c
.
Source
<
b
.
Source
{
return
1
}
...
...
@@ -144,6 +162,7 @@ func (b *BGPPath) better(c *BGPPath) bool {
return
false
}
// Print all known information about a route in human readable form
func
(
b
*
BGPPath
)
Print
()
string
{
origin
:=
""
switch
b
.
Origin
{
...
...
@@ -154,20 +173,29 @@ func (b *BGPPath) Print() string {
case
2
:
origin
=
"IGP"
}
bgpType
:=
"internal"
if
b
.
EBGP
{
bgpType
=
"external"
}
ret
:=
fmt
.
Sprintf
(
"
\t\t
Local Pref: %d
\n
"
,
b
.
LocalPref
)
ret
+=
fmt
.
Sprintf
(
"
\t\t
Origin: %s
\n
"
,
origin
)
ret
+=
fmt
.
Sprintf
(
"
\t\t
AS Path: %v
\n
"
,
b
.
ASPath
)
ret
+=
fmt
.
Sprintf
(
"
\t\t
BGP type: %s
\n
"
,
bgpType
)
nh
:=
uint32To4Byte
(
b
.
NextHop
)
ret
+=
fmt
.
Sprintf
(
"
\t\t
NEXT HOP: %d.%d.%d.%d
\n
"
,
nh
[
0
],
nh
[
1
],
nh
[
2
],
nh
[
3
])
ret
+=
fmt
.
Sprintf
(
"
\t\t
MED: %d
\n
"
,
b
.
MED
)
ret
+=
fmt
.
Sprintf
(
"
\t\t
Path ID: %d
\n
"
,
b
.
PathIdentifier
)
ret
+=
fmt
.
Sprintf
(
"
\t\t
Source: %d
\n
"
,
b
.
Source
)
src
:=
uint32To4Byte
(
b
.
Source
)
ret
+=
fmt
.
Sprintf
(
"
\t\t
Source: %d.%d.%d.%d
\n
"
,
src
[
0
],
src
[
1
],
src
[
2
],
src
[
3
])
ret
+=
fmt
.
Sprintf
(
"
\t\t
Communities: %v
\n
"
,
b
.
Communities
)
ret
+=
fmt
.
Sprintf
(
"
\t\t
LargeCommunities: %v
\n
"
,
b
.
LargeCommunities
)
return
ret
}
// Prepend the given BGPPath with the given ASN given times
func
(
b
*
BGPPath
)
Prepend
(
asn
uint32
,
times
uint16
)
{
if
times
==
0
{
return
...
...
...
...
This diff is collapsed.
Click to expand it.
routingtable/adjRIBOut/adj_rib_out.go
+
11
−
9
View file @
5378049b
...
...
@@ -58,9 +58,6 @@ func (a *AdjRIBOut) AddPath(pfx bnet.Prefix, p *route.Path) error {
p
=
p
.
Copy
()
if
!
a
.
neighbor
.
IBGP
&&
!
a
.
neighbor
.
RouteServerClient
{
p
.
BGPPath
.
Prepend
(
a
.
neighbor
.
LocalASN
,
1
)
}
if
!
a
.
neighbor
.
IBGP
&&
!
a
.
neighbor
.
RouteServerClient
{
p
.
BGPPath
.
NextHop
=
a
.
neighbor
.
LocalAddress
}
...
...
@@ -114,14 +111,19 @@ func (a *AdjRIBOut) RemovePath(pfx bnet.Prefix, p *route.Path) bool {
}
a
.
rt
.
RemovePath
(
pfx
,
p
)
// If the neighbar has AddPath capabilities, try to find the PathID
if
a
.
neighbor
.
CapAddPathRX
{
pathID
,
err
:=
a
.
pathIDManager
.
releasePath
(
p
)
if
err
!=
nil
{
log
.
Warningf
(
"Unable to release path
: %v"
,
err
)
log
.
Warningf
(
"Unable to release path
for prefix %s: %v"
,
pfx
.
String
()
,
err
)
return
true
}
p
=
p
.
Copy
()
p
.
BGPPath
.
PathIdentifier
=
pathID
}
a
.
removePathFromClients
(
pfx
,
p
)
return
true
}
...
...
...
...
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
sign in
to comment