@@ -637,16 +637,14 @@ static void conn_raw_socket_deliver(struct net_pkt *pkt, struct net_conn *conn,
637
637
#endif /* defined(CONFIG_NET_SOCKETS_PACKET) || defined(CONFIG_NET_SOCKETS_INET_RAW) */
638
638
639
639
#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 )
641
641
{
642
- bool raw_sock_found = false;
643
- bool raw_pkt_continue = false;
644
642
struct sockaddr_ll * local ;
645
643
struct net_conn * conn ;
646
644
647
645
/* Only accept input with AF_PACKET family. */
648
646
if (net_pkt_family (pkt ) != AF_PACKET ) {
649
- return NET_CONTINUE ;
647
+ return ;
650
648
}
651
649
652
650
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
666
664
* in this packet.
667
665
*/
668
666
if (conn -> family != AF_PACKET ) {
669
- raw_pkt_continue = true;
670
667
continue ; /* wrong family */
671
668
}
672
669
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 ;
683
672
}
684
673
685
674
if (conn -> proto == 0 ) {
686
675
continue ; /* Local proto 0 doesn't forward any packets */
687
676
}
688
677
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 */
696
683
}
697
684
698
685
/* Apply protocol-specific matching criteria... */
@@ -708,32 +695,17 @@ enum net_verdict net_conn_packet_input(struct net_pkt *pkt, uint16_t proto, enum
708
695
709
696
conn_raw_socket_deliver (pkt , conn , false);
710
697
711
- raw_sock_found = true;
712
698
}
713
699
714
700
k_mutex_unlock (& conn_lock );
715
701
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 ;
728
702
}
729
703
#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 )
731
705
{
732
706
ARG_UNUSED (pkt );
733
707
ARG_UNUSED (proto );
734
708
ARG_UNUSED (type );
735
-
736
- return NET_CONTINUE ;
737
709
}
738
710
#endif /* defined(CONFIG_NET_SOCKETS_PACKET) */
739
711
0 commit comments