ippool: Fix build with clang15

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj 2022-08-29 10:05:32 -07:00
parent d99900e121
commit 4262458aaa
3 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,72 @@
From da67444994bde603c7ff1483a6803bdab24e1f14 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 29 Aug 2022 09:36:55 -0700
Subject: [PATCH 1/2] pppd/ippool.c: Fix type casting issues between in_addr
and ippool_api_ip_addr
Also remove unused variabled
Upstream-Status: Inappropriate [No upstream]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
pppd/ippool.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
--- a/pppd/ippool.c
+++ b/pppd/ippool.c
@@ -16,6 +16,7 @@
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <arpa/inet.h>
#include <signal.h>
#include <linux/types.h>
@@ -24,7 +25,6 @@
const char pppd_version[] = VERSION;
-static int ippool_fd = -1;
static char *ippool_pool_name = NULL;
static char *ippool_pool_name2 = NULL;
static char *ippool_server = "localhost";
@@ -64,9 +64,9 @@ static int ippool_addr_alloc(CLIENT *cl,
}
*addr = clnt_res.addr.s_addr;
-
+ struct in_addr temp_addr = {*addr};
if (ippool_debug) {
- dbglog("Allocated address %s from pool %s", inet_ntoa(clnt_res.addr.s_addr), pool_name);
+ dbglog("Allocated address %s from pool %s", inet_ntoa(temp_addr), pool_name);
}
out:
return result;
@@ -85,14 +85,16 @@ static void ippool_addr_free(CLIENT *cl,
}
if (clnt_res < 0) {
if (ippool_debug) {
+ struct in_addr temp_addr = {free_addr.s_addr};
warn("IP address %s free to pool %s failed: %s",
- inet_ntoa(free_addr), pool_name, strerror(-clnt_res));
+ inet_ntoa(temp_addr), pool_name, strerror(-clnt_res));
}
goto out;
}
if (ippool_debug) {
- dbglog("Freed address %s to pool %s", inet_ntoa(free_addr), pool_name);
+ struct in_addr temp_addr = {free_addr.s_addr};
+ dbglog("Freed address %s to pool %s", inet_ntoa(temp_addr), pool_name);
}
out:
return;
@@ -138,8 +140,6 @@ static void ippool_choose_ip(u_int32_t *
{
ipcp_options *wo = &ipcp_wantoptions[0];
ipcp_options *go = &ipcp_gotoptions[0];
- ipcp_options *ao = &ipcp_allowoptions[0];
- ipcp_options *ho = &ipcp_hisoptions[0];
CLIENT *cl;
int result = 0;

View File

@ -0,0 +1,22 @@
From f9ea91771f0d3c984e7d5fe9e15962db1ee686ad Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 29 Aug 2022 09:39:16 -0700
Subject: [PATCH 2/2] ippool_rpc_server.c: Add missing prototype for
ippool_api_rpc_check_request
Upstream-Status: Inappropriate [no upstream]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ippool_rpc_server.c | 2 ++
1 file changed, 2 insertions(+)
--- a/Makefile
+++ b/Makefile
@@ -123,6 +123,7 @@ $(IPPOOL_RPC_STEM)_server.c: $(IPPOOL_RP
-$(RM) $@ $@.tmp
rpcgen $(RPCGENFLAGS) -m -o $@.tmp $<
cat $@.tmp | sed -e 's/switch (rqstp->rq_proc) {/if (ippool_api_rpc_check_request(transp) < 0) return; switch (rqstp->rq_proc) {/' > $@
+ sed -i '20i int ippool_api_rpc_check_request(SVCXPRT *xprt);' $@
$(IPPOOL_RPC_STEM)_client.c: $(IPPOOL_RPC_STEM).x
-$(RM) $@

View File

@ -27,6 +27,8 @@ SRC_URI = "https://sourceforge.net/projects/openl2tp/files/${BPN}/${PV}/${BPN}-$
file://0002-link-with-libtirpc.patch \
file://0003-musl-fixes.patch \
file://strncpy-truncation.patch \
file://0001-pppd-ippool.c-Fix-type-casting-issues-between-in_add.patch \
file://0002-ippool_rpc_server.c-Add-missing-prototype-for-ippool.patch \
"
LIC_FILES_CHKSUM = "file://LICENSE;md5=4c59283b82fc2b166455e0fc23c71c6f"