I would like to have the default behavior of the pyswitch for those packets.
I just want to filter out TCP/UDP packets and change flows based on it? Are
you suggesting that I only run the custom function after detecting the
TCP/UDP packet and for other packets let the flow get installed?

On Mon, Nov 29, 2010 at 12:32 AM, kk yap <yap...@stanford.edu> wrote:

> Simple question, what do you do for packet without UDP/TCP port?  Like
> ICMP, ARP, etc?  That logic seems missing.
>
> Regards
> KK
>
> On 28 November 2010 16:22, K Singh <kavites...@gmail.com> wrote:
> > Hi,
> >
> > I modified the code below for function def forward_l2_packet(...) in
> > pyswitch.py.
> >
> > def forward_l2_packet(dpid, inport, packet, buf, bufid):
> >
> >     dstaddr = packet.dst.tostring()
> >     if not ord(dstaddr[0]) & 1 and inst.st[dpid].has_key(dstaddr):
> >         prt = inst.st[dpid][dstaddr]
> >         if  prt[0] == inport:
> >             log.err('**warning** learned port = inport',
> system="pyswitch")
> >             inst.send_openflow(dpid, bufid, buf, openflow.OFPP_FLOOD,
> > inport)
> >         else:
> >             # We know the outport, set up a flow
> >             log.msg('installing flow for ' + str(packet),
> system="pyswitch")
> >             flow = extract_flow(packet)
> >             flow[core.IN_PORT] = inport
> >             actions = [[openflow.OFPAT_OUTPUT, [0, prt[0]]]]
> >             # openflow.OFP_FLOW_PERMANENT
> >             renewflag = flowpacketdecision(dpid, flow, packet, inport,
> buf)
> >             print "renewflag",renewflag
> >             #print packet
> >             if renewflag == 1:
> >                 inst.install_datapath_flow(dpid, flow, CACHE_TIMEOUT,5,
> > actions,bufid, openflow.OFP_DEFAULT_PRIORITY,inport, buf)
> >
> >     else:
> >         # haven't learned destination MAC. Flood
> >         inst.send_openflow(dpid, bufid, buf, openflow.OFPP_FLOOD, inport)
> >
> >
> > The red highlighted part is where i made changes. I am making decision on
> > setting flow based on port numbers whose logic is in
> > flowpacketdecision(...). If the function returns 1 i renew or set the
> flow
> > else i reject the packet and wait for another packet to come.
> >
> > But this logic, fails for ARP packet. Because in my
> flowpacketdecision(..) i
> > am checking for TCP/UDP packet and renewing/setting the flow. If i
> receive
> > ARP packet then in the current code it is not renewing/setting the flow.
> > This means i cant proceed with TCP/UDP code anyways connection timeout
> when
> > tested in iperf.
> >
> > If i check for ARP packets and set the reneweflag = 1 then anyways the
> flow
> > is getting set irrespective of my logic. I even tried commenting the
> > timer_callback function which removes the MAC entries so that ARP message
> > are not sent again after initially learning about MAC addresses. It didnt
> > work. Is there anyway I can block the ARP messages once transmitted and
> then
> > only have TCP/UDP messages flowing in the network.
> >
> > --
> > Regards,
> > Kavitesh Singh.
> >
> >
> > _______________________________________________
> > nox-dev mailing list
> > nox-dev@noxrepo.org
> > http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
> >
> >
>



-- 
Regards,
K Singh.
_______________________________________________
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org

Reply via email to