File tree Expand file tree Collapse file tree 2 files changed +19
-8
lines changed
Expand file tree Collapse file tree 2 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,10 @@ int net_icmpv4_finalize(struct net_pkt *pkt)
6565 return - ENOBUFS ;
6666 }
6767
68- icmp_hdr -> chksum = net_calc_chksum_icmpv4 (pkt );
68+ icmp_hdr -> chksum = 0U ;
69+ if (net_if_need_calc_tx_checksum (net_pkt_iface (pkt ))) {
70+ icmp_hdr -> chksum = net_calc_chksum_icmpv4 (pkt );
71+ }
6972
7073 return net_pkt_set_data (pkt , & icmpv4_access );
7174}
@@ -688,9 +691,11 @@ enum net_verdict net_icmpv4_input(struct net_pkt *pkt,
688691 return NET_DROP ;
689692 }
690693
691- if (net_calc_chksum_icmpv4 (pkt ) != 0U ) {
692- NET_DBG ("DROP: Invalid checksum" );
693- goto drop ;
694+ if (net_if_need_calc_rx_checksum (net_pkt_iface (pkt ))) {
695+ if (net_calc_chksum_icmpv4 (pkt ) != 0U ) {
696+ NET_DBG ("DROP: Invalid checksum" );
697+ goto drop ;
698+ }
694699 }
695700
696701 if (net_ipv4_is_addr_bcast (net_pkt_iface (pkt ),
Original file line number Diff line number Diff line change @@ -79,7 +79,10 @@ int net_icmpv6_finalize(struct net_pkt *pkt)
7979 return - ENOBUFS ;
8080 }
8181
82- icmp_hdr -> chksum = net_calc_chksum_icmpv6 (pkt );
82+ icmp_hdr -> chksum = 0U ;
83+ if (net_if_need_calc_rx_checksum (net_pkt_iface (pkt ))) {
84+ icmp_hdr -> chksum = net_calc_chksum_icmpv6 (pkt );
85+ }
8386
8487 return net_pkt_set_data (pkt , & icmp_access );
8588}
@@ -409,9 +412,12 @@ enum net_verdict net_icmpv6_input(struct net_pkt *pkt,
409412 return NET_DROP ;
410413 }
411414
412- if (net_calc_chksum_icmpv6 (pkt ) != 0U ) {
413- NET_DBG ("DROP: invalid checksum" );
414- goto drop ;
415+
416+ if (net_if_need_calc_rx_checksum (net_pkt_iface (pkt ))) {
417+ if (net_calc_chksum_icmpv6 (pkt ) != 0U ) {
418+ NET_DBG ("DROP: invalid checksum" );
419+ goto drop ;
420+ }
415421 }
416422
417423 net_pkt_acknowledge_data (pkt , & icmp_access );
You can’t perform that action at this time.
0 commit comments