From: tobhe Date: Mon, 14 Aug 2023 12:02:02 +0000 (+0000) Subject: Improve error message when if_indextoname() fails. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3cd1d0b52114484c83ca78f2a1eb2712035b4e60;p=openbsd Improve error message when if_indextoname() fails. --- diff --git a/sbin/iked/pfkey.c b/sbin/iked/pfkey.c index 80a931d5132..ac9e79c20df 100644 --- a/sbin/iked/pfkey.c +++ b/sbin/iked/pfkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkey.c,v 1.83 2023/08/11 11:24:55 tobhe Exp $ */ +/* $OpenBSD: pfkey.c,v 1.84 2023/08/14 12:02:02 tobhe Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter @@ -697,9 +697,9 @@ pfkey_sa(struct iked *env, uint8_t satype, uint8_t action, struct iked_childsa * if (pol->pol_flags & IKED_POLICY_ROUTING) { sa_iface.sadb_x_iface_exttype = SADB_X_EXT_IFACE; sa_iface.sadb_x_iface_len = sizeof(sa_iface) / 8; - if (if_indextoname(pol->pol_iface, iface) == NULL) { - log_warnx("%s: unsupported interface %s", - __func__, iface); + if (if_indextoname(pol->pol_iface, iface) == 0) { + log_warn("%s: unsupported interface %d", + __func__, pol->pol_iface); return (-1); } ifminor = strtonum(iface + strlen("sec"), 0, UINT_MAX, &errstr);