Please do not drop the ML.

2015-03-10 19:58 GMT+09:00 MD.Badruzzaman Shakib <shaki...@ymail.com>:

> Hi Satoshi,
>
> Thanks for your reply. I changed the variable 'ipv4' and make it like-
>
> *nw = pkt.get_protocol(ipv4.ipv4)*
>
> and then trying to access the address using -
> *src_add = nw.src*
> *dst_add = nw.dst*
>
> But pkt.get_protocol(ipv4.ipv4) returns 'None'. So I do not have the
> source and destination ip yet. I understand that i am totally wrong in my
> procedure to get the ip addresses of the packet. If you know how to get the
> source and destination ip address of the packet, please let me know.
>

As far as I see, the code has no problem. Does the packet have IPv4 header?
(For example, ARP has no IPv4 header)


>
> Thanking you
> sakib
>
>
>   On Tuesday, 10 March 2015, 11:41, Satoshi KOBAYASHI <
> satosh...@stratosphere.co.jp> wrote:
>
>
>
>
>
> 2015-03-09 18:47 GMT+09:00 MD.Badruzzaman Shakib <shaki...@ymail.com>:
>
> Hello everyone
>
> I am new in python. I wanted to develop a ryu-app that will calculate
> shortest path and push those flows to the switch. While doing this i faced
> the following problem-
>
> I wanted to match the ipv4 destination network to add flows. For that i
> made the packet_in_handler as follows-
> (from ryu.lib.packet import ipv4)   # importing ipv4 protocol
>
>     def _packet_in_handler(self, ev):
>         msg = ev.msg
>         datapath = msg.datapath
>         ofproto = datapath.ofproto
>
>         pkt = packet.Packet(msg.data)
>         ipv4 = pkt.get_protocol(ipv4.ipv4)
>
>
> "ipv4" symbol is duplicate. You have to rename it.
>
>
>
>         dst = ipv4.dst
>         src = ipv4.src
>
> This gives the following error-
>     *UnboundLocalError: local variable 'ipv4' referenced before
> assignment*
>
> Also for destination network matching what should be my match condition
> destination network in
>      match = datapath.ofproto_parser.OFPMatch("*destination_network*")
>
>
> Thank you in advance for your help.
>
> Thanking you
> sakib
>
>
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Ryu-devel mailing list
> Ryu-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
>
>
>
> --
> Satoshi KOBAYASHI <satosh...@stratosphere.co.jp
> >
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Ryu-devel mailing list
> Ryu-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
>
>
>


-- 
Satoshi KOBAYASHI <satosh...@stratosphere.co.jp>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to