From b8eb3377c6fca742a3c915cb1dd2d52484574f82 Mon Sep 17 00:00:00 2001 From: Iurii Egorov Date: Wed, 7 Feb 2024 02:27:05 +0300 Subject: [PATCH] UAPI errors handling --- kmod-amneziawg/files/amnezia-sources.patch | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kmod-amneziawg/files/amnezia-sources.patch b/kmod-amneziawg/files/amnezia-sources.patch index 4add6d3..e8f5f62 100644 --- a/kmod-amneziawg/files/amnezia-sources.patch +++ b/kmod-amneziawg/files/amnezia-sources.patch @@ -61,7 +61,7 @@ diff --color -urN -x uapi -x compat -x crypto -x .idea -x tests -x Kbuild -x Kco + + if (asc->junk_packet_count < 0) { + net_dbg_ratelimited("%s: JunkPacketCount should be non negative\n", dev->name); -+ ret = -1; ++ ret = -EINVAL; + } + + wg->advanced_security_config.junk_packet_count = asc->junk_packet_count; @@ -82,12 +82,12 @@ diff --color -urN -x uapi -x compat -x crypto -x .idea -x tests -x Kbuild -x Kco + net_dbg_ratelimited("%s: JunkPacketMaxSize: %d; should be smaller than maxSegmentSize: %d\n", + dev->name, asc->junk_packet_max_size, + MESSAGE_MAX_SIZE); -+ ret = -1; ++ ret = -EINVAL; + } else if (asc->junk_packet_max_size < asc->junk_packet_min_size) { + net_dbg_ratelimited("%s: maxSize: %d; should be greater than minSize: %d\n", + dev->name, asc->junk_packet_max_size, + asc->junk_packet_min_size); -+ ret = -1; ++ ret = -EINVAL; + } else + wg->advanced_security_config.junk_packet_max_size = asc->junk_packet_max_size; + @@ -98,7 +98,7 @@ diff --color -urN -x uapi -x compat -x crypto -x .idea -x tests -x Kbuild -x Kco + net_dbg_ratelimited("%s: init header size (%d) + junkSize (%d) should be smaller than maxSegmentSize: %d\n", + dev->name, MESSAGE_INITIATION_SIZE, + asc->init_packet_junk_size, MESSAGE_MAX_SIZE); -+ ret = -1; ++ ret = -EINVAL; + } else + wg->advanced_security_config.init_packet_junk_size = asc->init_packet_junk_size; + @@ -109,7 +109,7 @@ diff --color -urN -x uapi -x compat -x crypto -x .idea -x tests -x Kbuild -x Kco + net_dbg_ratelimited("%s: response header size (%d) + junkSize (%d) should be smaller than maxSegmentSize: %d\n", + dev->name, MESSAGE_RESPONSE_SIZE, + asc->response_packet_junk_size, MESSAGE_MAX_SIZE); -+ ret = -1; ++ ret = -EINVAL; + } else + wg->advanced_security_config.response_packet_junk_size = asc->response_packet_junk_size; + @@ -148,7 +148,7 @@ diff --color -urN -x uapi -x compat -x crypto -x .idea -x tests -x Kbuild -x Kco + asc->response_packet_magic_header, + asc->cookie_packet_magic_header, + asc->transport_packet_magic_header); -+ ret = -1; ++ ret = -EINVAL; + } + + if (MESSAGE_INITIATION_SIZE + asc->init_packet_junk_size == MESSAGE_RESPONSE_SIZE + asc->response_packet_junk_size) { @@ -156,7 +156,7 @@ diff --color -urN -x uapi -x compat -x crypto -x .idea -x tests -x Kbuild -x Kco + dev->name, + MESSAGE_INITIATION_SIZE + asc->init_packet_junk_size, + MESSAGE_RESPONSE_SIZE + asc->response_packet_junk_size); -+ ret = -1; ++ ret = -EINVAL; + } + + wg->advanced_security_config.advanced_security_enabled = a_sec_on;