Good to know. Regards KK
On 18 January 2011 20:01, Kyle Wang <[email protected]> wrote: > I forgot this, thanks very much, it does work. > > On Wed, Jan 19, 2011 at 11:18 AM, kk yap <[email protected]> wrote: >> >> If you want that, you should not have >> >> ofm.buffer_id = htonl(-1); >> >> Put the buffer_id of the packet_in. >> >> Regards >> KK >> >> On 18 January 2011 18:58, Kyle Wang <[email protected]> wrote: >> > Hi KK, >> > >> > My experiment was based on the Mininet. I wanted to change the >> > destination >> > MAC address of the packets of some input flow, and after that, send them >> > out >> > from assigned out_port. The flow entry was added successfully in the >> > switch, >> > and the following packets can be processed correctly. However, the 1st >> > packet, which triggered the Packet_in_event to make NOX add >> > corresponding >> > flow entry, cannot be handled as I wanted, because when I captured from >> > the >> > host connected to the assigned out_port, the destination MAC address of >> > the >> > 1st packet was not modified, while others were correctly modified. >> > >> > On Wed, Jan 19, 2011 at 3:38 AM, kk yap <[email protected]> wrote: >> >> >> >> Hi Kyle, >> >> >> >> It might help to explain "it seemed to be not work". Did NOX segfault >> >> as a result? Was the a OpenFlow flow_mod sent? Was an error >> >> received? What switch are you using? These would be useful >> >> information. >> >> >> >> Regards >> >> KK >> >> >> >> On 18 January 2011 04:15, Kyle Wang <[email protected]> wrote: >> >> > Hi, >> >> > how can I use function send_openflow_packet(const datapathid& >> >> > datapath_id, >> >> > uint32_t buffer_id, const ofp_action_header actions[], uint16_t >> >> > actions_len, uint16_t in_port, bool block) to change the destination >> >> > MAC >> >> > address of the 1st packet of some flow, and then send this modified >> >> > packet >> >> > to the desired out_port ? >> >> > I had tried using action_list to do this, but it seemed to be not >> >> > work. >> >> > The >> >> > following is partial code. >> >> > ofp_action_list ofpall; >> >> > ofp_action *ofp1 = new ofp_action(); >> >> > ofp1->action_raw.reset(new >> >> > uint8_t[sizeof(ofp_action_dl_addr)]); >> >> > of_action_dl_addr oada; >> >> > oada.type = OFPAT_SET_DL_DST; >> >> > oada.len = sizeof(ofp_action_dl_addr); >> >> > memcpy(oada.dl_addr, fns_server_attr.dl_src, >> >> > ethernetaddr::LEN); >> >> > oada.pack((ofp_action_dl_addr*) >> >> > openflow_pack::get_header(ofp1->action_raw)); >> >> > ofpall.action_list.push_back(*ofp1); >> >> > ofp_action *ofp2 = new ofp_action(); >> >> > ofp2->action_raw.reset(new >> >> > uint8_t[sizeof(ofp_action_output)]); >> >> > of_action_output oao; >> >> > oao.type = OFPAT_OUTPUT; >> >> > oao.len = sizeof(ofp_action_output); >> >> > oao.port = fns_server_attr.in_port; >> >> > oao.max_len = 0; >> >> > oao.pack((ofp_action_output*) >> >> > openflow_pack::get_header(ofp2->action_raw)); >> >> > ofpall.action_list.push_back(*ofp2); >> >> > size_t size = sizeof(ofp_flow_mod) + ofpall.mem_size(); >> >> > boost::shared_array<uint8_t> of_raw(new uint8_t[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.wildcards = htonl(0); >> >> > ofm.match.in_port = flow.in_port; >> >> > ofm.command = OFPFC_ADD; >> >> > ofm.buffer_id = htonl(-1); >> >> > ofm.idle_timeout = htons(5); >> >> > ofm.hard_timeout = htons(OFP_FLOW_PERMANENT); >> >> > ofm.priority = htons(OFP_DEFAULT_PRIORITY); >> >> > ofm.flags = htons(ofd_flow_mod_flags()); >> >> > ofm.pack((ofp_flow_mod*) openflow_pack::get_pointer(of_raw)); >> >> > ofpall.pack(openflow_pack::get_pointer(of_raw, >> >> > sizeof(ofp_flow_mod))); >> >> > send_openflow_command(pi.datapath_id, of_raw, true); >> >> > if (buffer_id == UINT32_MAX) { >> >> > send_openflow_packet(pi.datapath_id, *pi.get_buffer(), >> >> > ofm.actions, ofpall.mem_size(), >> >> > pi.in_port, true); >> >> > } else { >> >> > send_openflow_packet(pi.datapath_id, buffer_id, >> >> > ofm.actions, ofpall.mem_size(), >> >> > pi.in_port, true); >> >> > } >> >> > >> >> > >> >> > _______________________________________________ >> >> > nox-dev mailing list >> >> > [email protected] >> >> > http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org >> >> > >> >> > >> >> _______________________________________________ >> nox-dev mailing list >> [email protected] >> http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org > > > _______________________________________________ nox-dev mailing list [email protected] http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
