Esempio n. 1
0
    def __init__(self, net: LLNetBase):
        self.net = net
        self.local_proto_eth = ARPContext()  #Local address maps
        self.other_proto_eth = ARPContext()  #Other address maps
        self.forwarding_table = ForwardingTable(net)  #Forwarding table

        self.my_ips = [intf.ipaddr for intf in net.interfaces()]  #Local IPs

        #Load context-provided forwarding table info
        self.forwarding_table.load_file("forwarding_table.txt")

        #Cache IP->MAC mapping for local interfaces
        for intf in net.interfaces():
            self.local_proto_eth[intf.ipaddr] = intf.ethaddr
Esempio n. 2
0
    def __init__(self, net: LLNetBase):
        self._net_ = net
        self.table = {}

        #Populate table based on net object
        for intf in net.interfaces():

            net_prfx = IPv4Address(int(intf.ipaddr) & int(intf.netmask))
            network = "{}/{}".format(net_prfx, intf.netmask)
            mac_addr = intf.ethaddr

            self.add_entry(network, None, mac_addr)
Esempio n. 3
0
    def __init__(self, net: LLNetBase, size=5):
        self._net_ = net
        self.table = {}
        self.index = [None for i in range(size)]
        self.i_ptr = 0
        self.size = size

        #Populate table based on net object
        for intf in net.interfaces():

            net_prfx = IPv4Address(int(intf.ipaddr) & int(intf.netmask))
            network = "{}/{}".format(net_prfx, intf.netmask)
            mac_addr = intf.ethaddr

            self.add_entry(network, None, mac_addr, True)
Esempio n. 4
0
 def __init__(self):
     LLNetBase.__init__(self)
     self._devinfo['eth0'] = Interface('eth0', '11:22:33:44:55:66',
                                       '192.168.1.1/24', 0)
     self.lastsent = None
Esempio n. 5
0
 def __init__(self, devlist, name=None):
     LLNetBase.__init__(self)
Esempio n. 6
0
 def __init__(self):
     LLNetBase.__init__(self)
     self._devinfo['eth0'] = Interface('eth0', '11:22:33:44:55:66', '192.168.1.1', '255.255.255.0', 0)
     self.lastsent = None
Esempio n. 7
0
 def __init__(self, devlist, name=None):
     LLNetBase.__init__(self)