Skip to content

Commit b4b2799

Browse files
committed
Fix: Mark phantom links used to create multihop EBGP sessions
The ebgp.multihop plugin creates bogus ('phantom' sounds so much better) links to persuade the BGP module to establish BGP sessions between endpoints of multihop EBGP sessions. Unfortunately, other modules (in particular 'routing.static') find those links and want to use them. With this change, ebgp.multihop plugin marks the interfaces attached to those links with the '_phantom_link' flag, and the nexthop resolution for static routes avoids those interfaces. At the moment, the bogus static route next hops seem to be the only undesired side effect of those phantom links, but of course something else is bound to pop up eventually :( Fixes #2414
1 parent b239d6c commit b4b2799

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

netsim/extra/ebgp.multihop/plugin.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def pre_link_transform(topology: Box) -> None:
8383
if 'vrf' in intf:
8484
intf.bgp._vrf = intf.vrf
8585
intf._bgp_session = True
86+
intf._phantom_link = True
8687
intf.ifname = f'_ebgp_multihop_{s.linkindex}'
8788

8889
topology.links.extend(sessions)

netsim/modules/routing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,8 @@ def resolve_node_nexthop(sr_data: Box, node: Box, topology: Box) -> Box:
829829

830830
node_found = False
831831
for intf in node.interfaces:
832+
if intf.get('_phantom_link',False):
833+
continue
832834
for ngb in intf.neighbors:
833835
if ngb.node != sr_data.nexthop.node:
834836
continue

tests/topology/expected/ebgp.utils.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ bgp:
1313
password: Funny
1414
interfaces:
1515
- _bgp_session: true
16+
_phantom_link: true
1617
bgp:
1718
local_as: 123
1819
multihop: 255
@@ -21,6 +22,7 @@ bgp:
2122
ipv4: 10.0.0.2/32
2223
node: r2
2324
- _bgp_session: true
25+
_phantom_link: true
2426
bgp:
2527
local_as: 456
2628
multihop: 255

0 commit comments

Comments
 (0)