Function to check whether a given IP is in a given subnet

A little function to check whether the given IP belongs to a given subnet.