Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/if_wg/module/module.c
Show First 20 Lines • Show All 173 Lines • ▼ Show 20 Lines | if (copyin(iov.iov_base, packed, size)) { | ||||
goto out; | goto out; | ||||
} | } | ||||
nvl = nvlist_unpack(packed, size, 0); | nvl = nvlist_unpack(packed, size, 0); | ||||
if (nvl == NULL) { | if (nvl == NULL) { | ||||
device_printf(dev, "%s nvlist_unpack failed\n", __func__); | device_printf(dev, "%s nvlist_unpack failed\n", __func__); | ||||
err = EBADMSG; | err = EBADMSG; | ||||
goto out; | goto out; | ||||
} | } | ||||
if (!nvlist_exists_number(nvl, "listen-port")) { | |||||
device_printf(dev, "%s listen-port not set\n", __func__); | |||||
err = EBADMSG; | |||||
goto nvl_out; | |||||
} | |||||
listen_port = nvlist_get_number(nvl, "listen-port"); | |||||
/* wg_socket_bind() will update with the chosen port if omitted. */ | |||||
listen_port = 0; | |||||
if (nvlist_exists_number(nvl, "listen-port")) | |||||
listen_port = nvlist_get_number(nvl, "listen-port"); | |||||
if (!nvlist_exists_binary(nvl, "private-key")) { | if (!nvlist_exists_binary(nvl, "private-key")) { | ||||
device_printf(dev, "%s private-key not set\n", __func__); | device_printf(dev, "%s private-key not set\n", __func__); | ||||
err = EBADMSG; | err = EBADMSG; | ||||
goto nvl_out; | goto nvl_out; | ||||
} | } | ||||
key = nvlist_get_binary(nvl, "private-key", &size); | key = nvlist_get_binary(nvl, "private-key", &size); | ||||
if (size != CURVE25519_KEY_SIZE) { | if (size != CURVE25519_KEY_SIZE) { | ||||
device_printf(dev, "%s bad length for private-key %zu\n", __func__, size); | device_printf(dev, "%s bad length for private-key %zu\n", __func__, size); | ||||
▲ Show 20 Lines • Show All 758 Lines • Show Last 20 Lines |