blob: a98c179290c75cdf5e9cf0f8e55a5429b283a00e [file] [log] [blame]
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001From da67444994bde603c7ff1483a6803bdab24e1f14 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 29 Aug 2022 09:36:55 -0700
4Subject: [PATCH 1/2] pppd/ippool.c: Fix type casting issues between in_addr
5 and ippool_api_ip_addr
6
7Also remove unused variabled
8
9Upstream-Status: Inappropriate [No upstream]
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 pppd/ippool.c | 13 ++++++-------
13 1 file changed, 6 insertions(+), 7 deletions(-)
14
15--- a/pppd/ippool.c
16+++ b/pppd/ippool.c
17@@ -16,6 +16,7 @@
18 #include <sys/ioctl.h>
19 #include <sys/socket.h>
20 #include <netinet/in.h>
21+#include <arpa/inet.h>
22 #include <signal.h>
23
24 #include <linux/types.h>
25@@ -24,7 +25,6 @@
26
27 const char pppd_version[] = VERSION;
28
29-static int ippool_fd = -1;
30 static char *ippool_pool_name = NULL;
31 static char *ippool_pool_name2 = NULL;
32 static char *ippool_server = "localhost";
33@@ -64,9 +64,9 @@ static int ippool_addr_alloc(CLIENT *cl,
34 }
35
36 *addr = clnt_res.addr.s_addr;
37-
38+ struct in_addr temp_addr = {*addr};
39 if (ippool_debug) {
40- dbglog("Allocated address %s from pool %s", inet_ntoa(clnt_res.addr.s_addr), pool_name);
41+ dbglog("Allocated address %s from pool %s", inet_ntoa(temp_addr), pool_name);
42 }
43 out:
44 return result;
45@@ -85,14 +85,16 @@ static void ippool_addr_free(CLIENT *cl,
46 }
47 if (clnt_res < 0) {
48 if (ippool_debug) {
49+ struct in_addr temp_addr = {free_addr.s_addr};
50 warn("IP address %s free to pool %s failed: %s",
51- inet_ntoa(free_addr), pool_name, strerror(-clnt_res));
52+ inet_ntoa(temp_addr), pool_name, strerror(-clnt_res));
53 }
54 goto out;
55 }
56
57 if (ippool_debug) {
58- dbglog("Freed address %s to pool %s", inet_ntoa(free_addr), pool_name);
59+ struct in_addr temp_addr = {free_addr.s_addr};
60+ dbglog("Freed address %s to pool %s", inet_ntoa(temp_addr), pool_name);
61 }
62 out:
63 return;
64@@ -138,8 +140,6 @@ static void ippool_choose_ip(u_int32_t *
65 {
66 ipcp_options *wo = &ipcp_wantoptions[0];
67 ipcp_options *go = &ipcp_gotoptions[0];
68- ipcp_options *ao = &ipcp_allowoptions[0];
69- ipcp_options *ho = &ipcp_hisoptions[0];
70 CLIENT *cl;
71 int result = 0;
72