瀏覽代碼

iphdr->hlen includes the IP header, so truncate packet *before*

stripping the header.  Also fix an htons/ntohs confusion.
tags/v0.9.3
Michael Brown 18 年之前
父節點
當前提交
867c7aef59
共有 1 個檔案被更改,包括 1 行新增1 行删除
  1. 1
    1
      src/net/ipv4.c

+ 1
- 1
src/net/ipv4.c 查看文件

@@ -441,8 +441,8 @@ static int ipv4_rx ( struct pk_buff *pkb, struct net_device *netdev __unused,
441 441
 	dest.sin.sin_addr = iphdr->dest;
442 442
 
443 443
 	/* Strip header */
444
+	pkb_unput ( pkb, pkb_len ( pkb ) - ntohs ( iphdr->len ) );
444 445
 	pkb_pull ( pkb, sizeof ( *iphdr ) );
445
-	pkb_unput ( pkb, pkb_len ( pkb ) - htons ( iphdr->len ) );
446 446
 
447 447
 	/* Send it to the transport layer */
448 448
 	return tcpip_rx ( pkb, iphdr->protocol, &src.st, &dest.st );

Loading…
取消
儲存