You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #69 from xdp-project/tutorial31-improve-parsing
Change parse_ethhdr() to return network-byte-order
This fix#59.
One reason for not using bpf_ntohs() call on packet data (eth->h_proto) is that users of the
API can instead do compares against constants e.g. VLAN check bpf_htons(ETH_P_8021Q),
which will allow compiler to do this compile time (instead of runtime).
This is also changed, because in several places code access packet-headers eth->h_proto
directly (which is in network-byte-order) and at the same time the code also use
parse_ethhdr(),which before returned in host-byte-order.
Thus, I this makes the code more consistent.
E.g. before you could not use the result from parse_ethhdr() as input to proto_is_vlan().
0 commit comments