netcfg: handle ParseFromString result for protobuf 34 (nodiscard)
PATCH 1/1 netcfg: handle ParseFromString result for protobuf 34 (nodiscard)
-------- Пересылаемое сообщение --------
От кого: Дмитрий Романов <[email protected]...>
Кому: openvpn-devel <[email protected]>
Дата: Понедельник, 4 мая 2026, 10:19 +03:00
Тема: [PATCH] netcfg: handle ParseFromString result for protobuf 34 (nodiscard)
Hi,
Building openvpn3-linux v26 with protobuf 34.x and GCC 15 fails in netcfg-dco.cpp: google::protobuf::MessageLite::ParseFromString is now [[nodiscard]], and the project builds with -Werror, so ignoring the return value becomes a hard error (-Werror=unused-result).
Check the return value and throw NetCfgException on parse failure, consistent with other error handling in this file.
This should fix distributions that already ship protobuf 34 (e.g. Arch).
If there is an existing issue on Codeberg for this (e.g. related to nodiscard / protobuf 34), please link this patch there.
DR
DR
src/netcfg/netcfg-dco.cpp +4 -1
@@ -264,7 +264,11 @@ void NetCfgDCO::method_new_key(GVariant *params) std::string key_config = glib2::Value::Extract<std::string>(params, 1); DcoKeyConfig dco_kc; - dco_kc.ParseFromString(base64->decode(key_config)); + if (!dco_kc.ParseFromString(base64->decode(key_config))) + { + throw NetCfgException("Failed to parse DCO key configuration"); + } auto copyKeyDirection = [](const DcoKeyConfig_KeyDirection &src, KoRekey::KeyDirection &dst) {
On 04/05/2026 09:22, Дмитрий Романов via Openvpn-devel wrote:
[...]
Quoted 14 lines
Building openvpn3-linux v26 with protobuf 34.x and GCC 15 fails in netcfg-dco.cpp:google::protobuf::MessageLite::ParseFromStringis now [[nodiscard]], and the project builds with -Werror, so ignoring the return value becomes a hard error (-Werror=unused-result).
Check the return value and throw NetCfgException on parse failure, consistent with other error handling in this file.
This should fix distributions that already ship protobuf 34 (e.g. Arch).
If there is an existing issue on Codeberg for this (e.g. related to nodiscard / protobuf 34), please link this patch there.
Quoted 3 lines
Signed-off-by Dmitriy Romanov <[email protected]...<mailto:[email protected]...>>
Hi,
Thanks a lot for this patch. This issue was reported quite recently while digging into some other issues. It is being tracked in Codeberg issue #96: <https://codeberg.org/OpenVPN/openvpn3-linux/issues/96>
I'm following up on that ticket closely and will provide more updates in the days to come.
Signature · 3 lines
kind regards, David Sommerseth
Quoted 25 lines · Дмитрий Романов via Openvpn-devel
-------- Пересылаемое сообщение --------
От кого: Дмитрий Романов <[email protected]... <mailto:[email protected]...>>
Кому: openvpn-devel <[email protected] <mailto:[email protected]>>
Дата: Понедельник, 4 мая 2026, 10:19 +03:00
Тема: [PATCH] netcfg: handle ParseFromString result for protobuf 34 (nodiscard)
Hi,
Building openvpn3-linux v26 with protobuf 34.x and GCC 15 fails in netcfg-dco.cpp:google::protobuf::MessageLite::ParseFromStringis now [[nodiscard]], and the project builds with -Werror, so ignoring the return value becomes a hard error (-Werror=unused-result).
Check the return value and throw NetCfgException on parse failure, consistent with other error handling in this file.
This should fix distributions that already ship protobuf 34 (e.g. Arch).
If there is an existing issue on Codeberg for this (e.g. related to nodiscard / protobuf 34), please link this patch there.
Quoted 2 lines
Signed-off-by Dmitriy Romanov <[email protected]...<mailto:[email protected]...>>
Sorry it took time to resolve this. I've
just pushed out an git master branch to all the repositories which includes this fix and a lot of other issues related to building OpenVPN 3 Linux.
<https://codeberg.org/OpenVPN/openvpn3-linux/commit/18f19569ce2da673b786c848fe6222ffae1809b6>
Your patch did not apply cleanly on my tree, so I had to redo it. But you're credited in the commit, together with other reporters of the same issue.
Current git master commit: b8ac395171e6354aa2d27875b76ed9cbc44b99cd
Codeberg: <https://codeberg.org/OpenVPN/openvpn3-linux/src/branch/master>
Radicle: rad:zN58oopqzrAkTregNZaRQpgg7x3c
Radicle: <https://radicle.network/nodes/iris.radicle.xyz/rad:zN58oopqzrAkTregNZaRQpgg7x3c>
GitLab: <https://gitlab.com/openvpn/openvpn3-linux/>
GitHub: <https://github.com/OpenVPN/openvpn3-linux/>
Signature · 4 lines
kind regards, David Sommerseth OpenVPN Inc