aboutsummaryrefslogtreecommitdiff
path: root/sbin/ifconfig/ifipsec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/ifconfig/ifipsec.c')
-rw-r--r--sbin/ifconfig/ifipsec.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sbin/ifconfig/ifipsec.c b/sbin/ifconfig/ifipsec.c
index 929cc56bdcdf..2d9790208858 100644
--- a/sbin/ifconfig/ifipsec.c
+++ b/sbin/ifconfig/ifipsec.c
@@ -54,9 +54,9 @@ static void
ipsec_status(if_ctx *ctx)
{
uint32_t reqid;
+ struct ifreq ifr = { .ifr_data = (caddr_t)&reqid };
- ifr.ifr_data = (caddr_t)&reqid;
- if (ioctl_ctx(ctx, IPSECGREQID, &ifr) == -1)
+ if (ioctl_ctx_ifr(ctx, IPSECGREQID, &ifr) == -1)
return;
printf("\treqid: %u\n", reqid);
}
@@ -66,15 +66,14 @@ setreqid(if_ctx *ctx, const char *val, int dummy __unused)
{
char *ep;
uint32_t v;
+ struct ifreq ifr = { .ifr_data = (caddr_t)&v };
v = strtoul(val, &ep, 0);
if (*ep != '\0') {
warn("Invalid reqid value %s", val);
return;
}
- strlcpy(ifr.ifr_name, ctx->ifname, sizeof(ifr.ifr_name));
- ifr.ifr_data = (char *)&v;
- if (ioctl_ctx(ctx, IPSECSREQID, &ifr) == -1) {
+ if (ioctl_ctx_ifr(ctx, IPSECSREQID, &ifr) == -1) {
warn("ioctl(IPSECSREQID)");
return;
}