File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,7 @@ static inline enum net_verdict process_icmpv6_pkt(struct net_pkt *pkt,
150
150
struct net_ipv6_hdr * ipv6 )
151
151
{
152
152
struct net_icmp_hdr icmp_hdr ;
153
+ u16_t chksum ;
153
154
int ret ;
154
155
155
156
ret = net_icmpv6_get_hdr (pkt , & icmp_hdr );
@@ -158,6 +159,16 @@ static inline enum net_verdict process_icmpv6_pkt(struct net_pkt *pkt,
158
159
return NET_DROP ;
159
160
}
160
161
162
+ chksum = icmp_hdr .chksum ;
163
+ net_icmpv6_set_chksum (pkt );
164
+ (void )net_icmpv6_get_hdr (pkt , & icmp_hdr );
165
+
166
+ if (chksum != icmp_hdr .chksum ) {
167
+ NET_DBG ("ICMPv6 invalid checksum (0x%04x instead of 0x%04x)" ,
168
+ ntohs (chksum ), ntohs (icmp_hdr .chksum ));
169
+ return NET_DROP ;
170
+ }
171
+
161
172
NET_DBG ("ICMPv6 %s received type %d code %d" ,
162
173
net_icmpv6_type2str (icmp_hdr .type ), icmp_hdr .type ,
163
174
icmp_hdr .code );
You can’t perform that action at this time.
0 commit comments