def ip_to_int(ip):
    """
    >>> ip_to_int(None)
    0
    >>> ip_to_int('0.0.0.0')
    0
    >>> ip_to_int('1.2.3.4')
    16909060
    """
    if ip is None:
        return 0
    result = 0
    for part in ip.split('.'):
        result = (result << 8) + int(part)
    return result