Software Defined Networking
cancel
Showing results for 
Search instead for 
Did you mean: 

Flow match with MAC mask

 
Highlighted
Occasional Advisor

Flow match with MAC mask

Hi everyone! 

I am trying to deploy a OF 1.0 flow enty on a flow table for a maskable MAC address. The intention is, to match a specific MAC vendor prefix. 

 

Therefore I set up a FlowMod Add message and created a match with the following sample match field:

 

MatchField mf = FieldFactory.createBasicField(ProtocolVersion.V_1_0, OxmBasicFieldType.ETH_SRC, MacAddress.valueOf("01:02:03:04:05:06"), MacAddress.valueOf("ff:ff:ff:00:00:00"));

... according to the SDN documentation:

createBasicField(ProtocolVersion pv, OxmBasicFieldType ft, MacAddress mac, MacAddress mask)

  

For developing purposes I am using the Mininet Open vSwitches. With the above code, a flow entry with an un-masked MAC match field is installed, e.g: eth_src=01:02:03:04:05:06.

 

Installing the flow manually via dpctl on the flow table, I get the desired result, e.g. eth_src=01:02:03:00:00:00/ff:ff:ff:00:00:00. 

 

Where is the problem? I would be glad if anyone could help me to achieve my intention. 

 

Best regards,

Dast 

6 REPLIES 6
Highlighted
Trusted Contributor

Re: Flow match with MAC mask

Hello Dast,

 

Please try as per the SDN Programming guide(page 27-29, An example : creating a FlowMod message)

 

private static final MacAddress MAC =MacAddress.valueOf("00001e:000000");

private static final MacAddress MAC_MASK =MacAddress.valueOf("ffffff:000000");

private static final PortNumber SMTP_PORT = PortNumber.valueOf(25);

private static final MacAddress MAC_DEST = MacAddress.BROADCAST;

private static final IpAddress IP_DEST = IpAddress.LOOPBACK_IPv4;

….

….

private Match createMatch() {

// NOTE static imports of:

// com.hp.of.lib.match.FieldFactory.createBasicField;

// com.hp.of.lib.match.OxmBasicFieldType.*;

MutableMatch mm = MatchFactory.createMatch(PV)

.addField(createBasicField(PV, ETH_SRC, MAC, MAC_MASK))

.addField(createBasicField(PV, ETH_TYPE, EthernetType.IPv4))

.addField(createBasicField(PV, IP_PROTO, IpProtocol.TCP))

.addField(createBasicField(PV, TCP_DST, SMTP_PORT));

return (Match) mm.toImmutable();

}

 

 

If you still face the issue , please share your code.

 

Thanks,

HP SDN Team

Highlighted
Occasional Advisor

Re: Flow match with MAC mask

Hello,

 

thanks for your reply, but it didn't help. the result is the same: the Flow Table has just a regular MAC address match without a mask (as shown in my initial post).

 

My code: 

// dpId is given as a parameter

MacAddress MAC = MacAddress.valueOf("102030:000000");
MacAddress MAC_MASK =MacAddress.valueOf("ffffff:000000");
PortNumber SMTP_PORT = PortNumber.valueOf(25);
ProtocolVersion PV = ProtocolVersion.V_1_0;
		
MutableMatch mm = MatchFactory.createMatch(PV)
		.addField(FieldFactory.createBasicField(PV, OxmBasicFieldType.ETH_SRC, MAC, MAC_MASK))
		.addField(FieldFactory.createBasicField(PV, OxmBasicFieldType.ETH_TYPE, EthernetType.IPv4))
		.addField(FieldFactory.createBasicField(PV, OxmBasicFieldType.IP_PROTO, IpProtocol.TCP))
		.addField(FieldFactory.createBasicField(PV, OxmBasicFieldType.TCP_DST, SMTP_PORT));
Match m = (Match) mm.toImmutable(); OfmMutableFlowMod deployFlowMsg = (OfmMutableFlowMod) MessageFactory.create(ProtocolVersion.V_1_0, MessageType.FLOW_MOD, FlowModCommand.ADD); deployFlowMsg.match(m); Date now = new Date(); long cookie = now.getTime(); deployFlowMsg.idleTimeout(0).hardTimeout(0).priority(155).bufferId(BufferId.NO_BUFFER).cookie(cookie); controllerService.sendFlowMod(deployFlowMsg,toImmutable(), dpId);

 

 

Before sending, my app logged the OpenFlow FlowModMessage: 

