#include "list.h"
#include "netdev.h"
#include "ofpbuf.h"
-#include "openflow.h"
+#include "openflow/openflow.h"
#include "packets.h"
#include "poll-loop.h"
#include "rconn.h"
ofr->capabilities = htonl(OFP_SUPPORTED_CAPABILITIES);
ofr->actions = htonl(OFP_SUPPORTED_ACTIONS);
LIST_FOR_EACH (p, struct sw_port, node, &dp->port_list) {
- struct ofp_phy_port *opp = ofpbuf_put_uninit(buffer, sizeof *opp);
- memset(opp, 0, sizeof *opp);
+ struct ofp_phy_port *opp = ofpbuf_put_zeros(buffer, sizeof *opp);
fill_port_desc(dp, p, opp);
}
send_openflow_buffer(dp, buffer, sender);
{
struct ofp_flow_stats *ofs;
int length = sizeof *ofs + flow->sf_acts->actions_len;
- ofs = ofpbuf_put_uninit(buffer, length);
+ ofs = ofpbuf_put_zeros(buffer, length);
ofs->length = htons(length);
ofs->table_id = table_idx;
- ofs->pad = 0;
ofs->match.wildcards = htonl(flow->key.wildcards);
ofs->match.in_port = flow->key.flow.in_port;
memcpy(ofs->match.dl_src, flow->key.flow.dl_src, ETH_ADDR_LEN);
ofs->match.nw_src = flow->key.flow.nw_src;
ofs->match.nw_dst = flow->key.flow.nw_dst;
ofs->match.nw_proto = flow->key.flow.nw_proto;
- ofs->match.pad = 0;
ofs->match.tp_src = flow->key.flow.tp_src;
ofs->match.tp_dst = flow->key.flow.tp_dst;
ofs->duration = htonl(now - flow->created);
ofs->priority = htons(flow->priority);
ofs->idle_timeout = htons(flow->idle_timeout);
ofs->hard_timeout = htons(flow->hard_timeout);
- memset(ofs->pad2, 0, sizeof ofs->pad2);
ofs->packet_count = htonll(flow->packet_count);
ofs->byte_count = htonll(flow->byte_count);
memcpy(ofs->actions, flow->sf_acts->actions, flow->sf_acts->actions_len);
if (v_code != ACT_VALIDATION_OK) {
dp_send_error_msg(dp, sender, OFPET_BAD_ACTION, v_code,
ofm, ntohs(ofm->header.length));
- goto error;
+ goto error_free_flow;
}
/* Fill out flow. */
} else if (command == OFPFC_DELETE) {
struct sw_flow_key key;
flow_extract_match(&key, &ofm->match);
- return chain_delete(dp->chain, &key, 0, 0) ? 0 : -ESRCH;
+ return chain_delete(dp->chain, &key, ofm->out_port, 0, 0) ? 0 : -ESRCH;
} else if (command == OFPFC_DELETE_STRICT) {
struct sw_flow_key key;
uint16_t priority;
flow_extract_match(&key, &ofm->match);
priority = key.wildcards ? ntohs(ofm->priority) : -1;
- return chain_delete(dp->chain, &key, priority, 1) ? 0 : -ESRCH;
+ return chain_delete(dp->chain, &key, ofm->out_port,
+ priority, 1) ? 0 : -ESRCH;
} else {
return -ENODEV;
}
static int desc_stats_dump(struct datapath *dp, void *state,
struct ofpbuf *buffer)
{
- struct ofp_desc_stats *ods = ofpbuf_put_uninit(buffer, sizeof *ods);
+ struct ofp_desc_stats *ods = ofpbuf_put_zeros(buffer, sizeof *ods);
strncpy(ods->mfr_desc, &mfr_desc, sizeof ods->mfr_desc);
strncpy(ods->hw_desc, &hw_desc, sizeof ods->hw_desc);
{
struct sw_table *table = dp->chain->tables[s->table_idx];
- if (table->iterate(table, &match_key, &s->position,
- flow_stats_dump_callback, s))
+ if (table->iterate(table, &match_key, s->rq.out_port,
+ &s->position, flow_stats_dump_callback, s))
break;
s->table_idx++;
struct sw_flow_key match_key;
int table_idx;
- rpy = ofpbuf_put_uninit(buffer, sizeof *rpy);
- memset(rpy, 0, sizeof *rpy);
+ rpy = ofpbuf_put_zeros(buffer, sizeof *rpy);
flow_extract_match(&match_key, &rq->match);
table_idx = rq->table_id == 0xff ? 0 : rq->table_id;
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;
{
int i;
for (i = 0; i < dp->chain->n_tables; i++) {
- struct ofp_table_stats *ots = ofpbuf_put_uninit(buffer, sizeof *ots);
+ struct ofp_table_stats *ots = ofpbuf_put_zeros(buffer, sizeof *ots);
struct sw_table_stats stats;
dp->chain->tables[i]->stats(dp->chain->tables[i], &stats);
strncpy(ots->name, stats.name, sizeof ots->name);
ots->table_id = i;
ots->wildcards = htonl(stats.wildcards);
- memset(ots->pad, 0, sizeof ots->pad);
ots->max_entries = htonl(stats.max_flows);
ots->active_count = htonl(stats.n_flows);
ots->lookup_count = htonll(stats.n_lookup);
if (!p->netdev) {
continue;
}
- ops = ofpbuf_put_uninit(buffer, sizeof *ops);
+ ops = ofpbuf_put_zeros(buffer, sizeof *ops);
ops->port_no = htons(port_no(dp, p));
- memset(ops->pad, 0, sizeof ops->pad);
ops->rx_packets = htonll(p->rx_packets);
ops->tx_packets = htonll(p->tx_packets);
ops->rx_bytes = htonll(p->rx_bytes);