@@ -637,16 +637,14 @@ static void conn_raw_socket_deliver(struct net_pkt *pkt, struct net_conn *conn,
637637#endif /* defined(CONFIG_NET_SOCKETS_PACKET) || defined(CONFIG_NET_SOCKETS_INET_RAW) */
638638
639639#if defined(CONFIG_NET_SOCKETS_PACKET )
640- enum net_verdict net_conn_packet_input (struct net_pkt * pkt , uint16_t proto , enum net_sock_type type )
640+ void net_conn_packet_input (struct net_pkt * pkt , uint16_t proto , enum net_sock_type type )
641641{
642- bool raw_sock_found = false;
643- bool raw_pkt_continue = false;
644642 struct sockaddr_ll * local ;
645643 struct net_conn * conn ;
646644
647645 /* Only accept input with AF_PACKET family. */
648646 if (net_pkt_family (pkt ) != AF_PACKET ) {
649- return NET_CONTINUE ;
647+ return ;
650648 }
651649
652650 NET_DBG ("Check proto 0x%04x listener for pkt %p family %d" ,
@@ -666,33 +664,22 @@ enum net_verdict net_conn_packet_input(struct net_pkt *pkt, uint16_t proto, enum
666664 * in this packet.
667665 */
668666 if (conn -> family != AF_PACKET ) {
669- raw_pkt_continue = true;
670667 continue ; /* wrong family */
671668 }
672669
673- if (conn -> type == SOCK_DGRAM && type == SOCK_RAW ) {
674- /* If DGRAM packet sockets are present, we shall continue
675- * with this packet regardless the result.
676- */
677- raw_pkt_continue = true;
678- continue ; /* L2 not processed yet */
679- }
680-
681- if (conn -> type == SOCK_RAW && type != SOCK_RAW ) {
682- continue ; /* L2 already processed */
670+ if (conn -> type != type ) {
671+ continue ;
683672 }
684673
685674 if (conn -> proto == 0 ) {
686675 continue ; /* Local proto 0 doesn't forward any packets */
687676 }
688677
689- if (conn -> proto != proto ) {
690- /* Allow proto mismatch if socket was created with ETH_P_ALL, or it's raw
691- * packet socket input (proto ETH_P_ALL).
692- */
693- if (conn -> proto != ETH_P_ALL && proto != ETH_P_ALL ) {
694- continue ; /* wrong protocol */
695- }
678+ /* Allow proto mismatch if socket was created with ETH_P_ALL, or it's raw
679+ * packet socket input.
680+ */
681+ if (conn -> proto != proto && conn -> proto != ETH_P_ALL && type != SOCK_RAW ) {
682+ continue ; /* wrong protocol */
696683 }
697684
698685 /* Apply protocol-specific matching criteria... */
@@ -708,32 +695,17 @@ enum net_verdict net_conn_packet_input(struct net_pkt *pkt, uint16_t proto, enum
708695
709696 conn_raw_socket_deliver (pkt , conn , false);
710697
711- raw_sock_found = true;
712698 }
713699
714700 k_mutex_unlock (& conn_lock );
715701
716- if (!raw_pkt_continue && raw_sock_found ) {
717- /* As one or more raw socket packets have already been delivered
718- * in the loop above, report NET_OK.
719- */
720- net_pkt_unref (pkt );
721- return NET_OK ;
722- }
723-
724- /* When there is open connection different than AF_PACKET this
725- * packet shall be also handled in the upper net stack layers.
726- */
727- return NET_CONTINUE ;
728702}
729703#else
730- enum net_verdict net_conn_packet_input (struct net_pkt * pkt , uint16_t proto , enum net_sock_type type )
704+ void net_conn_packet_input (struct net_pkt * pkt , uint16_t proto , enum net_sock_type type )
731705{
732706 ARG_UNUSED (pkt );
733707 ARG_UNUSED (proto );
734708 ARG_UNUSED (type );
735-
736- return NET_CONTINUE ;
737709}
738710#endif /* defined(CONFIG_NET_SOCKETS_PACKET) */
739711
0 commit comments