mirror of https://github.com/EdgeVPNio/evio.git
Fix double free cbt
parent
0e9ca920e6
commit
e96b91d419
|
|
@ -32,7 +32,6 @@ from .nexus import Nexus
|
|||
|
||||
|
||||
class ControllerModule:
|
||||
|
||||
__metaclass__ = ABCMeta
|
||||
|
||||
def __init__(self, nexus: Nexus, ctrl_config: dict):
|
||||
|
|
@ -135,9 +134,13 @@ class ControllerModule:
|
|||
return self._nexus.create_linked_cbt(parent)
|
||||
|
||||
def complete_cbt(self, cbt: CBT):
|
||||
if cbt.time_complete != 0.0:
|
||||
raise RuntimeError("This CBT has been previously completed.")
|
||||
self._nexus.complete_cbt(cbt)
|
||||
|
||||
def free_cbt(self, cbt: CBT):
|
||||
if cbt.time_free != 0.0:
|
||||
raise RuntimeError("This CBT has been previously freed.")
|
||||
self._nexus.free_cbt(cbt)
|
||||
|
||||
def submit_cbt(self, cbt: CBT):
|
||||
|
|
|
|||
|
|
@ -140,7 +140,6 @@ class TincanTunnel(ControllerModule):
|
|||
ctl["EVIO"]["Request"].update(log_cfg)
|
||||
self._nexus._pending_cbts[cbt.tag] = cbt
|
||||
self.send_control(json.dumps(ctl))
|
||||
self.free_cbt(cbt)
|
||||
|
||||
def resp_handler_configure_tincan_logging(self, cbt):
|
||||
if cbt.response.status == "False":
|
||||
|
|
@ -215,7 +214,7 @@ class TincanTunnel(ControllerModule):
|
|||
req["TunnelId"] = msg["TunnelId"]
|
||||
if "TapName" in msg and msg["TapName"]:
|
||||
with IPRoute() as ipr:
|
||||
idx = ipr.link_lookup(ifname="port_name")
|
||||
idx = ipr.link_lookup(ifname=msg["TapName"])
|
||||
if len(idx) > 0:
|
||||
idx = idx[0]
|
||||
ipr.link("set", index=idx, state="down")
|
||||
|
|
|
|||
|
|
@ -227,7 +227,6 @@ class NetworkOverlay:
|
|||
|
||||
|
||||
class Topology(ControllerModule):
|
||||
|
||||
_DEL_RETRY_INTERVAL = 10
|
||||
_EDGE_PROTECTION_AGE = 180
|
||||
_REFLECT: list[str] = ["_net_ovls"]
|
||||
|
|
@ -323,7 +322,7 @@ class Topology(ControllerModule):
|
|||
self.resp_handler_create_tnl(cbt)
|
||||
elif cbt.request.action in ("LNK_REMOVE_TUNNEL", "GNV_REMOVE_TUNNEL"):
|
||||
self.resp_handler_remove_tnl(cbt)
|
||||
if cbt.request.action == "_TOPOLOGY_UPDATE_":
|
||||
elif cbt.request.action == "_TOPOLOGY_UPDATE_":
|
||||
self._resp_handler_complete_topo_update(cbt)
|
||||
else:
|
||||
self.resp_handler_default(cbt)
|
||||
|
|
@ -692,10 +691,10 @@ class Topology(ControllerModule):
|
|||
ovl = self._net_ovls[olid]
|
||||
peer_id = params["PeerId"]
|
||||
if not cbt.response.status:
|
||||
ce = ovl.adjacency_list.get(peer_id)
|
||||
if ce is None:
|
||||
self.free_cbt(cbt)
|
||||
return
|
||||
# ce = ovl.adjacency_list.get(peer_id)
|
||||
# if ce is None:
|
||||
# self.free_cbt(cbt)
|
||||
# return
|
||||
self.logger.warning(
|
||||
"Failed to create topology edge to %s. %s", peer_id, cbt.response.data
|
||||
)
|
||||
|
|
@ -1045,7 +1044,7 @@ class Topology(ControllerModule):
|
|||
ce = net_ovl.adjacency_list[peer_id]
|
||||
if (
|
||||
ce.edge_state == EDGE_STATES.Connected
|
||||
and ce.edge_type in EDGE_TYPE_OUT
|
||||
and ce.role == CONNECTION_ROLE.Initiator
|
||||
and time.time() - ce.connected_time >= Topology._EDGE_PROTECTION_AGE
|
||||
):
|
||||
if (
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class UsageReport(ControllerModule):
|
|||
def process_cbt(self, cbt):
|
||||
if cbt.op_type == "Request":
|
||||
self.req_handler_default(cbt)
|
||||
else:
|
||||
elif cbt.op_type == "Response":
|
||||
if cbt.request.action == "TOP_QUERY_KNOWN_PEERS":
|
||||
self.resp_handler_query_known_peers(cbt)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue