Closed nrandon closed 4 years ago
@nrandon Sorry but if you look at the other pull requests for this plugin, I am the worst one to merge or review this. There is a lot of behavior changing that I can't test. I wish someone else would maintain this plugin who actually uses it.
@ryecoaaron is there anyone that can review this, as caring the change locally is not a grate solution ?
not ment to close
@nrandon I would ask on the forum. I'm not sure who could review it.
I tested this change and I think it is correct.
Output of ss -n | grep ESTAB
tcp ESTAB 0 0 [::ffff:192.168.178.25]:80 [::ffff:192.168.178.53]:52845
The new regex:
ss -n | awk -v regex="^([[]::ffff:)?192.168.178.25[]]?:80$" '$2 ~ /^ESTAB$/ && $5 ~ regex'
catches this:
tcp ESTAB 0 0 [::ffff:192.168.178.25]:80 [::ffff:192.168.178.53]:52845
tcp ESTAB 0 0 [::ffff:192.168.178.25]:80 [::ffff:192.168.178.53]:52844
The old one does not and is useless with debian buster even if ipv6 is disabled
I tested this change too. The Output on my installation is:
tcp ESTAB 0 0 [::ffff:192.168.1.89]:80 [::ffff:192.168.1.21]:54264
This is the result in /var/log/autoshutdown.log
_check_net_status(): Found active connection on port 80 (HTTP) from 192.168.1.21
I think, the result is correct.
@ryecoaaron now this has been reviewed and tested independently can it be merged ?
Add support for ipv4-mapped ipv6 address as the 'ss -n' command will display the ipv4-mapped address as '[::ffff:<ipv4 address]:'
rather than just an ipv4 address. Also in such an instance the
connection addresses will be similarly formatted and must be adjusted.
Additionally cleanup connection output so all of the ipv4 connection addresses are presented for a port.