diff options
author | Michael Brown | 2014-03-02 21:33:35 +0100 |
---|---|---|
committer | Michael Brown | 2014-03-02 21:33:35 +0100 |
commit | 11963c4f5f235c07380e4004082ca0bcf4aefa40 (patch) | |
tree | 85310531a78e1ed1387b3a80937cc4c508172151 /src/net/tcpip.c | |
parent | [image] Ensure every image has a fully resolved URI (diff) | |
download | ipxe-11963c4f5f235c07380e4004082ca0bcf4aefa40.tar.gz ipxe-11963c4f5f235c07380e4004082ca0bcf4aefa40.tar.xz ipxe-11963c4f5f235c07380e4004082ca0bcf4aefa40.zip |
[tcpip] Add IP statistics collection as per RFC 4293
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/tcpip.c')
-rw-r--r-- | src/net/tcpip.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/net/tcpip.c b/src/net/tcpip.c index 0e467144..0b2adfd9 100644 --- a/src/net/tcpip.c +++ b/src/net/tcpip.c @@ -5,6 +5,7 @@ #include <byteswap.h> #include <ipxe/iobuf.h> #include <ipxe/tables.h> +#include <ipxe/ipstat.h> #include <ipxe/tcpip.h> /** @file @@ -25,6 +26,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); * @v st_src Partially-filled source address * @v st_dest Partially-filled destination address * @v pshdr_csum Pseudo-header checksum + * @v stats IP statistics * @ret rc Return status code * * This function expects a transport-layer segment from the network @@ -35,20 +37,22 @@ FILE_LICENCE ( GPL2_OR_LATER ); */ int tcpip_rx ( struct io_buffer *iobuf, struct net_device *netdev, uint8_t tcpip_proto, struct sockaddr_tcpip *st_src, - struct sockaddr_tcpip *st_dest, - uint16_t pshdr_csum ) { + struct sockaddr_tcpip *st_dest, uint16_t pshdr_csum, + struct ip_statistics *stats ) { struct tcpip_protocol *tcpip; /* Hand off packet to the appropriate transport-layer protocol */ for_each_table_entry ( tcpip, TCPIP_PROTOCOLS ) { if ( tcpip->tcpip_proto == tcpip_proto ) { DBG ( "TCP/IP received %s packet\n", tcpip->name ); + stats->in_delivers++; return tcpip->rx ( iobuf, netdev, st_src, st_dest, pshdr_csum ); } } DBG ( "Unrecognised TCP/IP protocol %d\n", tcpip_proto ); + stats->in_unknown_protos++; free_iob ( iobuf ); return -EPROTONOSUPPORT; } |