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
Acked-by: Eric Garver
@@ -2226,17 +2226,18 @@ 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 (n > 0) {
memset(&flow->vlans[n - 1], 0, sizeof(union flow_vlan_hdr));
}
+}
void
flow_push_vlan_uninit(struct flow *flow, struct flow_wildcards *wc)