{ofm:[V_1_0,FLOW_MOD,72,126],cmd=ADD,match={Match(V_1_0):[type=STANDARD,len=40],fields=ETH_SRC,ETH_TYPE,IP_PROTO,TCP_DST},...}
  Cookie   : 0x147ba070f37
  FMod Cmd : ADD
  Idle t/o : 0s
  Hard t/o : 0s
  Priority : 155
  Buffer ID: 0xffffffff(NO_BUFFER)
  Out Port : 0xffffffff(ANY)
  FMod Flgs: []
  Match    : {Match(V_1_0):[type=STANDARD,len=40],fields=ETH_SRC,ETH_TYPE,IP_PROTO,TCP_DST}
    {Oxm:V_1_0:[cls=0x8000(OPENFLOW_BASIC),ft=4(ETH_SRC),hm=true,len=12],mac=10:20:30:00:00:00,mask=ff:ff:ff:00:00:00}
    {Oxm:V_1_0:[cls=0x8000(OPENFLOW_BASIC),ft=5(ETH_TYPE),hm=false,len=2],type=0x0800(IPv4)}
    {Oxm:V_1_0:[cls=0x8000(OPENFLOW_BASIC),ft=10(IP_PROTO),hm=false,len=1],ipp=6(TCP)}
    {Oxm:V_1_0:[cls=0x8000(OPENFLOW_BASIC),ft=14(TCP_DST),hm=false,len=2],port=0x19(25)}
  Actions  : (none)

 

 

Best regards!

Highlighted
Trusted Contributor

Re: Flow match with MAC mask

Hello Dast,

 

Apologies for the delay.

 Please let us know if your problem is solved or you still facing some issue.

 

 

If you have more questions on the same topic please do reply on the same thread or open a new post if new topic.

 

Thanks,

HP SDN Team

Highlighted
Occasional Advisor

Re: Flow match with MAC mask

Hello sdnindia,

 

I didn't find a solution for this problem yet...

 

Regards!

Highlighted
Esteemed Contributor

Re: Flow match with MAC mask

Hi Dast

 

1. Can you please do a packet capture of the the flow_mod message between the controller and switch, and attach the pcap to the thread ?

2. WHich version of the the HP VAN SDN Controller are you using ?

3. What kind of switch are you using ?

4. What software is on the switch ?

5. Would you mind attaching the switch configuration to this as well please ?

 

Thanks in advance

Gerhard Roets

HP SDN Team

Highlighted
Occasional Advisor

Re: Flow match with MAC mask

 Hello Gerhard,

 

I am currently not working on the project anymore, but nevertheless this problem should be discussed / fixed. 

 

Please find subsequently the answers to your questions:

 

1. This is currently not possible, but as mentioned above the FlowModMessage was sent like this:

{ofm:[V_1_0,FLOW_MOD,72,126],cmd=ADD,match={Match(V_1_0):[type=STANDARD,len=40],fields=ETH_SRC,ETH_TYPE,IP_PROTO,TCP_DST},...}
  Cookie   : 0x147ba070f37
  FMod Cmd : ADD
  Idle t/o : 0s
  Hard t/o : 0s
  Priority : 155
  Buffer ID: 0xffffffff(NO_BUFFER)
  Out Port : 0xffffffff(ANY)
  FMod Flgs: []
  Match    : {Match(V_1_0):[type=STANDARD,len=40],fields=ETH_SRC,ETH_TYPE,IP_PROTO,TCP_DST}
    {Oxm:V_1_0:[cls=0x8000(OPENFLOW_BASIC),ft=4(ETH_SRC),hm=true,len=12],mac=10:20:30:00:00:00,mask=ff:ff:ff:00:00:00}
    {Oxm:V_1_0:[cls=0x8000(OPENFLOW_BASIC),ft=5(ETH_TYPE),hm=false,len=2],type=0x0800(IPv4)}
    {Oxm:V_1_0:[cls=0x8000(OPENFLOW_BASIC),ft=10(IP_PROTO),hm=false,len=1],ipp=6(TCP)}
    {Oxm:V_1_0:[cls=0x8000(OPENFLOW_BASIC),ft=14(TCP_DST),hm=false,len=2],port=0x19(25)}
  Actions  : (none)

 

2. I tried it with version 2.2.5 and 2.3.5.

 

3. I used the Open vSwitches as well as an HP 5406 and 3500.

 

4. and 5. see attached files.


Thanks for your support!