1 /** @file 2 * @brief Packet Sockets related functions 3 */ 4 5 /* 6 * Copyright (c) 2019 Intel Corporation 7 * 8 * SPDX-License-Identifier: Apache-2.0 9 */ 10 11 #include <zephyr/logging/log.h> 12 LOG_MODULE_REGISTER(net_sockets_raw, CONFIG_NET_SOCKETS_LOG_LEVEL); 13 14 #include <errno.h> 15 #include <zephyr/net/net_pkt.h> 16 #include <zephyr/net/net_context.h> 17 #include <zephyr/net/ethernet.h> 18 #if defined(CONFIG_NET_DSA_DEPRECATED) 19 #include <zephyr/net/dsa.h> 20 #endif 21 22 #include "connection.h" 23 #include "packet_socket.h" 24 net_packet_socket_input(struct net_pkt * pkt,uint16_t proto,enum net_sock_type type)25void net_packet_socket_input(struct net_pkt *pkt, 26 uint16_t proto, 27 enum net_sock_type type) 28 { 29 net_sa_family_t orig_family; 30 31 #if defined(CONFIG_NET_DSA_DEPRECATED) 32 /* 33 * For DSA the master port is not supporting raw packets. Only the 34 * lan1..3 are working with them. 35 */ 36 if (dsa_is_port_master(net_pkt_iface(pkt))) { 37 return; 38 } 39 #endif 40 41 orig_family = net_pkt_family(pkt); 42 43 net_pkt_set_family(pkt, NET_AF_PACKET); 44 45 net_conn_packet_input(pkt, proto, type); 46 47 net_pkt_set_family(pkt, orig_family); 48 } 49