This will work fro the docs:
sudo ufw allow proto tcp from 192.168.0.2 to any port 22
But..will this work?
sudo ufw allow proto tcp from foo.bar.com to any port 22
I am using ubuntu 12.04
Apparently not
sudo ufw allow proto tcp from 192.168.254.13 to any port 22
Rule added
then
sudo ufw allow proto tcp from foo.bar.com to any port 22
ERROR: Bad source address
UFW is just a front end no netfilter/iptables which will take a name and convert it to an address however this is not good practice as the name is only resolved when the rule is added and changes are not notified to netfilter.