MCPcopy Create free account
hub / github.com/F-Stack/f-stack / netdump_ioctl

Function netdump_ioctl

freebsd/netinet/netdump/netdump_client.c:461–658  ·  view source on GitHub ↗

* ioctl(2) handler for the netdump device. This is currently only used to * register netdump as a dump device. * * Parameters: * dev, Unused. * cmd, The ioctl to be handled. * addr, The parameter for the ioctl. * flags, Unused. * td, The thread invoking this ioctl. * * Returns: * 0 on success, and an errno value on failure. */

Source from the content-addressed store, hash-verified

459 * 0 on success, and an errno value on failure.
460 */
461static int
462netdump_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t addr,
463 int flags __unused, struct thread *td)
464{
465 struct diocskerneldump_arg kda_copy, *conf;
466 struct dumperinfo dumper;
467 uint8_t *encryptedkey;
468 int error;
469#ifdef COMPAT_FREEBSD11
470 u_int u;
471#endif
472#ifdef COMPAT_FREEBSD12
473 struct diocskerneldump_arg_freebsd12 *kda12;
474 struct netdump_conf_freebsd12 *conf12;
475#endif
476
477 conf = NULL;
478 error = 0;
479 NETDUMP_WLOCK();
480
481 switch (cmd) {
482#ifdef COMPAT_FREEBSD11
483 case DIOCSKERNELDUMP_FREEBSD11:
484 gone_in(13, "11.x ABI compatibility");
485 u = *(u_int *)addr;
486 if (u != 0) {
487 error = ENXIO;
488 break;
489 }
490 if (netdump_enabled())
491 netdump_unconfigure();
492 break;
493#endif
494#ifdef COMPAT_FREEBSD12
495 /*
496 * Used by dumpon(8) in 12.x for clearing previous
497 * configuration -- then NETDUMPSCONF_FREEBSD12 is used to
498 * actually configure netdump.
499 */
500 case DIOCSKERNELDUMP_FREEBSD12:
501 gone_in(14, "12.x ABI compatibility");
502
503 kda12 = (void *)addr;
504 if (kda12->kda12_enable) {
505 error = ENXIO;
506 break;
507 }
508 if (netdump_enabled())
509 netdump_unconfigure();
510 break;
511
512 case NETDUMPGCONF_FREEBSD12:
513 gone_in(14, "FreeBSD 12.x ABI compat");
514 conf12 = (void *)addr;
515
516 if (!netdump_enabled()) {
517 error = ENXIO;
518 break;

Callers

nothing calls this directly

Calls 13

netdump_enabledFunction · 0.85
netdump_unconfigureFunction · 0.85
memsetFunction · 0.85
explicit_bzeroFunction · 0.85
dumper_removeFunction · 0.85
netdump_configureFunction · 0.85
mallocFunction · 0.85
dumper_insertFunction · 0.85
strlcpyFunction · 0.50
memcpyFunction · 0.50
copyinFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected