示例#1
0
文件: tftpcfg.py 项目: sharad/rc
def make_subnet(clientipaddress, clientmask):
    "Returns a subnet string"
    if clientmask != "32":
        broadcast_address, network_address = ipv4.parse(clientipaddress, clientmask)
        return network_address
    else:
        return clientipaddress
示例#2
0
def make_subnet(clientipaddress, clientmask):
    "Returns a subnet string"
    if clientmask != "32":
        broadcast_address, network_address = ipv4.parse(clientipaddress, clientmask)
        return network_address
    else:
        return clientipaddress
示例#3
0
文件: tftpcfg.py 项目: sharad/rc
def validate_listenipaddress(listenipaddress):
    """Check listenipaddress"""
    if not listenipaddress or listenipaddress == "0.0.0.0":
        return True, None
    broadcast_address, network_address = ipv4.parse(listenipaddress, 32)
    if not broadcast_address:
        return False, "Server listen ip address is not valid"
    return True, None
示例#4
0
def validate_listenipaddress(listenipaddress):
    """Check listenipaddress"""
    if not listenipaddress or listenipaddress == "0.0.0.0":
        return True, None
    broadcast_address, network_address = ipv4.parse(listenipaddress, 32)
    if not broadcast_address:
        return False, "Server listen ip address is not valid"
    return True, None
示例#5
0
文件: tftpcfg.py 项目: sharad/rc
def validate_client_ip_mask(clientipaddress, clientmask):
    """Check clientipaddress and clientmask"""
    broadcast_address, network_address = ipv4.parse(clientipaddress, clientmask)
    if not broadcast_address:
        return False, "Client ip address and mask do not make a valid subnet"
    return True, None
示例#6
0
def validate_client_ip_mask(clientipaddress, clientmask):
    """Check clientipaddress and clientmask"""
    broadcast_address, network_address = ipv4.parse(clientipaddress, clientmask)
    if not broadcast_address:
        return False, "Client ip address and mask do not make a valid subnet"
    return True, None