net: pkt: Add ll_proto_type field

The L2 protocol type information is not carried to the upper layers.
This is problematic for packet sockets, as the address structure in
recvfrom() is supposed to provide this information.

Fix this by adding ll_proto_type field in the net_pkt structure.
Set the protocol type in the Ethernet L2 when packet is processed.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2022-07-28 13:36:49 +02:00 committed by Carles Cufí
commit b5b5c29f2d
3 changed files with 14 additions and 0 deletions

View file

@ -274,6 +274,8 @@ static enum net_verdict ethernet_recv(struct net_if *iface,
lladdr->len = sizeof(struct net_eth_addr);
lladdr->type = NET_LINK_ETHERNET;
net_pkt_set_ll_proto_type(pkt, type);
if (net_eth_is_vlan_enabled(ctx, iface)) {
if (type == NET_ETH_PTYPE_VLAN ||
(eth_is_vlan_tag_stripped(iface) &&