Auto shutdown plugin review for ipv4-mapped ipv6 address in port check

  • hi,


    Is anyone able to review: https://github.com/OpenMediaVa…ault-autoshutdown/pull/66


    This pull request adds support for ipv4-mapped, ipv6 address as the 'ss -n' command will display the ipv4-mapped address as '[::ffff:<ipv4 address>]:<port>' rather than just an ipv4 address. Also in such an instance the connection addresses will be similarly formatted and must be adjusted.


    This pull request additionally cleanup connection output so all of the ipv4 connection addresses are presented for a port.


    The change allow Docker containers with host networking setup to be correctly detected by the auto-shutdown plugin. This is required as Docker set-up ipv4-mapped address so that it can easily support both ipv6 and ipv4 port bindings. if 'netstat' is used it report ipv4-mapped port in standard ipv4 format, however, 'ss -n' detects the ipv4-mapped port and reports it in ipv6 format. hence the above pull request.


    To test the pull request, if you got autoshutdown installed you can just simply replace your '/usr/sbin/autoshutdown.sh 'with the one in the pull request and restart the autoshutdown service. (make sure you back up you old 'autoshutdown.sh' file first to be restored after testing). the script should work as before, but now be able to work with ipv4-mapped addresses and tell you all the IP connected to the configured ports the autoshutdown is watching.


    Thanks in advance


    Happy testing.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!