瀏覽代碼

[netdevice] Report network-layer errors via network device statistics

Errors generated by the network layer in response to received packets
are liable to be lost, since nothing systematically records these
errors and often the packets do not propagate far enough through the
stack to impact upon user-visible processes.

Improve this situation by recording network-layer errors in the
network device statistics.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 15 年之前
父節點
當前提交
85a3169967
共有 1 個檔案被更改,包括 7 行新增2 行删除
  1. 7
    2
      src/net/netdevice.c

+ 7
- 2
src/net/netdevice.c 查看文件

658
 	DBGC ( netdev, "NETDEV %p unknown network protocol %04x\n",
658
 	DBGC ( netdev, "NETDEV %p unknown network protocol %04x\n",
659
 	       netdev, ntohs ( net_proto ) );
659
 	       netdev, ntohs ( net_proto ) );
660
 	free_iob ( iobuf );
660
 	free_iob ( iobuf );
661
-	return 0;
661
+	return -ENOTSUP;
662
 }
662
 }
663
 
663
 
664
 /**
664
 /**
705
 				continue;
705
 				continue;
706
 			}
706
 			}
707
 
707
 
708
-			net_rx ( iobuf, netdev, net_proto, ll_source );
708
+			/* Hand packet to network layer */
709
+			if ( ( rc = net_rx ( iob_disown ( iobuf ), netdev,
710
+					     net_proto, ll_source ) ) != 0 ) {
711
+				/* Record error for diagnosis */
712
+				netdev_rx_err ( netdev, NULL, rc );
713
+			}
709
 		}
714
 		}
710
 	}
715
 	}
711
 }
716
 }

Loading…
取消
儲存