From: Martin Mareš Date: Fri, 21 Nov 2025 21:06:41 +0000 (+0100) Subject: show-switch: Better error handling X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=f7ca6d1fa1a536caaff8b6ac19670bb517df416c;p=jablonka.git show-switch: Better error handling --- diff --git a/show-switch b/show-switch index 9dab19c..1079000 100755 --- a/show-switch +++ b/show-switch @@ -155,7 +155,12 @@ my $port_table = my_get_table({ print "# Switch ports:\n", Dumper($port_table) if $debug; for my $port (keys %$port_table) { - my $if = $if_table->{$port_table->{$port}->{ifindex}} or die "Port table refers to unknown iface"; + my $ifi = $port_table->{$port}->{ifindex}; + my $if = $if_table->{$ifi}; + if (!$if) { + print STDERR "WARNING: Port $port refers to unknown ifindex $ifi\n"; + next; + } $if->{switch_port} = $port; }