Fix #423: Shield against empty array access after dead peer

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
Lee Smet committed 2024-10-02 10:27:37 +02:00
1 parent 896852b069
commit a0a86ffbf2
2 files changed
+11 -4

No files matched your search

+8 -3
View File
@@ -7,18 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- Fix a panic in the route cleanup task when a peer dies who is the last stored
announcer of a subnet.
## [0.5.5] - 2024-09-27
### Added
- Mycelium-ui, a standalone GUI which exposes (part of) the mycelium API. This
does __not__ have a bundled mycelium node, so that needs to be run separately.
does **not** have a bundled mycelium node, so that needs to be run separately.
### Changed
- Default TUN name on Linux and Windows is now `mycelium`. On MacOS it is now `utun0`.
- TUN interface name validation on MacOS. If the user supplies an invalid or already
taken interface name, an available interface name will be automatically assigned.
taken interface name, an available interface name will be automatically assigned.
### Fixed
+3 -1
View File
@@ -372,6 +372,8 @@ where
// If there is no selected route there is nothing to do here. We keep expired routes in the
// table for a while so updates of those should already have propagated to peers.
let route_list = routes.routes();
// If we have a new selected route we must have at least 1 item in the route list so
// accessing the 0th list element here is fine.
if let Some(new_selected) = self.find_best_route(&route_list).cloned() {
if new_selected.neighbour() == route_list[0].neighbour() && route_list[0].selected() {
debug!(
@@ -389,7 +391,7 @@ where
}
routes.set_selected(new_selected.neighbour());
} else if route_list[0].selected() {
} else if !route_list.is_empty() && route_list[0].selected() {
// This means we went from a selected route to a non-selected route. Unselect route and
// trigger update.
// At this point we also send a seqno request to all peers which advertised this route