2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

flow: Further refinements to flow_pop_vlan().

This may help to suppress warnings from know-it-all compilers, and it helps
to make the code clearer too.

Reported-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Eric Garver <e@erig.me>
This commit is contained in:
Ben Pfaff
2017-04-14 21:25:41 -07:00
parent bc3436de9a
commit 68c744fd30

View File

@@ -2226,16 +2226,17 @@ void
flow_pop_vlan(struct flow *flow, struct flow_wildcards *wc)
{
int n = flow_count_vlan_headers(flow);
if (n == 0) {
return;
if (n > 1) {
if (wc) {
memset(&wc->masks.vlans[1], 0xff,
sizeof(union flow_vlan_hdr) * (n - 1));
}
memmove(&flow->vlans[0], &flow->vlans[1],
sizeof(union flow_vlan_hdr) * (n - 1));
}
if (wc) {
memset(&wc->masks.vlans[1], 0xff,
sizeof(union flow_vlan_hdr) * (n - 1));
if (n > 0) {
memset(&flow->vlans[n - 1], 0, sizeof(union flow_vlan_hdr));
}
memmove(&flow->vlans[0], &flow->vlans[1],
sizeof(union flow_vlan_hdr) * (n - 1));
memset(&flow->vlans[n - 1], 0, sizeof(union flow_vlan_hdr));
}
void