Browse Source

[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 14 years ago
parent
commit
85a3169967
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      src/net/netdevice.c

+ 7
- 2
src/net/netdevice.c View File

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…
Cancel
Save