[pox-dev] how to specify wildcards in ofp_match.from_packet()?

William Emmanuel S. Yu wyu at ateneo.edu
Mon Sep 24 02:26:56 PDT 2012


I want the other way around. So I None all the other fields? Is there a way to create a match object that allows any match by default?

Tnx.
"Sent on the move."

-----Original Message-----
From: Murphy McCauley <murphy.mccauley at gmail.com>
Date: Mon, 24 Sep 2012 02:05:25 
To: William Emmanuel Yu<wyu at ateneo.edu>
Cc: <pox-dev at lists.noxrepo.org>
Subject: Re: [pox-dev] how to specify wildcards in ofp_match.from_packet()?

On Sep 24, 2012, at 1:51 AM, William Emmanuel Yu wrote:
> I want to be able to do something like this.
> 
>      msg.match = of.ofp_match.from_packet(packet, 
>        wildcards = OFPFW_DL_DST)
> 
> The wildcard OFPFW_DL_DST only matches the destination ethernet address.
> This way the flow is more generic so any packet to that particular
> destination ethernet address in the switch does not generate a PacketIn.

You're making it too hard for yourself. ;)  Try something like...

msg.match = of.ofp_match.from_packet(packet)
msg.match.dl_dst = None

> Currently, the ofp_match.from_packet() function does not accept
> wildcards. As a matter of fact, I can't seem to find the appropriate
> function that allows us to define wildcards.

In general, any fields set to None are wildcarded. This is mentioned on the wiki in the section describing the match structure, but it's possible more attention could be drawn to it:
https://openflow.stanford.edu/display/ONL/POX+Wiki#POXWiki-MatchStructure

It's a little more tricky for IP addresses which can wildcard part of the field, but not especially.   (Just use a tuple of address,bits or a CIDR-style address/bits string, the result of lib.addresses.parseCIDR(), etc.)

> Additionally, wildcards
> such as OFPFW_DL_DST or OFPFW_ALL are not global and accessible in my
> code.

You basically don't need them because of the automatic wildcarding of None entries and direct support for CIDR addresses and whatnot.
If you DO really want them, if you have libopenflow imported as "of" (as per POX convention), these should be on there, e.g., of.OFPFW_DL_DST.


Hope that helps.

-- Murphy


More information about the pox-dev mailing list