Hi all,
Sorry to bother you.
I am writing a nox module which used as a router. And I use openvswitch as
switch to forward the packets.
I add 2 queues to each port of openvswitch. And in nox, I use this code to
install flow to flow table in openvswitch.
// set up a new flow
ofp_action_list act_list;
ofp_action *act;
act = new ofp_action();
act->set_action_dl_addr(OFPAT_SET_DL_DST,
ARPTable[RouteEntry.NextIPAddr]);
act_list.action_list.push_back(*act);
act = new ofp_action();
act->set_action_output(RouteEntry.outPort, 0);
act_list.action_list.push_back(*act);
act = new ofp_action();
if (flow.nw_proto == ip_::proto::UDP)
act->set_action_enqueue(RouteEntry.outPort, 1);
else
act->set_action_enqueue(RouteEntry.outPort, 0);
act_list.action_list.push_back(*act);
// set up new flow
boost::shared_array<uint8_t> of_raw;
size_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.match = flow.get_exact_match();
ofm.match.in_port = htons(ofm.match.in_port);
ofm.cookie = htonl(0);
ofm.command = htons(OFPFC_ADD);
ofm.flags = htons(0);
ofm.priority = htons(OFP_DEFAULT_PRIORITY);
ofm.idle_timeout = htons(120);
ofm.hard_timeout = htons(0);
ofm.buffer_id = buffer_id;
ofm.pack((ofp_flow_mod*) openflow_pack::get_pointer(of_raw));
act_list.pack(openflow_pack::get_pointer(of_raw,sizeof(ofp_flow_mod)));
lg.dbg("Install flow entry %s with %zu actions",
flow.to_string().c_str(), act_list.action_list.size());
send_openflow_command(datapath_id, of_raw, false);
But question is when I ping from host(ip: 192.168.57.1) to terminal(ip:
10.0.0.2), openvswitch will forward the same packet twice or more.
Is there something wrong with queue configuration or NOX?
Thanks.
-- Tony