File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 187
187
open (my $log , " < $ha_log " ) or die " Can't read $ha_log : $! " ;
188
188
seek ($log , $ha_log_size , 0) or die " Can't seek $ha_log to $ha_log_size : $! " ;
189
189
my %seen ;
190
+ my %failed_to_listen_tcp ;
190
191
while (<$log >) {
191
192
$seen {$1 }++ if / (Forwarding TCP from .*? to ((\d .*?|\[ .*?\] ):\d +|\/ [^"]+))/ ;
192
193
$seen {$1 }++ if / (Not forwarding TCP .*?:\d +)/ ;
194
+ $failed_to_listen_tcp {$2 }=$1 if / (failed to listen tcp: listen tcp (.*?:\d +):[^"]+)/ ;
193
195
}
194
196
close $log or die ;
195
197
220
222
print " 😕 Unexpected log message: $_ \n " ;
221
223
}
222
224
225
+ if (%failed_to_listen_tcp ) {
226
+ foreach (keys %failed_to_listen_tcp ) {
227
+ print " ⚠️ $failed_to_listen_tcp {$_ }\n " ;
228
+ }
229
+ my @tcp_list = keys %failed_to_listen_tcp ;
230
+ if ($Config {osname } eq " darwin" ) {
231
+ my @lsof_args = map { " -iTCP\@ $_ " } @tcp_list ;
232
+ print ` lsof -P @lsof_args ` ;
233
+ } elsif ($Config {osname } eq " linux" ) {
234
+ my @lss_args = map { " src = $_ " } @tcp_list ;
235
+ my $ss_expression = join (" or " , @lss_args );
236
+ print ` sudo ss -lnpt "$ss_expression "` ;
237
+ } elsif ($Config {osname } eq " cygwin" ) {
238
+ my @awk_args = map { " -e'/$_ /'" } @tcp_list ;
239
+ print ` netstat -aon | awk -e'/^ +Proto/' @awk_args ` ;
240
+ }
241
+ }
242
+
223
243
# Cleanup remaining netcat instances (and port forwards)
224
244
print $lima " sudo pkill -x nc" ;
225
245
You can’t perform that action at this time.
0 commit comments