In, my project, i want when OVS receive a specific packet, i can instantly add my flow to userspace flowtable. I know this is so silly, but i used system() funtion in stdlib.h to execute “ovs-ofctl add-flow myflow” to add my flow. And result is when OVS run to system() funtion, process that call add flow command to be hang, and whole OVS is hang too.
Now, i would like ask : does OVS provide any api to add flow or is there a way to add flow directly to flowtable in userspace ? I add my modification to connmgr_send_async_msg() in ovs/ofproto/connmgr.c, it looks like this : void connmgr_send_async_msg(struct connmgr *mgr, const struct ofproto_async_msg *am) { struct dp_packet packet_in; // this is packet comes in OVS // then i get interface name, MAC, IPv4, TCP port of packet_in into //in, out, sMAC, dMAC, sIP, dIP, sPort, dPort char cmd[1000]; // command i want pass to system() snprintf(bar1, sizeof(bar1), "ovs-ofctl add-flow s1 priority=5,tcp,in_port=\"%s\",eth_src=%s,eth_dst=%s, ipv4_src=%s,ipv4_dst=%s,tcp_src=%u,tcp_dst=%u,action=output:\"%s\"" ,in ,sMAC ,dMAC, sIP, dIP, sPort, dPort, out); // pass agr to cmd // call system() funtion with cmd int systemRet1 = system(cmd); ...............................// normal OVS source code } _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev