}
if (!(ofpfw & OFPFW10_DL_SRC)) {
- memset(wc->masks.dl_src, 0xff, ETH_ADDR_LEN);
+ WC_MASK_FIELD(wc, dl_src);
}
if (!(ofpfw & OFPFW10_DL_DST)) {
- memset(wc->masks.dl_dst, 0xff, ETH_ADDR_LEN);
+ WC_MASK_FIELD(wc, dl_dst);
}
if (!(ofpfw & OFPFW10_DL_TYPE)) {
wc->masks.dl_type = OVS_BE16_MAX;
match->flow.dl_type = ofputil_dl_type_from_openflow(ofmatch->dl_type);
match->flow.tp_src = ofmatch->tp_src;
match->flow.tp_dst = ofmatch->tp_dst;
- memcpy(match->flow.dl_src, ofmatch->dl_src, ETH_ADDR_LEN);
- memcpy(match->flow.dl_dst, ofmatch->dl_dst, ETH_ADDR_LEN);
+ match->flow.dl_src = ofmatch->dl_src;
+ match->flow.dl_dst = ofmatch->dl_dst;
match->flow.nw_tos = ofmatch->nw_tos & IP_DSCP_MASK;
match->flow.nw_proto = ofmatch->nw_proto;
} else if (match->wc.masks.vlan_tci & htons(VLAN_CFI)
&& !(match->flow.vlan_tci & htons(VLAN_CFI))) {
ofmatch->dl_vlan = htons(OFP10_VLAN_NONE);
- ofpfw |= OFPFW10_DL_VLAN_PCP;
} else {
if (!(match->wc.masks.vlan_tci & htons(VLAN_VID_MASK))) {
ofpfw |= OFPFW10_DL_VLAN;
/* Compose most of the match structure. */
ofmatch->wildcards = htonl(ofpfw);
ofmatch->in_port = htons(ofp_to_u16(match->flow.in_port.ofp_port));
- memcpy(ofmatch->dl_src, match->flow.dl_src, ETH_ADDR_LEN);
- memcpy(ofmatch->dl_dst, match->flow.dl_dst, ETH_ADDR_LEN);
+ ofmatch->dl_src = match->flow.dl_src;
+ ofmatch->dl_dst = match->flow.dl_dst;
ofmatch->dl_type = ofputil_dl_type_to_openflow(match->flow.dl_type);
ofmatch->nw_src = match->flow.nw_src;
ofmatch->nw_dst = match->flow.nw_dst;
struct match *match)
{
uint16_t wc = ntohl(ofmatch->wildcards);
- uint8_t dl_src_mask[ETH_ADDR_LEN];
- uint8_t dl_dst_mask[ETH_ADDR_LEN];
bool ipv4, arp, rarp;
- int i;
match_init_catchall(match);
match_set_in_port(match, ofp_port);
}
- for (i = 0; i < ETH_ADDR_LEN; i++) {
- dl_src_mask[i] = ~ofmatch->dl_src_mask[i];
- }
- match_set_dl_src_masked(match, ofmatch->dl_src, dl_src_mask);
-
- for (i = 0; i < ETH_ADDR_LEN; i++) {
- dl_dst_mask[i] = ~ofmatch->dl_dst_mask[i];
- }
- match_set_dl_dst_masked(match, ofmatch->dl_dst, dl_dst_mask);
+ match_set_dl_src_masked(match, ofmatch->dl_src,
+ eth_addr_invert(ofmatch->dl_src_mask));
+ match_set_dl_dst_masked(match, ofmatch->dl_dst,
+ eth_addr_invert(ofmatch->dl_dst_mask));
if (!(wc & OFPFW11_DL_VLAN)) {
if (ofmatch->dl_vlan == htons(OFPVID11_NONE)) {
struct ofp11_match *ofmatch)
{
uint32_t wc = 0;
- int i;
memset(ofmatch, 0, sizeof *ofmatch);
ofmatch->omh.type = htons(OFPMT_STANDARD);
ofmatch->in_port = ofputil_port_to_ofp11(match->flow.in_port.ofp_port);
}
- memcpy(ofmatch->dl_src, match->flow.dl_src, ETH_ADDR_LEN);
- for (i = 0; i < ETH_ADDR_LEN; i++) {
- ofmatch->dl_src_mask[i] = ~match->wc.masks.dl_src[i];
- }
-
- memcpy(ofmatch->dl_dst, match->flow.dl_dst, ETH_ADDR_LEN);
- for (i = 0; i < ETH_ADDR_LEN; i++) {
- ofmatch->dl_dst_mask[i] = ~match->wc.masks.dl_dst[i];
- }
+ ofmatch->dl_src = match->flow.dl_src;
+ ofmatch->dl_src_mask = eth_addr_invert(match->wc.masks.dl_src);
+ ofmatch->dl_dst = match->flow.dl_dst;
+ ofmatch->dl_dst_mask = eth_addr_invert(match->wc.masks.dl_dst);
if (match->wc.masks.vlan_tci == htons(0)) {
wc |= OFPFW11_DL_VLAN | OFPFW11_DL_VLAN_PCP;
const struct ofp10_phy_port *opp)
{
pp->port_no = u16_to_ofp(ntohs(opp->port_no));
- memcpy(pp->hw_addr, opp->hw_addr, OFP_ETH_ALEN);
+ pp->hw_addr = opp->hw_addr;
ovs_strlcpy(pp->name, opp->name, OFP_MAX_PORT_NAME_LEN);
pp->config = ntohl(opp->config) & OFPPC10_ALL;
if (error) {
return error;
}
- memcpy(pp->hw_addr, op->hw_addr, OFP_ETH_ALEN);
+ pp->hw_addr = op->hw_addr;
ovs_strlcpy(pp->name, op->name, OFP_MAX_PORT_NAME_LEN);
pp->config = ntohl(op->config) & OFPPC11_ALL;
if (error) {
return error;
}
- memcpy(pp->hw_addr, op->hw_addr, OFP_ETH_ALEN);
+ pp->hw_addr = op->hw_addr;
ovs_strlcpy(pp->name, op->name, OFP_MAX_PORT_NAME_LEN);
pp->config = ntohl(op->config) & OFPPC11_ALL;
memset(opp, 0, sizeof *opp);
opp->port_no = htons(ofp_to_u16(pp->port_no));
- memcpy(opp->hw_addr, pp->hw_addr, ETH_ADDR_LEN);
+ opp->hw_addr = pp->hw_addr;
ovs_strlcpy(opp->name, pp->name, OFP_MAX_PORT_NAME_LEN);
opp->config = htonl(pp->config & OFPPC10_ALL);
memset(op, 0, sizeof *op);
op->port_no = ofputil_port_to_ofp11(pp->port_no);
- memcpy(op->hw_addr, pp->hw_addr, ETH_ADDR_LEN);
+ op->hw_addr = pp->hw_addr;
ovs_strlcpy(op->name, pp->name, OFP_MAX_PORT_NAME_LEN);
op->config = htonl(pp->config & OFPPC11_ALL);
op = ofpbuf_put_zeros(b, sizeof *op);
op->port_no = ofputil_port_to_ofp11(pp->port_no);
op->length = htons(sizeof *op + sizeof *eth);
- memcpy(op->hw_addr, pp->hw_addr, ETH_ADDR_LEN);
+ op->hw_addr = pp->hw_addr;
ovs_strlcpy(op->name, pp->name, sizeof op->name);
op->config = htonl(pp->config & OFPPC11_ALL);
op->state = htonl(pp->state & OFPPS11_ALL);
ofp_port_t port)
{
struct ofpbuf *request;
- ovs_be32 ofp11_port;
switch (ofp_version) {
case OFP10_VERSION:
request = ofpraw_alloc(OFPRAW_OFPST10_PORT_DESC_REQUEST,
ofp_version, 0);
break;
-
- case OFP15_VERSION:
+ case OFP15_VERSION:{
+ struct ofp15_port_desc_request *req;
request = ofpraw_alloc(OFPRAW_OFPST15_PORT_DESC_REQUEST,
ofp_version, 0);
- ofp11_port = ofputil_port_to_ofp11(port);
- ofpbuf_put(request, &ofp11_port, sizeof ofp11_port);
+ req = ofpbuf_put_zeros(request, sizeof *req);
+ req->port_no = ofputil_port_to_ofp11(port);
break;
-
+ }
default:
OVS_NOT_REACHED();
}
const struct ofp10_port_mod *opm = b.data;
pm->port_no = u16_to_ofp(ntohs(opm->port_no));
- memcpy(pm->hw_addr, opm->hw_addr, ETH_ADDR_LEN);
+ pm->hw_addr = opm->hw_addr;
pm->config = ntohl(opm->config) & OFPPC10_ALL;
pm->mask = ntohl(opm->mask) & OFPPC10_ALL;
pm->advertise = netdev_port_features_from_ofp10(opm->advertise);
return error;
}
- memcpy(pm->hw_addr, opm->hw_addr, ETH_ADDR_LEN);
+ pm->hw_addr = opm->hw_addr;
pm->config = ntohl(opm->config) & OFPPC11_ALL;
pm->mask = ntohl(opm->mask) & OFPPC11_ALL;
pm->advertise = netdev_port_features_from_ofp11(opm->advertise);
return error;
}
- memcpy(pm->hw_addr, opm->hw_addr, ETH_ADDR_LEN);
+ pm->hw_addr = opm->hw_addr;
pm->config = ntohl(opm->config) & OFPPC11_ALL;
pm->mask = ntohl(opm->mask) & OFPPC11_ALL;
b = ofpraw_alloc(OFPRAW_OFPT10_PORT_MOD, ofp_version, 0);
opm = ofpbuf_put_zeros(b, sizeof *opm);
opm->port_no = htons(ofp_to_u16(pm->port_no));
- memcpy(opm->hw_addr, pm->hw_addr, ETH_ADDR_LEN);
+ opm->hw_addr = pm->hw_addr;
opm->config = htonl(pm->config & OFPPC10_ALL);
opm->mask = htonl(pm->mask & OFPPC10_ALL);
opm->advertise = netdev_port_features_to_ofp10(pm->advertise);
b = ofpraw_alloc(OFPRAW_OFPT11_PORT_MOD, ofp_version, 0);
opm = ofpbuf_put_zeros(b, sizeof *opm);
opm->port_no = ofputil_port_to_ofp11(pm->port_no);
- memcpy(opm->hw_addr, pm->hw_addr, ETH_ADDR_LEN);
+ opm->hw_addr = pm->hw_addr;
opm->config = htonl(pm->config & OFPPC11_ALL);
opm->mask = htonl(pm->mask & OFPPC11_ALL);
opm->advertise = netdev_port_features_to_ofp11(pm->advertise);
b = ofpraw_alloc(OFPRAW_OFPT14_PORT_MOD, ofp_version, sizeof *eth);
opm = ofpbuf_put_zeros(b, sizeof *opm);
opm->port_no = ofputil_port_to_ofp11(pm->port_no);
- memcpy(opm->hw_addr, pm->hw_addr, ETH_ADDR_LEN);
+ opm->hw_addr = pm->hw_addr;
opm->config = htonl(pm->config & OFPPC11_ALL);
opm->mask = htonl(pm->mask & OFPPC11_ALL);
wc.masks.nw_ttl = 0;
}
if (!(may_match & MAY_ARP_SHA)) {
- memset(wc.masks.arp_sha, 0, ETH_ADDR_LEN);
+ WC_UNMASK_FIELD(&wc, arp_sha);
}
if (!(may_match & MAY_ARP_THA)) {
- memset(wc.masks.arp_tha, 0, ETH_ADDR_LEN);
+ WC_UNMASK_FIELD(&wc, arp_tha);
}
if (!(may_match & MAY_IPV6)) {
wc.masks.ipv6_src = wc.masks.ipv6_dst = in6addr_any;
uint32_t group_id)
{
struct ofpbuf *request;
- ovs_be32 gid;
switch (ofp_version) {
case OFP10_VERSION:
request = ofpraw_alloc(OFPRAW_OFPST11_GROUP_DESC_REQUEST,
ofp_version, 0);
break;
- case OFP15_VERSION:
+ case OFP15_VERSION:{
+ struct ofp15_group_desc_request *req;
request = ofpraw_alloc(OFPRAW_OFPST15_GROUP_DESC_REQUEST,
ofp_version, 0);
- gid = htonl(group_id);
- ofpbuf_put(request, &gid, sizeof gid);
+ req = ofpbuf_put_zeros(request, sizeof *req);
+ req->group_id = htonl(group_id);
break;
+ }
default:
OVS_NOT_REACHED();
}
switch (gm->type) {
case OFPGT11_INDIRECT:
if (!list_is_singleton(&gm->buckets)) {
- return OFPERR_OFPGMFC_OUT_OF_BUCKETS;
+ return OFPERR_OFPGMFC_INVALID_GROUP;
}
break;
case OFPGT11_ALL: