FreeBSD kernel IPv4 code
|
#include <sys/cdefs.h>
#include "opt_ddb.h"
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/disk.h>
#include <sys/endian.h>
#include <sys/eventhandler.h>
#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/kerneldump.h>
#include <sys/mbuf.h>
#include <sys/module.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
#include <sys/systm.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <net/if_dl.h>
#include <net/if_types.h>
#include <net/if_var.h>
#include <net/debugnet.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/in_var.h>
#include <netinet/ip.h>
#include <netinet/ip_var.h>
#include <netinet/ip_options.h>
#include <netinet/udp.h>
#include <netinet/udp_var.h>
#include <netinet/netdump/netdump.h>
#include <machine/in_cksum.h>
#include <machine/pcb.h>
Go to the source code of this file.
Macros | |
#define | NETDDEBUGV(f, ...) |
#define | nd_server nd_conf.ndc_server.in4 |
#define | nd_client nd_conf.ndc_client.in4 |
#define | nd_gateway nd_conf.ndc_gateway.in4 |
#define | NETDUMP_WLOCK() sx_xlock(&nd_conf_lk) |
#define | NETDUMP_WUNLOCK() sx_xunlock(&nd_conf_lk) |
#define | NETDUMP_RLOCK() sx_slock(&nd_conf_lk) |
#define | NETDUMP_RUNLOCK() sx_sunlock(&nd_conf_lk) |
#define | NETDUMP_ASSERT_WLOCKED() sx_assert(&nd_conf_lk, SA_XLOCKED) |
#define | NETDUMP_ASSERT_LOCKED() sx_assert(&nd_conf_lk, SA_LOCKED) |
#define | COPY_SIZED(elm) |
Functions | |
__FBSDID ("$FreeBSD$") | |
static void | netdump_cleanup (void) |
static int | netdump_configure (struct diocskerneldump_arg *, struct thread *) |
static int | netdump_dumper (void *priv __unused, void *virtual, vm_offset_t physical __unused, off_t offset, size_t length) |
static bool | netdump_enabled (void) |
static int | netdump_enabled_sysctl (SYSCTL_HANDLER_ARGS) |
static int | netdump_ioctl (struct cdev *dev __unused, u_long cmd, caddr_t addr, int flags __unused, struct thread *td) |
static int | netdump_modevent (module_t mod, int type, void *priv) |
static int | netdump_start (struct dumperinfo *di, void *key, uint32_t keysize) |
static void | netdump_unconfigure (void) |
SX_SYSINIT (nd_conf, &nd_conf_lk, "netdump configuration lock") | |
FEATURE (netdump, "Netdump client support") | |
static | SYSCTL_NODE (_net, OID_AUTO, netdump, CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, "netdump parameters") |
SYSCTL_INT (_net_netdump, OID_AUTO, debug, CTLFLAG_RWTUN, &nd_debug, 0, "Debug message verbosity") | |
SYSCTL_PROC (_net_netdump, OID_AUTO, enabled, CTLFLAG_RD|CTLTYPE_INT|CTLFLAG_MPSAFE, NULL, 0, netdump_enabled_sysctl, "I", "netdump configuration status") | |
SYSCTL_STRING (_net_netdump, OID_AUTO, path, CTLFLAG_RW, nd_path, sizeof(nd_path), "Server path for output files") | |
SYSCTL_INT (_net_netdump, OID_AUTO, polls, CTLFLAG_RWTUN, &debugnet_npolls, 0, "Number of times to poll before assuming packet loss (0.5ms per poll)") | |
SYSCTL_INT (_net_netdump, OID_AUTO, retries, CTLFLAG_RWTUN, &debugnet_nretries, 0, "Number of retransmit attempts before giving up") | |
SYSCTL_INT (_net_netdump, OID_AUTO, arp_retries, CTLFLAG_RWTUN, &debugnet_arp_nretries, 0, "Number of ARP attempts before giving up") | |
static void | netdump_set_enabled (bool status) |
static int | netdump_flush_buf (void) |
static int | netdump_write_headers (struct dumperinfo *di, struct kerneldumpheader *kdh) |
static void | netdump_ifdetach (void *arg __unused, struct ifnet *ifp) |
static int | netdump_modevent (module_t mod __unused, int what, void *priv __unused) |
MODULE_VERSION (netdump, 1) | |
DECLARE_MODULE (netdump, netdump_mod, SI_SUB_PSEUDO, SI_ORDER_ANY) | |
Variables | |
static unsigned char | nd_buf [MAXDUMPPGS *PAGE_SIZE] |
static int | dump_failed |
struct { | |
char ndc_iface [IFNAMSIZ] | |
union kd_ip ndc_server | |
union kd_ip ndc_client | |
union kd_ip ndc_gateway | |
uint8_t ndc_af | |
struct debugnet_pcb * nd_pcb | |
off_t nd_tx_off | |
size_t nd_buf_len | |
} | nd_conf |
static struct sx | nd_conf_lk |
static struct ifnet * | nd_ifp |
static eventhandler_tag | nd_detach_cookie |
static int | nd_debug |
static char | nd_path [MAXPATHLEN] |
static bool | nd_is_enabled |
static struct cdevsw | netdump_cdevsw |
static struct cdev * | netdump_cdev |
static moduledata_t | netdump_mod |
#define COPY_SIZED | ( | elm | ) |
#define nd_client nd_conf.ndc_client.in4 |
Definition at line 119 of file netdump_client.c.
#define nd_gateway nd_conf.ndc_gateway.in4 |
Definition at line 120 of file netdump_client.c.
#define nd_server nd_conf.ndc_server.in4 |
Definition at line 118 of file netdump_client.c.
#define NETDDEBUGV | ( | f, | |
... | |||
) |
Definition at line 83 of file netdump_client.c.
#define NETDUMP_ASSERT_LOCKED | ( | ) | sx_assert(&nd_conf_lk, SA_LOCKED) |
Definition at line 130 of file netdump_client.c.
#define NETDUMP_ASSERT_WLOCKED | ( | ) | sx_assert(&nd_conf_lk, SA_XLOCKED) |
Definition at line 129 of file netdump_client.c.
#define NETDUMP_RLOCK | ( | ) | sx_slock(&nd_conf_lk) |
Definition at line 127 of file netdump_client.c.
#define NETDUMP_RUNLOCK | ( | ) | sx_sunlock(&nd_conf_lk) |
Definition at line 128 of file netdump_client.c.
#define NETDUMP_WLOCK | ( | ) | sx_xlock(&nd_conf_lk) |
Definition at line 125 of file netdump_client.c.
#define NETDUMP_WUNLOCK | ( | ) | sx_xunlock(&nd_conf_lk) |
Definition at line 126 of file netdump_client.c.
__FBSDID | ( | "$FreeBSD$" | ) |
DECLARE_MODULE | ( | netdump | , |
netdump_mod | , | ||
SI_SUB_PSEUDO | , | ||
SI_ORDER_ANY | |||
) |
FEATURE | ( | netdump | , |
"Netdump client support" | |||
) |
MODULE_VERSION | ( | netdump | , |
1 | |||
) |
|
static |
Definition at line 387 of file netdump_client.c.
References nd_conf.
Referenced by netdump_dumper(), netdump_start(), and netdump_write_headers().
|
static |
Definition at line 445 of file netdump_client.c.
References COPY_SIZED, nd_ifp, NETDUMP_ASSERT_WLOCKED, and netdump_set_enabled().
Referenced by netdump_ioctl(), and netdump_modevent().
|
static |
Definition at line 239 of file netdump_client.c.
References dump_failed, nd_buf, nd_conf, NETDDEBUGV, netdump_cleanup(), and netdump_flush_buf().
Referenced by netdump_ioctl().
|
static |
Definition at line 167 of file netdump_client.c.
References nd_is_enabled, and NETDUMP_ASSERT_LOCKED.
Referenced by netdump_enabled_sysctl(), netdump_ioctl(), netdump_modevent(), netdump_start(), and netdump_unconfigure().
|
static |
Definition at line 183 of file netdump_client.c.
References netdump_enabled(), NETDUMP_RLOCK, and NETDUMP_RUNLOCK.
|
static |
Definition at line 205 of file netdump_client.c.
References nd_buf, and nd_conf.
Referenced by netdump_dumper(), and netdump_write_headers().
|
static |
Definition at line 431 of file netdump_client.c.
References nd_ifp, netdump_unconfigure(), NETDUMP_WLOCK, and NETDUMP_WUNLOCK.
Referenced by netdump_modevent().
|
static |
Definition at line 496 of file netdump_client.c.
References nd_client, nd_conf, nd_gateway, nd_ifp, nd_server, netdump_conf_freebsd12::ndc12_client, netdump_conf_freebsd12::ndc12_gateway, netdump_conf_freebsd12::ndc12_iface, netdump_conf_freebsd12::ndc12_kda, netdump_conf_freebsd12::ndc12_server, netdump_configure(), NETDUMP_DATASIZE, netdump_dumper(), netdump_enabled(), netdump_start(), netdump_unconfigure(), NETDUMP_WLOCK, netdump_write_headers(), NETDUMP_WUNLOCK, NETDUMPGCONF_FREEBSD12, and NETDUMPSCONF_FREEBSD12.
|
static |
Definition at line 708 of file netdump_client.c.
References inet_aton(), nd_detach_cookie, netdump_cdev, netdump_cdevsw, netdump_configure(), netdump_enabled(), netdump_ifdetach(), netdump_unconfigure(), NETDUMP_WLOCK, and NETDUMP_WUNLOCK.
|
static |
|
static |
Definition at line 175 of file netdump_client.c.
References nd_is_enabled, and NETDUMP_ASSERT_LOCKED.
Referenced by netdump_configure(), and netdump_unconfigure().
|
static |
Definition at line 289 of file netdump_client.c.
References INADDR_ANY, inet_ntoa_r(), nd_buf, nd_client, nd_conf, nd_gateway, nd_ifp, nd_path, nd_server, NETDUMP_ACKPORT, netdump_cleanup(), NETDUMP_EKCD_KEY, netdump_enabled(), and NETDUMP_PORT.
Referenced by netdump_ioctl().
|
static |
Definition at line 408 of file netdump_client.c.
References nd_conf, nd_ifp, NETDUMP_ASSERT_WLOCKED, netdump_enabled(), and netdump_set_enabled().
Referenced by netdump_ifdetach(), netdump_ioctl(), and netdump_modevent().
|
static |
Definition at line 367 of file netdump_client.c.
References nd_buf, nd_conf, netdump_cleanup(), netdump_flush_buf(), and NETDUMP_KDH.
Referenced by netdump_ioctl().
SX_SYSINIT | ( | nd_conf | , |
& | nd_conf_lk, | ||
"netdump configuration lock" | |||
) |
SYSCTL_INT | ( | _net_netdump | , |
OID_AUTO | , | ||
arp_retries | , | ||
CTLFLAG_RWTUN | , | ||
& | debugnet_arp_nretries, | ||
0 | , | ||
"Number of ARP attempts before giving up" | |||
) |
SYSCTL_INT | ( | _net_netdump | , |
OID_AUTO | , | ||
debug | , | ||
CTLFLAG_RWTUN | , | ||
& | nd_debug, | ||
0 | , | ||
"Debug message verbosity" | |||
) |
SYSCTL_INT | ( | _net_netdump | , |
OID_AUTO | , | ||
polls | , | ||
CTLFLAG_RWTUN | , | ||
& | debugnet_npolls, | ||
0 | , | ||
"Number of times to poll before assuming packet loss (0.5ms per poll)" | |||
) |
SYSCTL_INT | ( | _net_netdump | , |
OID_AUTO | , | ||
retries | , | ||
CTLFLAG_RWTUN | , | ||
& | debugnet_nretries, | ||
0 | , | ||
"Number of retransmit attempts before giving up" | |||
) |
|
static |
SYSCTL_PROC | ( | _net_netdump | , |
OID_AUTO | , | ||
enabled | , | ||
CTLFLAG_RD|CTLTYPE_INT| | CTLFLAG_MPSAFE, | ||
NULL | , | ||
0 | , | ||
netdump_enabled_sysctl | , | ||
"I" | , | ||
"netdump configuration status" | |||
) |
SYSCTL_STRING | ( | _net_netdump | , |
OID_AUTO | , | ||
path | , | ||
CTLFLAG_RW | , | ||
nd_path | , | ||
sizeof(nd_path) | , | ||
"Server path for output files" | |||
) |
|
static |
Definition at line 104 of file netdump_client.c.
Referenced by netdump_dumper().
|
static |
Definition at line 103 of file netdump_client.c.
Referenced by netdump_dumper(), netdump_flush_buf(), netdump_start(), and netdump_write_headers().
size_t nd_buf_len |
Definition at line 116 of file netdump_client.c.
struct { ... } nd_conf |
|
static |
Definition at line 123 of file netdump_client.c.
|
static |
Definition at line 139 of file netdump_client.c.
|
static |
Definition at line 132 of file netdump_client.c.
Referenced by netdump_modevent().
|
static |
Definition at line 131 of file netdump_client.c.
Referenced by netdump_configure(), netdump_ifdetach(), netdump_ioctl(), netdump_start(), and netdump_unconfigure().
|
static |
Definition at line 165 of file netdump_client.c.
Referenced by netdump_enabled(), and netdump_set_enabled().
|
static |
Definition at line 147 of file netdump_client.c.
Referenced by netdump_start().
struct debugnet_pcb* nd_pcb |
Definition at line 114 of file netdump_client.c.
off_t nd_tx_off |
Definition at line 115 of file netdump_client.c.
uint8_t ndc_af |
Definition at line 112 of file netdump_client.c.
union kd_ip ndc_client |
Definition at line 110 of file netdump_client.c.
union kd_ip ndc_gateway |
Definition at line 111 of file netdump_client.c.
char ndc_iface[IFNAMSIZ] |
Definition at line 108 of file netdump_client.c.
union kd_ip ndc_server |
Definition at line 109 of file netdump_client.c.
|
static |
Definition at line 405 of file netdump_client.c.
Referenced by netdump_modevent().
|
static |
Definition at line 399 of file netdump_client.c.
Referenced by netdump_modevent().
|
static |
Definition at line 767 of file netdump_client.c.