samples, bpf: Add an explict comment to handle nested vlan tagging.
A codeblock for handling nested vlan trips newbies into thinking it as duplicate code. Explicitly add a comment to clarify. Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20210809070046.32142-1-falakreyaz@gmail.com
This commit is contained in:
parent
6aab1c81b9
commit
d692a637b4
|
@ -57,6 +57,7 @@ int xdp_prog1(struct xdp_md *ctx)
|
||||||
|
|
||||||
h_proto = eth->h_proto;
|
h_proto = eth->h_proto;
|
||||||
|
|
||||||
|
/* Handle VLAN tagged packet */
|
||||||
if (h_proto == htons(ETH_P_8021Q) || h_proto == htons(ETH_P_8021AD)) {
|
if (h_proto == htons(ETH_P_8021Q) || h_proto == htons(ETH_P_8021AD)) {
|
||||||
struct vlan_hdr *vhdr;
|
struct vlan_hdr *vhdr;
|
||||||
|
|
||||||
|
@ -66,6 +67,7 @@ int xdp_prog1(struct xdp_md *ctx)
|
||||||
return rc;
|
return rc;
|
||||||
h_proto = vhdr->h_vlan_encapsulated_proto;
|
h_proto = vhdr->h_vlan_encapsulated_proto;
|
||||||
}
|
}
|
||||||
|
/* Handle double VLAN tagged packet */
|
||||||
if (h_proto == htons(ETH_P_8021Q) || h_proto == htons(ETH_P_8021AD)) {
|
if (h_proto == htons(ETH_P_8021Q) || h_proto == htons(ETH_P_8021AD)) {
|
||||||
struct vlan_hdr *vhdr;
|
struct vlan_hdr *vhdr;
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,7 @@ int xdp_prog1(struct xdp_md *ctx)
|
||||||
|
|
||||||
h_proto = eth->h_proto;
|
h_proto = eth->h_proto;
|
||||||
|
|
||||||
|
/* Handle VLAN tagged packet */
|
||||||
if (h_proto == htons(ETH_P_8021Q) || h_proto == htons(ETH_P_8021AD)) {
|
if (h_proto == htons(ETH_P_8021Q) || h_proto == htons(ETH_P_8021AD)) {
|
||||||
struct vlan_hdr *vhdr;
|
struct vlan_hdr *vhdr;
|
||||||
|
|
||||||
|
@ -82,6 +83,7 @@ int xdp_prog1(struct xdp_md *ctx)
|
||||||
return rc;
|
return rc;
|
||||||
h_proto = vhdr->h_vlan_encapsulated_proto;
|
h_proto = vhdr->h_vlan_encapsulated_proto;
|
||||||
}
|
}
|
||||||
|
/* Handle double VLAN tagged packet */
|
||||||
if (h_proto == htons(ETH_P_8021Q) || h_proto == htons(ETH_P_8021AD)) {
|
if (h_proto == htons(ETH_P_8021Q) || h_proto == htons(ETH_P_8021AD)) {
|
||||||
struct vlan_hdr *vhdr;
|
struct vlan_hdr *vhdr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue