net: core: Pass the actual LL proto for DGRAM packet sockets
After L2 processing, the LL protocol type is already known and should be set accordingly on the packet. Therefore it can be passed to the net_packet_socket_input() function to allow proper socket filtering based on protocol. Additionally, as LL protocol type is 16 bit value, fix the proto parameter type in net_packet_socket_input(). Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
parent
b985b9437c
commit
edba291799
3 changed files with 4 additions and 4 deletions
|
@ -117,7 +117,7 @@ static inline enum net_verdict process_data(struct net_pkt *pkt,
|
||||||
/* Consecutive call will forward packets to SOCK_DGRAM packet sockets
|
/* Consecutive call will forward packets to SOCK_DGRAM packet sockets
|
||||||
* (after L2 removed header).
|
* (after L2 removed header).
|
||||||
*/
|
*/
|
||||||
ret = net_packet_socket_input(pkt, ETH_P_ALL);
|
ret = net_packet_socket_input(pkt, net_pkt_ll_proto_type(pkt));
|
||||||
if (ret != NET_CONTINUE) {
|
if (ret != NET_CONTINUE) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ LOG_MODULE_REGISTER(net_sockets_raw, CONFIG_NET_SOCKETS_LOG_LEVEL);
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
#include "packet_socket.h"
|
#include "packet_socket.h"
|
||||||
|
|
||||||
enum net_verdict net_packet_socket_input(struct net_pkt *pkt, uint8_t proto)
|
enum net_verdict net_packet_socket_input(struct net_pkt *pkt, uint16_t proto)
|
||||||
{
|
{
|
||||||
sa_family_t orig_family;
|
sa_family_t orig_family;
|
||||||
enum net_verdict net_verdict;
|
enum net_verdict net_verdict;
|
||||||
|
|
|
@ -26,10 +26,10 @@
|
||||||
* disabled, the function will always return NET_DROP.
|
* disabled, the function will always return NET_DROP.
|
||||||
*/
|
*/
|
||||||
#if defined(CONFIG_NET_SOCKETS_PACKET)
|
#if defined(CONFIG_NET_SOCKETS_PACKET)
|
||||||
enum net_verdict net_packet_socket_input(struct net_pkt *pkt, uint8_t proto);
|
enum net_verdict net_packet_socket_input(struct net_pkt *pkt, uint16_t proto);
|
||||||
#else
|
#else
|
||||||
static inline enum net_verdict net_packet_socket_input(struct net_pkt *pkt,
|
static inline enum net_verdict net_packet_socket_input(struct net_pkt *pkt,
|
||||||
uint8_t proto)
|
uint16_t proto)
|
||||||
{
|
{
|
||||||
return NET_CONTINUE;
|
return NET_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue