Hi,
I want to perform 2 actions on the same incoming flow:
1. Send it to the controller
2. Send it to particular port with multiple protocol fields changed.
The code that I have is:
actions = [[openflow.OFPAT_SET_DL_DST,
"00:00:00:00:00:03"],
[openflow.OFPAT_SET_NW_DST, "10.0.0.3"],
[openflow.OFPAT_SET_TP_DST, 5000],
[openflow.OFPAT_OUTPUT, [0,outport] ],
[openflow.OFPAT_OUTPUT, [0, openflow.OFPP_CONTROLLER]]]
It gives me error that the ethernet packet with 0 length is received. Not
sure if this is the correct way to do this.
Also, which copy of the packet goes to the controller? Is it the packet
that came in or the packet that is going out (which is modified using the
actions). If my understanding is correct, then its the packet that is going
out.
Thanks and appreciate your help!!
Rohan
On Fri, Apr 13, 2012 at 4:39 PM, Rohangandhigen <[email protected]>wrote:
> Thanks Murphy, it works now!!
>
> Sent from IP 172.1.1.255
>
>
> On Apr 13, 2012, at 16:37, Murphy McCauley <[email protected]>
> wrote:
>
> > You want to use etherPkt.tostring(), not str(etherPkt).
> >
> > -- Murphy
> >
> > On Apr 13, 2012, at 9:07 AM, Rohan Gandhi wrote:
> >
> >> Hi,
> >>
> >> I am trying to send an ARP response, but on the receiver I can see the
> ASCII for the src/dst addresses instead of binary.
> >>
> >> The following is my code:
> >>
> >> from nox.lib.packet.ethernet import ethernet
> >>
> >> mysrc = "11:11:11:11:11:11"
> >> mydst = "01:02:03:04:05:06"
> >>
> >> etherPkt = ethernet()
> >> etherPkt.set_payload(arpResponse)
> >> etherPkt.type = ethernet.ARP_TYPE
> >> etherPkt.src = octstr_to_array(mysrc) #mysrc
> >> etherPkt.dst = octstr_to_array(mydst) #mysrc
> >>
> >> # log.debug("ether pkt %s" % str(etherPkt))
> >>
> >> self.send_openflow_packet(dp, str(etherPkt), inport)
> >>
> >> on the receiver, the tcpdump shows me the received packet as:
> >>
> >> 21:34:35.677597 3a:31:31:3a:31:31 (oui Unknown) > 5b:31:31:3a:31:31
> (oui Unknown), ethertype Unknown (0x3a31), length 41:
> >> 0x0000: 5b31 313a 3131 3a31 313a 3131 3a31 313a
> [11:11:11:11:11:
> >> 0x0010: 3131 3e30 313a 3032 3a30 333a 3034 3a30
> 11>01:02:03:04:0
> >> 0x0020: 353a 3036 3a41 5250 5d 5:06:ARP]
> >>
> >> where I get ASCII instead of byte values for all the header fields (and
> also for the character ":"). I am guessing the problem might be while
> converting to string and I might be doing something silly. Can someone
> please help me in sending the correct bytes instead of the ASCII?
> >>
> >> Thanks!!
> >> Rohan
> >
>