goto err_free_dp;
dp->dp_idx = dp_idx;
- dp->id = get_datapath_id(dp->netdev);
dp->chain = chain_create(dp);
if (dp->chain == NULL)
goto err_destroy_dp_dev;
#ifdef SUPPORT_SNAT
/* Check if this packet needs early SNAT processing. */
if (snat_pre_route(skb)) {
- kfree_skb(skb);
return;
}
#endif
* forward the whole packet? */
struct sk_buff *f_skb;
struct ofp_packet_in *opi;
- struct net_bridge_port *p;
size_t fwd_len, opi_len;
int err;
}
opi->buffer_id = htonl(buffer_id);
opi->total_len = htons(skb->len);
- p = skb->dev->br_port;
- opi->in_port = htons(p ? p->port_no : OFPP_LOCAL);
+ opi->in_port = htons(skb->dev && skb->dev->br_port
+ ? skb->dev->br_port->port_no
+ : OFPP_LOCAL);
opi->reason = reason;
opi->pad = 0;
- memcpy(opi->data, skb_mac_header(skb), fwd_len);
+ skb_copy_bits(skb, 0, opi->data, fwd_len);
err = send_openflow_skb(f_skb, NULL);
out:
fill_features_reply(struct datapath *dp, struct ofp_switch_features *ofr)
{
struct net_bridge_port *p;
+ uint64_t dpid = get_datapath_id(dp->netdev);
int port_count = 0;
- ofr->datapath_id = cpu_to_be64(dp->id);
+ ofr->datapath_id = cpu_to_be64(dpid);
ofr->n_buffers = htonl(N_PKT_BUFFERS);
ofr->n_tables = dp->chain->n_tables;
genlmsg_end(ans_skb, data);
err = genlmsg_reply(ans_skb, info);
- if (!err)
- ans_skb = NULL;
+ ans_skb = NULL;
}
err:
nla_put_failure:
- if (ans_skb)
- kfree_skb(ans_skb);
+ kfree_skb(ans_skb);
rcu_read_unlock();
return err;
}
{
struct sw_table *table = dp->chain->tables[s->table_idx];
- error = table->iterate(table, &match_key, &s->position,
- flow_stats_dump_callback, s);
+ error = table->iterate(table, &match_key, s->rq->out_port,
+ &s->position, flow_stats_dump_callback, s);
if (error)
break;
struct sw_table *table = dp->chain->tables[table_idx];
int error;
- error = table->iterate(table, &match_key, &position,
+ error = table->iterate(table, &match_key, rq->out_port, &position,
aggregate_stats_dump_callback, rpy);
if (error)
return error;