All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 67cb051c authored by Leigh B. Stoller's avatar Leigh B. Stoller

A really twisted fix for routing from inside a lan. There is no set

way to determine the lan that both the source and nexthop are a part
of.  find_link() only works when there is a duplex link from source to
nexthop. If its a lan, do some ugly stuff.
parent b4991b11
......@@ -142,6 +142,23 @@ Node instproc add_lanlink {lanlink} {
return [expr [llength $portlist] - 1]
}
#
# Find the lan that both nodes are attached to. Very bad. If more than
# comman lan, returns the first.
#
Node instproc find_commonlan {node} {
$self instvar portlist
set match -1
foreach ll $portlist {
set match [$node find_port $ll]
if {$match != -1} {
break
}
}
return $match
}
# ip port
# ip port ip
# In the first form this returns the IP address associated with the port.
......@@ -208,12 +225,28 @@ Node instproc add_routes_to_DB {DB} {
foreach dst [lsort [array names routelist]] {
set hop $routelist($dst)
set port -1
#
# Convert hop IP address.
# Convert hop to IP address. Need to find the link between the
# the this node and the hop. This is easy if its a link. If its
# a lan, then its ugly.
#
set hopip [$hop ip [$hop find_port [$sim find_link $self $hop]]]
set hoplink [$sim find_link $self $hop]
if {$hoplink == {}} {
set port [$self find_commonlan $hop]
} else {
set port [$hop find_port $hoplink]
}
if {$port == -1} {
perror "\[add-route] Cannot find a link from $self to $hop!"
return
}
set hopip [$hop ip $port]
#
# Convert dst to IP address.
#
switch -- [$dst info class] {
"Node" {
if {[llength [$dst set portlist]] != 1} {
......@@ -232,6 +265,10 @@ Node instproc add_routes_to_DB {DB} {
set dstip [$dst get_subnet]
set type "net"
}
"Lan" {
set dstip [$dst get_subnet]
set type "net"
}
unknown {
perror "\[add-route] Bad argument. Must be a node or a link."
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment