def natAndSend(self,packet,port):
# NAT for first packet - This removes the need to dynamically add the 3rd rule (Controller Rule)
# A static rule in P4 now sends packets received back form the controller out the external port.
packet[IP].src = self.router_ext_ip
packet[TCP].sport = port
# Recalculate checksum Scapy way?
del packet[IP].chksum
del packet[TCP].chksum
packet = packet.__class__(str(packet))
# packet already processed so don't process again - resubmit so reason won't be valid anymore
new_p_str = '\x00' * 6 + str(packet)
#print "threading.active_count " + str(threading.active_count())
s = conf.L2socket(iface=self.controller_port)
# sendp(new_p_str, iface=self.controller_port, verbose=0)
s.send(new_p_str)
print port
评论列表
文章目录