瀏覽代碼

Allow empty checksums on received packets

tags/v0.9.3
Michael Brown 18 年之前
父節點
當前提交
20681d6168
共有 1 個檔案被更改,包括 8 行新增6 行删除
  1. 8
    6
      src/net/udp.c

+ 8
- 6
src/net/udp.c 查看文件

@@ -239,12 +239,14 @@ static int udp_rx ( struct pk_buff *pkb, struct sockaddr_tcpip *st_src,
239 239
 		rc = -EINVAL;
240 240
 		goto done;
241 241
 	}
242
-	csum = tcpip_continue_chksum ( pshdr_csum, pkb->data, ulen );
243
-	if ( csum != 0 ) {
244
-		DBG ( "UDP checksum incorrect (is %04x including checksum "
245
-		      "field, should be 0000)\n", csum );
246
-		rc = -EINVAL;
247
-		goto done;
242
+	if ( udphdr->chksum ) {
243
+		csum = tcpip_continue_chksum ( pshdr_csum, pkb->data, ulen );
244
+		if ( csum != 0 ) {
245
+			DBG ( "UDP checksum incorrect (is %04x including "
246
+			      "checksum field, should be 0000)\n", csum );
247
+			rc = -EINVAL;
248
+			goto done;
249
+		}
248 250
 	}
249 251
 
250 252
 	/* Parse parameters from header and strip header */

Loading…
取消
儲存