Calculate correct netmask

I've added a netmask cidr calculator function from here: http://www.linuxquestions.org/questions/programming-9/bash-cidr-calculator-646701/

Just tested this on Digital Ocean system and it works. The netmask is set correctly after the reboot and networking works.
Merge pull request #2 from Red5d/patch-1

Calculate correct netmask in case prefixlen is not 24, 20, or 16