Hi, You need to set the length field in the Ipv4 packet.
ipv4_packet.iplen = ipv4.MIN_LEN + udp_packet.len() should do the trick. Aaron On Thu, Jan 26, 2012 at 1:42 PM, Bernd Wittefeld <s9bew...@stud.uni-saarland.de> wrote: > Hi, > I have a python component and want to create an udp packet in the controller > and send it out via "self.send_openflow_packet(dpid, packet.tostring(), > outport)" > > First of all: a small bugfix is needed: > nox/src/nox/lib/packet/packet_base.py needs an "import array". Without that, > the set_payload function raises an exception as it does not find > array.array. > > Now I create my packet the following way: > > from nox.lib.packet.udp import udp > from nox.lib.packet.ipv4 import ipv4 > from nox.lib.packet.ethernet import ethernet > > udp_packet = udp() > udp_packet.srcport = 12345 > udp_packet.dstport = 4711 > rand = random.random() > udp_packet.set_payload(str(rand)) > udp_packet.csum = udp_packet.checksum() > > ipv4_packet = ipv4() > ipv4_packet.set_payload(udp_packet) > ipv4_packet.srcip = ipstr_to_int(CONTROLLER_IP) > ipv4_packet.dstip = ipstr_to_int(CONTROLLER_IP) > ipv4_packet.csum = ipv4_packet.checksum() > > eth_packet = ethernet() > eth_packet.src = CONTROLLER_MAC > eth_packet.dst = CONTROLLER_MAC > eth_packet.set_payload(ipv4_packet) > eth_packet.type = ethernet.IP_TYPE > > and send this then via self.send_openflow_packet > > The packet goes out the link and is forwarded (via a flow on another switch) > back to the controller where I can see it in my packet_in handler. > The only problem is: the packet only consists of the link layer (ethernet > type) header and the ipv4 type header. The payload of the ipv4 packet (which > should be my udp header and the payload) is completely missing. From the > ipv4 class, the ipv4.next is None and I can also verify with wireshark that > the packet that is transmitted from the controller to the switch encapsuled > in an OpenFlow packet, consists only of the ethernet header and the ipv4 > header. > Am I missing something? Where is this going wrong? > I tried to look at the send_openflow_packet function. It seems to somehow > call self.ctxt.send_openflow_packet_port in nox/src/nox/lib/core.py which I > could not find?! > I am not into Swig and all that stuff, so I am stuck here :( > > Any help is greatly appreciated! > > > Best regards > > Bernd > > _______________________________________________ > nox-dev mailing list > nox-dev@noxrepo.org > http://noxrepo.org/mailman/listinfo/nox-dev -- Aaron O. Rosen Masters Student - Network Communication 306B Fluor Daniel _______________________________________________ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev