mirror of
https://github.com/ipxe/ipxe
synced 2025-12-23 13:30:57 +03:00
[neighbour] Add nstat() function to print out neighbour table
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -9,7 +9,11 @@
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER );
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ipxe/refcnt.h>
|
||||
#include <ipxe/list.h>
|
||||
#include <ipxe/netdevice.h>
|
||||
#include <ipxe/retry.h>
|
||||
|
||||
/** A neighbour discovery protocol */
|
||||
struct neighbour_discovery {
|
||||
@@ -29,6 +33,46 @@ struct neighbour_discovery {
|
||||
const void *net_dest, const void *net_source );
|
||||
};
|
||||
|
||||
/** A neighbour cache entry */
|
||||
struct neighbour {
|
||||
/** Reference count */
|
||||
struct refcnt refcnt;
|
||||
/** List of neighbour cache entries */
|
||||
struct list_head list;
|
||||
|
||||
/** Network device */
|
||||
struct net_device *netdev;
|
||||
/** Network-layer protocol */
|
||||
struct net_protocol *net_protocol;
|
||||
/** Network-layer destination address */
|
||||
uint8_t net_dest[MAX_NET_ADDR_LEN];
|
||||
/** Link-layer destination address */
|
||||
uint8_t ll_dest[MAX_LL_ADDR_LEN];
|
||||
|
||||
/** Neighbour discovery protocol (if any) */
|
||||
struct neighbour_discovery *discovery;
|
||||
/** Network-layer source address (if any) */
|
||||
uint8_t net_source[MAX_NET_ADDR_LEN];
|
||||
/** Retransmission timer */
|
||||
struct retry_timer timer;
|
||||
|
||||
/** Pending I/O buffers */
|
||||
struct list_head tx_queue;
|
||||
};
|
||||
|
||||
/**
|
||||
* Test if neighbour cache entry has a valid link-layer address
|
||||
*
|
||||
* @v neighbour Neighbour cache entry
|
||||
* @ret has_ll_dest Neighbour cache entry has a valid link-layer address
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int
|
||||
neighbour_has_ll_dest ( struct neighbour *neighbour ) {
|
||||
return ( ! timer_running ( &neighbour->timer ) );
|
||||
}
|
||||
|
||||
extern struct list_head neighbours;
|
||||
|
||||
extern int neighbour_tx ( struct io_buffer *iobuf, struct net_device *netdev,
|
||||
struct net_protocol *net_protocol,
|
||||
const void *net_dest,
|
||||
|
||||
14
src/include/usr/neighmgmt.h
Normal file
14
src/include/usr/neighmgmt.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef _USR_NEIGHMGMT_H
|
||||
#define _USR_NEIGHMGMT_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Neighbour management
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER );
|
||||
|
||||
extern void nstat ( void );
|
||||
|
||||
#endif /* _USR_NEIGHMGMT_H */
|
||||
Reference in New Issue
Block a user