On Mon, May 16, 2016 at 2:08 PM,  <banysalam...@yahoo.com> wrote:
> Hi:
>
> I want to specify IP addresses in the Match so I can retrieve them later.
> When I set ipv4_src, ipv4_dst , it takes them but generates error message
> bad match with type 4, code 9.
>
> This is the segment of code
>
>             if(pkt.get_protocols(ethernet.ethernet) and
> pkt.get_protocols(ipv4.ipv4)):
>                 (ip4,) = pkt.get_protocols(ipv4.ipv4)
>                 ipsrc = ip4.src
>                 ipdst = ip4.dst
>                 protocol = ip4.proto
>                 match = parser.OFPMatch(in_port=in_port, eth_dst=dst,
> eth_src=src, ipv4_src=ipsrc, ipv4_dst=ipdst )
>             else:
>                 match = parser.OFPMatch(in_port=in_port, eth_dst=dst,
> eth_src=src)
>             print match
>
> and this the output
>
> OFPMatch(oxm_fields={'eth_src': 'c6:84:a3:ec:d5:01', 'eth_dst':
> 'de:d6:41:96:48:86', 'ipv4_src': '10.0.0.7', 'in_port': 3, 'ipv4_dst':
> '10.0.0.1'})
> ('OFPErrorMsg received: type=0x%02x code=0x%02x message=%s', 4, 9, '0x4 0xe
> 0x0 0x78 0x89 0xd2 0x9d 0x12 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
> 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x5 0x0 0x0 0x0 0x1 0xff 0xff 0xff 0xff 0x0 0x0
> 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x1 0x0 0x0 0x0 0x1 0x0 0x30 0x80 0x0 0x0 0x4
> 0x0 0x0 0x0 0x3 0x80 0x0 0x6 0x6')
>
> what is the problem?

When matching on l3 fields you must tell openflow the ethernet type
your expecting. for the ipv4 match you can change it to:

from ryu.lib.packet import ether_types
parser.OFPMatch(in_port=in_port, eth_dst=dst, eth_src=src,
                eth_type=ether_types.ETH_TYPE_IP,
                ipv4_src=ipsrc, ipv4_dst=ipdst)

Happy Hacking!

7-11

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to