sHoM 0 Newbie Poster

I am creating a network bridge that connects two ethernet cards on the same machine. One of the cards is connected to the LAN and the other is connected to a network device. It looks something like this, Click Here

I am sniffing packets on both the interfaces and then sending them to the other using

sendp(x,iface='eth0')

for a packet that I sniffed on eth1 and vice versa.

I verified the packets at both the interfaces and found them to be correct, but somehow I am unable to get an IP for the device. Below is a piece of my code, I create two threads, one for each interface:

from scapy.all import*

**THREAD1:**
pkt=sniff(iface="eth0",store=1,count=1)
outbuff=[]
outbuff+=pkt[:]
for src in outbuff[:]
    srcmac=src.sprintf(r"%Ether.src%")
    if dstmac==deviceMAC or dstmac=="ff:ff:ff:ff:ff:ff":
        sendp(self.outbuff[:],iface="eth1",verbose=0)
    else:
        pass

**THREAD2:**
pkt=sniff(iface="eth1",store=1,count=1)
outbuff=[]
outbuff+=pkt[:]
for src in outbuff[:]
    srcmac=src.sprintf(r"%Ether.src%")
    if srcmac==deviceMAC:
        sendp(self.outbuff[:],iface="eth0",verbose=0)
    else:
        pass

I see that the DHCP ACK doesnot cross the bridge and hence the entire system doesn't work. I have even tried using sockets to connect the two interface cards but it fails to provide a solution. Can someone suggest wheter there is bug in the code or is the algorithm implemented faulty.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.