Hi Andrea--

If you're wildcarding the dl_type, then you can't match on an IP address.   You 
could try setting dl_type to 0x800.

-Dan


On Wednesday, March 14, 2012 at 6:42 AM, andrea simeoni wrote:

> Hi guys,
> 
> I have a network with a single switch, and I wish to flood all traffic coming 
> from the IP "10.0.0.2". I'm trying to install a flow that is wildcarded for 
> each entry made exception for the network src address 10.0.0.2. To this aim I 
> wrote the following code: 
> 
>     ofp_action_list act_list;
>     ofp_action* normal_action = new ofp_action();
>     normal_action->set_action_output(OFPP_FLOOD,0);
>     act_list.action_list.push_back(*normal_action);
>     
>     datapathid dpid=datapathid::from_host(1);
> 
>     ofp_match tmpmatch;
>     tmpmatch.wildcards=OFPFW_IN_PORT|OFPFW_DL_VLAN|OFPFW_DL_SRC|OFPFW_DL_DST| 
> OFPFW_DL_TYPE|     
> OFPFW_NW_PROTO|OFPFW_TP_SRC|OFPFW_TP_DST|0|OFPFW_NW_DST_ALL| 
> OFPFW_DL_VLAN_PCP|OFPFW_NW_TOS;
> 
>     ipaddr sip("10.0.0.2"); 
>     tmpmatch.nw_src=(uint32_t)sip;
> 
>     ssize_t size = sizeof(ofp_flow_mod)+act_list.mem_size();
>     of_raw.reset(new uint8_t[size]);
>     of_flow_mod ofm;
>     ofm.header = openflow_pack::header(OFPT_FLOW_MOD, size);
>     ofm.cookie = 0;
>     ofm.command = OFPFC_ADD;
>     ofm.flags = ofd_flow_mod_flags();
>     memcpy(&ofm.match, &tmpmatch, sizeof(ofp_match)); 
>     ofm.idle_timeout = 50;
>     ofm.hard_timeout = 0;
>     ofm.buffer_id = 0;
>     ofm.out_port = OFPP_NONE;
>     
> 
>     ofm.pack((ofp_flow_mod*) openflow_pack::get_pointer(of_raw));
>     act_list.pack(openflow_pack::get_pointer(of_raw,sizeof(ofp_flow_mod)));
>     send_openflow_command(dpid, of_raw, false);
> 
> If I run my code, and try launch dpctl in Mininet I obtain:
> 
>  flags=none type=1(flow)
>   cookie=0, duration_sec=4s, duration_nsec=638000000s, table_id=1, 
> priority=32768, n_packets=0, n_bytes=0, 
> idle_timeout=50,hard_timeout=0,actions=output:2
> 
> 
> If i try to make pings, I get that no host can communicate each other; but 
> what I want to obtain, is that the host "10.0.0.2" is able to communicate 
> with the host on port 2 (in my case 10.0.0.3). 
> 
> There is someone that explains me how setup flows on wildcards fields?
> 
> Thank you
> 
> -- 
> Andrea Simeoni

Reply via email to