hi, 

I am trying to re-write IP header in pyswitch using the following code 
below 

/* obtain ip header and packet for the incoming packet*. 

if packet.type == ethernet.IP_TYPE: 
      iph = packet.find('ipv4') 

/* if there is a incoming packet in port 1, rewrite the header to have 
destination ip address to "X.X.X.X" */ 

    if(inport  ==1 ):         
           iph.dstip = convert_to_ipaddr("X.X.X.X") 
           replypkt =ethernet() 
           replypkt.set_payload(iph) 
           replypkt.type = ethernet.IP_TYPE 
           replypkt.src  = octstr_to_array("00:00:00:00:00:0b") 
           replypkt.dst  = octstr_to_array("00:00:00:00:00:0d") 
           outport=3 
           inst.send_openflow_packet(dpid,replypkt.tostring(),outport) 
           print "Information in the outgoing packet" 
           ip_packet = replypkt.find('ipv4') 
           print ip_packet 
           print ip_packet.srcip 
           print ip_packet.dstip 

I extract the ip, change the dstip in ip header to X.X.X.X. A ethernet 
packet is created which will carry this IP in its payload. 
I try to perform a simple TCP connection. 

Using wireshark I am able to see a TCP syn packet arriving at port 3. A 
host whose IP is X.X.X.X attached to port 3 with ethernet address 
"00:00:00:00:00:0d" is also able to receive it. I am able to observe this 
using  tcpdump. But the host on port 3 is not generating a syn +ack packet 
in response to this syn.  Am I missing something?
_______________________________________________
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev

Reply via email to