switch (type) {
case OFPTYPE_ECHO_REQUEST:
- process_echo_request(sw, msg->data);
+ process_echo_request(sw, ofpbuf_data(msg));
break;
case OFPTYPE_FEATURES_REPLY:
if (sw->state == S_FEATURES_REPLY) {
- if (!process_switch_features(sw, msg->data)) {
+ if (!process_switch_features(sw, ofpbuf_data(msg))) {
sw->state = S_SWITCHING;
} else {
rconn_disconnect(sw->rconn);
break;
case OFPTYPE_PACKET_IN:
- process_packet_in(sw, msg->data);
+ process_packet_in(sw, ofpbuf_data(msg));
break;
case OFPTYPE_FLOW_REMOVED:
case OFPTYPE_TABLE_FEATURES_STATS_REPLY:
default:
if (VLOG_IS_DBG_ENABLED()) {
- char *s = ofp_to_string(msg->data, msg->size, 2);
+ char *s = ofp_to_string(ofpbuf_data(msg), ofpbuf_size(msg), 2);
VLOG_DBG_RL(&rl, "%016llx: OpenFlow packet ignored: %s",
sw->datapath_id, s);
free(s);
struct ofpbuf pkt;
struct flow flow;
- union flow_in_port in_port_;
error = ofputil_decode_packet_in(&pi, oh);
if (error) {
/* Extract flow data from 'opi' into 'flow'. */
ofpbuf_use_const(&pkt, pi.packet, pi.packet_len);
- in_port_.ofp_port = pi.fmd.in_port;
- flow_extract(&pkt, 0, 0, NULL, &in_port_, &flow);
+ flow_extract(&pkt, NULL, &flow);
+ flow.in_port.ofp_port = pi.fmd.in_port;
flow.tunnel.tun_id = pi.fmd.tun_id;
/* Choose output port. */
/* Prepare packet_out in case we need one. */
po.buffer_id = pi.buffer_id;
if (po.buffer_id == UINT32_MAX) {
- po.packet = pkt.data;
- po.packet_len = pkt.size;
+ po.packet = ofpbuf_data(&pkt);
+ po.packet_len = ofpbuf_size(&pkt);
} else {
po.packet = NULL;
po.packet_len = 0;
}
po.in_port = pi.fmd.in_port;
- po.ofpacts = ofpacts.data;
- po.ofpacts_len = ofpacts.size;
+ po.ofpacts = ofpbuf_data(&ofpacts);
+ po.ofpacts_len = ofpbuf_size(&ofpacts);
/* Send the packet, and possibly the whole flow, to the output port. */
if (sw->max_idle >= 0 && (!sw->ml || out_port != OFPP_FLOOD)) {
fm.idle_timeout = sw->max_idle;
fm.buffer_id = pi.buffer_id;
fm.out_port = OFPP_NONE;
- fm.ofpacts = ofpacts.data;
- fm.ofpacts_len = ofpacts.size;
+ fm.ofpacts = ofpbuf_data(&ofpacts);
+ fm.ofpacts_len = ofpbuf_size(&ofpacts);
buffer = ofputil_encode_flow_mod(&fm, sw->protocol);
queue_tx(sw, buffer);