+ rule_dpif_unref(rule);
+}
+
+/* Sends 'packet' out 'ofport'.
+ * May modify 'packet'.
+ * Returns 0 if successful, otherwise a positive errno value. */
+int
+xlate_send_packet(const struct ofport_dpif *ofport, struct ofpbuf *packet)
+{
+ struct xport *xport;
+ struct ofpact_output output;
+ struct flow flow;
+ union flow_in_port in_port_;
+ int error;
+
+ ofpact_init(&output.ofpact, OFPACT_OUTPUT, sizeof output);
+ /* Use OFPP_NONE as the in_port to avoid special packet processing. */
+ in_port_.ofp_port = OFPP_NONE;
+ flow_extract(packet, 0, 0, NULL, &in_port_, &flow);
+
+ ovs_rwlock_rdlock(&xlate_rwlock);
+ xport = xport_lookup(ofport);
+ if (!xport) {
+ ovs_rwlock_unlock(&xlate_rwlock);
+ return EINVAL;
+ }
+ output.port = xport->ofp_port;
+ output.max_len = 0;
+ error = ofproto_dpif_execute_actions(xport->xbridge->ofproto, &flow, NULL,
+ &output.ofpact, sizeof output,
+ packet);
+ ovs_rwlock_unlock(&xlate_rwlock);
+ return error;