From nobody Fri Jul 12 11:25:01 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QQ1JhQz5QBjy; Fri, 12 Jul 2024 11:25:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QP6XK9z4j0V; Fri, 12 Jul 2024 11:25:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783501; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BM3KnbFWn0CANTbNLRZWWhDMxjrDVwCLgNvUsx83xTw=; b=Xa/a+k7K6kysLgM2jk98WVJVskokA4tJOSJ2vAVM6vRzNC1y5udoYd0VZd/nw3PB53nl4S VcFClywSSgTuDozqWCRqOuahAMgXUEATfq+3Vw4ULN4dOob+1EBLyyh6GuSqSLR+a3lUQV AH/AH0ywbld9VS+SW8L01tt9qBx47DxnIrTFnd3Ud8Zn7vFWDt2PyLB7pKdFi8O4zSGzD0 Tjw4cvoN3v7nZUgeZu9UiimINGR7kPB38Rk6JmhrIfmJ2Av1CfKHlveyHzPnpjHiZ0LJw+ Dvu4WjE/hFnlSIrv+YBjbDn3klMNZPtPuUL0cw8Wrazsu9o15GC2JIDApU9tZw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783501; a=rsa-sha256; cv=none; b=RpXcdfJZdLpxUzIw8OcGtIeJzXZNATFmoJAgb6UDKF/sneTSWY8n11oKfAxkUq4lOY5RA2 ksBqjLRojbiOJ/LF+r83ZTV+WdTwGc7cptxXMT9teKOKmpP3a+BaI7HEU632fV3O1Xmj6T wJtZdeT1/qn1Ycv1eW237PXMm4kjwsKVSVf40KuyJ86qO7waNl5NpVRFH5NP7cgo70vWMj h8rYkvzTp+Icj6Slv3cDxbYc5RHVGSAHZOCILKhCB8OTbaUPzFqNM1/CwxYqTCwYMzkNqJ UpDz8EbLSAfOH3LBJMX4Dgl3ZEsr0dP/q6neUk23r88XI+rcuFlgT9YJcxHh+A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783501; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BM3KnbFWn0CANTbNLRZWWhDMxjrDVwCLgNvUsx83xTw=; b=hxJHJcjpsRt2IRaWosCFTNspGtMRXQ76BgUCKq+KupcKIbkMeFN4jf+Vz4WdAb13s2VvEa LHxeBaI0G6b8bmFsUqOT10McJSfrfsmU8DG/DK+Mfvx7mGlwjR67AIAknZNKeOiJkAXrKR 1g9OdWYgppcLyh2wsD9PECC4O+pjNTGZRMEUPKnhQeAhbYq6lUtmCmVwf0dBheCEot8voP 0DKURDonwt4mjDbogTLNLLHVYOTs52C1kswAWJmBh7g6LQTYq6XNKqkpSwBMaSoixNV64R Iw+ijmgnRRabnL/DjffH524UMgl5/WC+UY4YrlXXJ6HwNkFkEjDhqnZd68oYkQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WL8QP5slhzgwq; Fri, 12 Jul 2024 11:25:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46CBP1n2092816; Fri, 12 Jul 2024 11:25:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBP1oG092813; Fri, 12 Jul 2024 11:25:01 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:25:01 GMT Message-Id: <202407121125.46CBP1oG092813@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 3d95e9e3fe24 - main - libipsec: decode SADB_X_EXT_IF_HW_OFFL List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3d95e9e3fe24f598a37c30e0418c49cfcec1b502 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3d95e9e3fe24f598a37c30e0418c49cfcec1b502 commit 3d95e9e3fe24f598a37c30e0418c49cfcec1b502 Author: Konstantin Belousov AuthorDate: 2023-09-04 18:32:27 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 03:29:31 +0000 libipsec: decode SADB_X_EXT_IF_HW_OFFL Sponsired by: NVIDIA networking --- lib/libipsec/pfkey.c | 4 +++- lib/libipsec/pfkey_dump.c | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/libipsec/pfkey.c b/lib/libipsec/pfkey.c index 2308dd3281a7..d5a033c4c501 100644 --- a/lib/libipsec/pfkey.c +++ b/lib/libipsec/pfkey.c @@ -1677,7 +1677,8 @@ pfkey_align(struct sadb_msg *msg, caddr_t *mhp) /* duplicate check */ /* XXX Are there duplication either KEY_AUTH or KEY_ENCRYPT ?*/ - if (mhp[ext->sadb_ext_type] != NULL) { + if (mhp[ext->sadb_ext_type] != NULL && + ext->sadb_ext_type != SADB_X_EXT_IF_HW_OFFL /* XXXKIB */) { __ipsec_errcode = EIPSEC_INVAL_EXTTYPE; return -1; } @@ -1715,6 +1716,7 @@ pfkey_align(struct sadb_msg *msg, caddr_t *mhp) case SADB_X_EXT_NEW_ADDRESS_DST: case SADB_X_EXT_LFT_CUR_SW_OFFL: case SADB_X_EXT_LFT_CUR_HW_OFFL: + case SADB_X_EXT_IF_HW_OFFL: mhp[ext->sadb_ext_type] = (caddr_t)ext; break; default: diff --git a/lib/libipsec/pfkey_dump.c b/lib/libipsec/pfkey_dump.c index 2e69277fe6c2..8dcc21be16e2 100644 --- a/lib/libipsec/pfkey_dump.c +++ b/lib/libipsec/pfkey_dump.c @@ -43,6 +43,7 @@ #include #include +#include #include #include #include @@ -210,6 +211,10 @@ pfkey_sadump(struct sadb_msg *m) struct sadb_x_nat_t_type *natt_type; struct sadb_x_nat_t_port *natt_sport, *natt_dport; struct sadb_address *natt_oai, *natt_oar; + struct sadb_x_if_hw_offl *if_hw_offl; + caddr_t p, ep; + struct sadb_ext *ext; + bool first; /* check pfkey message. */ if (pfkey_align(m, mhp)) { @@ -242,6 +247,7 @@ pfkey_sadump(struct sadb_msg *m) natt_oar = (struct sadb_address *)mhp[SADB_X_EXT_NAT_T_OAR]; m_lft_sw = (struct sadb_lifetime *)mhp[SADB_X_EXT_LFT_CUR_SW_OFFL]; m_lft_hw = (struct sadb_lifetime *)mhp[SADB_X_EXT_LFT_CUR_HW_OFFL]; + if_hw_offl = (struct sadb_x_if_hw_offl *)mhp[SADB_X_EXT_IF_HW_OFFL]; /* source address */ if (m_saddr == NULL) { @@ -333,6 +339,27 @@ pfkey_sadump(struct sadb_msg *m) GETMSGSTR(str_state, m_sa->sadb_sa_state); printf("\n"); + /* hw offload interface */ + if (if_hw_offl != NULL) { + p = (caddr_t)m; + ep = p + PFKEY_UNUNIT64(m->sadb_msg_len); + p += sizeof(struct sadb_msg); + printf("\thw offl if: "); + + for (first = true; p < ep; p += PFKEY_EXTLEN(ext)) { + ext = (struct sadb_ext *)p; + if (ext->sadb_ext_type != SADB_X_EXT_IF_HW_OFFL) + continue; + if_hw_offl = (struct sadb_x_if_hw_offl *)ext; + if (first) + first = false; + else + printf(","); + printf("%s", if_hw_offl->sadb_x_if_hw_offl_if); + } + printf("\n"); + } + /* lifetime */ if (m_lftc != NULL) { time_t tmp_time = time(0);