These 8 lines can be replaced with 1 single line:

       return ((goodip) && (cont > 1) && (cont < 8));

If that is too cryptic, I'd propose three lines:

        if ((goodip) && (cont > 1) && (cont < 8))
            return true;
        return false;