* td of NULL is a sentinel value that indicates a kernel caller (ddb(4) or * modload-based tunable parameters). */
| 408 | * modload-based tunable parameters). |
| 409 | */ |
| 410 | static int |
| 411 | netdump_configure(struct diocskerneldump_arg *conf, struct thread *td) |
| 412 | { |
| 413 | struct ifnet *ifp; |
| 414 | |
| 415 | NETDUMP_ASSERT_WLOCKED(); |
| 416 | |
| 417 | if (conf->kda_iface[0] != 0) { |
| 418 | if (td != NULL && !IS_DEFAULT_VNET(TD_TO_VNET(td))) |
| 419 | return (EINVAL); |
| 420 | CURVNET_SET(vnet0); |
| 421 | ifp = ifunit_ref(conf->kda_iface); |
| 422 | CURVNET_RESTORE(); |
| 423 | } else |
| 424 | ifp = NULL; |
| 425 | |
| 426 | if (nd_ifp != NULL) |
| 427 | if_rele(nd_ifp); |
| 428 | nd_ifp = ifp; |
| 429 | netdump_set_enabled(true); |
| 430 | |
| 431 | #define COPY_SIZED(elm) do { \ |
| 432 | _Static_assert(sizeof(nd_conf.ndc_ ## elm) == \ |
| 433 | sizeof(conf->kda_ ## elm), "elm " __XSTRING(elm) " mismatch"); \ |
| 434 | memcpy(&nd_conf.ndc_ ## elm, &conf->kda_ ## elm, \ |
| 435 | sizeof(nd_conf.ndc_ ## elm)); \ |
| 436 | } while (0) |
| 437 | COPY_SIZED(iface); |
| 438 | COPY_SIZED(server); |
| 439 | COPY_SIZED(client); |
| 440 | COPY_SIZED(gateway); |
| 441 | COPY_SIZED(af); |
| 442 | #undef COPY_SIZED |
| 443 | |
| 444 | return (0); |
| 445 | } |
| 446 | |
| 447 | /* |
| 448 | * ioctl(2) handler for the netdump device. This is currently only used to |
no test coverage detected