HomeFreeBSD

MFC r351629: sys/net/if_vlan.c: Wrap a vlan's parent's if_output

Description

MFC r351629: sys/net/if_vlan.c: Wrap a vlan's parent's if_output
in a separate function.

The merge is done in preparation of another merge
to support 802.1ad (qinq). Original commit log follows.

When a vlan interface is created, its if_output is set directly to the
parent interface's if_output. This is fine in the normal case but has an
unfortunate consequence if you end up with a certain combination of vlan
and lagg interfaces.

Consider you have a lagg interface with a single laggport member. When
an interface is added to a lagg its if_output is set to
lagg_port_output, which blackholes traffic from the normal networking
stack but not certain frames from BPF (pseudo_AF_HDRCMPLT). If you now
create a vlan with the laggport member (not the lagg interface) as its
parent, its if_output is set to lagg_port_output as well. While this is
confusing conceptually and likely represents a misconfigured system, it
is not itself a problem. The problem arises when you then remove the
lagg interface. Doing this resets the if_output of the laggport member
back to its original state, but the vlan's if_output is left pointing to
lagg_port_output. This gives rise to the possibility that the system
will panic when e.g. bpf is used to send any frames on the vlan
interface.

Fix this by creating a new function, vlan_output, which simply wraps the
parent's current if_output. That way when the parent's if_output is
restored there is no stale usage of lagg_port_output.

Reviewed by: rstone
Differential Revision: D21209

(cherry picked from commit 16cf6bdbb6cb18a5af7b499034b2176a1fa0a503)

Details

Provenance
mjorasAuthored on Aug 30 2019, 8:19 PM
eugen_grosbein.netCommitted on May 22 2021, 11:59 PM
Reviewer
rstone
Differential Revision
D21209: Wrap a vlan's parent's if_output in a separate function.
Parents
R10:9120716d91d4: storvsc: fix auto-sense reporting
Branches
Unknown
Tags
Unknown