Skip to content

Commit

Permalink
pppd: add patches for gcc14 compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
gtxaspec committed Dec 26, 2024
1 parent 89922fd commit 59f98b8
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 0 deletions.
25 changes: 25 additions & 0 deletions package/all-patches/pppd/0002-fix-npmode-enum.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c
index b497231..7512fcb 100644
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
@@ -126,6 +126,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>

+#include <linux/ppp_defs.h>
#include <linux/ppp-ioctl.h>

#include <linux/netlink.h>

diff --git a/pppd/plugins/pppol2tp/pppol2tp.c b/pppd/plugins/pppol2tp/pppol2tp.c
index 3b9737e..4660b63 100644
--- a/pppd/plugins/pppol2tp/pppol2tp.c
+++ b/pppd/plugins/pppol2tp/pppol2tp.c
@@ -38,6 +38,7 @@

#include <linux/version.h>
#include <linux/sockios.h>
+#include <linux/ppp_defs.h>
#include <linux/ppp-ioctl.h>

#ifndef aligned_u64
43 changes: 43 additions & 0 deletions package/all-patches/pppd/0003-fix-gcc14-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
commit ac269dbf7c142371cd975c775c6171707ac4dde8
Author: nasbdh9 <[email protected]>
Date: Tue Oct 15 10:53:48 2024 +0800

pppd/crypto: Fix gcc 14 build (#524)

Fix this:

crypto.c: In function 'PPP_crypto_error':
crypto.c:178:11: error: implicit declaration of function 'vsnprintf' [-Wimplicit-function-declaration]
178 | off = vsnprintf(buf, len, fmt, args);
| ^~~~~~~~~
crypto.c:41:1: note: include '<stdio.h>' or provide a declaration of 'vsnprintf'
40 | #include "crypto-priv.h"
+++ |+#include <stdio.h>
41 |
crypto.c:178:26: warning: 'vsnprintf' argument 2 type is 'int' where 'long unsigned int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
178 | off = vsnprintf(buf, len, fmt, args);
| ^~~
<built-in>: note: built-in 'vsnprintf' declared here

Signed-off-by: Tan Zien <[email protected]>

diff --git a/pppd/crypto.c b/pppd/crypto.c
index 054ee13..3576afd 100644
--- a/pppd/crypto.c
+++ b/pppd/crypto.c
@@ -34,6 +34,7 @@

#include <stdlib.h>
#include <string.h>
+#include <stdio.h>

#include "pppd.h"
#include "crypto.h"
@@ -243,7 +244,6 @@ int PPP_crypto_deinit()
}

#ifdef UNIT_TEST
-#include <stdio.h>

int debug;
int error_count;
66 changes: 66 additions & 0 deletions package/all-patches/pppd/0004-fix-build-without-openssl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
commit 5f6eabdb6666d914e0f8feb3facfa591dee75a1f
Author: Tomas Paukrt <[email protected]>
Date: Thu Nov 21 03:53:28 2024 +0100

pppd: Fix build without OpenSSL (#533)

The symbol OPENSSL_VERSION_NUMBER is not defined when pppd is
compiled without OpenSSL support, so it evaluates to zero.
This results in the following linker error:

crypto.c:241: undefined reference to `ERR_free_strings'

Signed-off-by: Tomas Paukrt <[email protected]>

diff --git a/pppd/crypto.c b/pppd/crypto.c
index 3576afd..8e98261 100644
--- a/pppd/crypto.c
+++ b/pppd/crypto.c
@@ -43,7 +43,6 @@
#ifdef PPP_WITH_OPENSSL
#include <openssl/opensslv.h>
#include <openssl/err.h>
-#endif

#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#include <openssl/provider.h>
@@ -53,6 +52,7 @@ struct crypto_ctx {
OSSL_PROVIDER *provider;
} g_crypto_ctx;
#endif
+#endif

PPP_MD_CTX *PPP_MD_CTX_new()
{
@@ -200,6 +200,7 @@ int PPP_crypto_init()
{
int retval = 0;

+#ifdef PPP_WITH_OPENSSL
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
g_crypto_ctx.legacy = OSSL_PROVIDER_load(NULL, "legacy");
if (g_crypto_ctx.legacy == NULL)
@@ -214,6 +215,7 @@ int PPP_crypto_init()
PPP_crypto_error("Could not load default provider");
goto done;
}
+#endif
#endif

retval = 1;
@@ -225,6 +227,7 @@ done:

int PPP_crypto_deinit()
{
+#ifdef PPP_WITH_OPENSSL
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
if (g_crypto_ctx.legacy) {
OSSL_PROVIDER_unload(g_crypto_ctx.legacy);
@@ -239,6 +242,7 @@ int PPP_crypto_deinit()

#if OPENSSL_VERSION_NUMBER < 0x10100000L
ERR_free_strings();
+#endif
#endif
return 1;
}

0 comments on commit 59f98b8

Please sign in to comment.