1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
|
--- ppp-2.4.7/pppd/plugins/Makefile.linux.old 2019-05-09 23:06:56.499058276 +0000
+++ ppp-2.4.7/pppd/plugins/Makefile.linux 2019-05-09 23:11:21.040252628 +0000
@@ -16,7 +16,7 @@
MANDIR = $(DESTDIR)/share/man/man8
LIBDIR = $(DESTDIR)/lib/pppd/$(VERSION)
-SUBDIRS := rp-pppoe pppoatm pppol2tp
+SUBDIRS := dhcp rp-pppoe pppoatm pppol2tp
# Uncomment the next line to include the radius authentication plugin
SUBDIRS += radius
PLUGINS := minconn.so passprompt.so passwordfd.so winbind.so
--- ppp-2.4.7/pppd/plugins/dhcp/README.old 2002-09-30 11:33:49.000000000 +0000
+++ ppp-2.4.7/pppd/plugins/dhcp/README 2019-05-09 23:11:37.408470308 +0000
@@ -37,7 +37,7 @@
This option specified the local IP address of the system running
this proxy, as should be identified to the DHCP server in the
- 'giaddr' field of DHCP requests. Normal server behavor should
+ 'giaddr' field of DHCP requests. Normal server behaviour should
be to send DHCP responses to this address. The default is the
primary address bound to the dhcp interface.
diff -Naur ppp-2.4.7/pppd/plugins/dhcp.old/clientpacket.c ppp-2.4.7/pppd/plugins/dhcp/clientpacket.c
--- ppp-2.4.7/pppd/plugins/dhcp.old/clientpacket.c 2002-08-31 12:19:20.000000000 +0000
+++ ppp-2.4.7/pppd/plugins/dhcp/clientpacket.c 2019-05-09 23:42:33.566347764 +0000
@@ -179,8 +179,8 @@
{
int bytes;
struct udp_dhcp_packet packet;
- u_int32_t source, dest;
- u_int16_t check;
+ uint32_t source, dest;
+ uint16_t check;
memset(&packet, 0, sizeof(struct udp_dhcp_packet));
bytes = read(fd, &packet, sizeof(struct udp_dhcp_packet));
diff -Naur ppp-2.4.7/pppd/plugins/dhcp.old/dhcpc.c ppp-2.4.7/pppd/plugins/dhcp/dhcpc.c
--- ppp-2.4.7/pppd/plugins/dhcp.old/dhcpc.c 2019-05-09 23:41:38.732319544 +0000
+++ ppp-2.4.7/pppd/plugins/dhcp/dhcpc.c 2019-05-09 23:42:33.566347764 +0000
@@ -56,11 +56,11 @@
#include "socket.h"
#include "debug.h"
-static void (*dhcp_old_ip_choose_hook)(u_int32_t *addrp);
+static void (*dhcp_old_ip_choose_hook)(uint32_t *addrp);
static int dhcp_state;
-static u_int32_t requested_ip; /* = 0 */
-u_int32_t assigned_ip; /* value supplied to remote ppp */
+static uint32_t requested_ip; /* = 0 */
+uint32_t assigned_ip; /* value supplied to remote ppp */
static unsigned long server_addr;
unsigned long lease, renew_timeout;
unsigned long xid = 0;
@@ -118,7 +118,7 @@
void dhcp_release(void *ptr, int arg);
void dhcp_renew(void *dummy);
void dhcp_request_new();
-void dhcp_ip_choose(u_int32_t *addrp);
+void dhcp_ip_choose(uint32_t *addrp);
void dhcp_read_options(void);
@@ -453,8 +453,8 @@
return;
}
-void dhcp_ip_choose(u_int32_t *addrp) {
- u_int32_t entryvalue;
+void dhcp_ip_choose(uint32_t *addrp) {
+ uint32_t entryvalue;
dbglog("DHCPC: ip_choose_hook entered with peer name %s",peer_authname);
diff -Naur ppp-2.4.7/pppd/plugins/dhcp.old/dhcpc.h ppp-2.4.7/pppd/plugins/dhcp/dhcpc.h
--- ppp-2.4.7/pppd/plugins/dhcp.old/dhcpc.h 2002-08-31 11:54:23.000000000 +0000
+++ ppp-2.4.7/pppd/plugins/dhcp/dhcpc.h 2019-05-09 23:42:33.566347764 +0000
@@ -24,9 +24,9 @@
unsigned char *hostname; /* Optional hostname to use */
int ifindex; /* Index number of the interface to use */
unsigned char arp[6]; /* Our arp address */
- u_int32_t giaddr; /* Fill in this value on all packets we generate */
- u_int32_t siaddr; /* If defined, only talk to this server (never broadcast) */
- u_int32_t subnet_selection; /* If non zero, send and require SS option */
+ uint32_t giaddr; /* Fill in this value on all packets we generate */
+ uint32_t siaddr; /* If defined, only talk to this server (never broadcast) */
+ uint32_t subnet_selection; /* If non zero, send and require SS option */
};
extern struct client_config_t client_config;
diff -Naur ppp-2.4.7/pppd/plugins/dhcp.old/dhcpd.h ppp-2.4.7/pppd/plugins/dhcp/dhcpd.h
--- ppp-2.4.7/pppd/plugins/dhcp.old/dhcpd.h 2002-08-31 11:52:31.000000000 +0000
+++ ppp-2.4.7/pppd/plugins/dhcp/dhcpd.h 2019-05-09 23:42:33.566347764 +0000
@@ -101,9 +101,9 @@
};
struct server_config_t {
- u_int32_t server; /* Our IP, in network order */
- u_int32_t start; /* Start address of leases, network order */
- u_int32_t end; /* End of leases, network order */
+ uint32_t server; /* Our IP, in network order */
+ uint32_t start; /* Start address of leases, network order */
+ uint32_t end; /* End of leases, network order */
struct option_set *options; /* List of DHCP options loaded from the config file */
char *interface; /* The name of the interface to use */
int ifindex; /* Index number of the interface to use */
@@ -122,7 +122,7 @@
char *lease_file;
char *pidfile;
char *notify_file; /* What to run whenever leases are written */
- u_int32_t siaddr; /* next server bootp option */
+ uint32_t siaddr; /* next server bootp option */
char *sname; /* bootp server name */
char *boot_file; /* bootp boot file option */
};
diff -Naur ppp-2.4.7/pppd/plugins/dhcp.old/leases.h ppp-2.4.7/pppd/plugins/dhcp/leases.h
--- ppp-2.4.7/pppd/plugins/dhcp.old/leases.h 2002-08-23 13:17:14.000000000 +0000
+++ ppp-2.4.7/pppd/plugins/dhcp/leases.h 2019-05-09 23:42:33.566347764 +0000
@@ -4,20 +4,20 @@
struct dhcpOfferedAddr {
- u_int8_t chaddr[16];
- u_int32_t yiaddr; /* network order */
- u_int32_t expires; /* host order */
+ uint8_t chaddr[16];
+ uint32_t yiaddr; /* network order */
+ uint32_t expires; /* host order */
};
-void clear_lease(u_int8_t *chaddr, u_int32_t yiaddr);
-struct dhcpOfferedAddr *add_lease(u_int8_t *chaddr, u_int32_t yiaddr, unsigned long lease);
+void clear_lease(uint8_t *chaddr, uint32_t yiaddr);
+struct dhcpOfferedAddr *add_lease(uint8_t *chaddr, uint32_t yiaddr, unsigned long lease);
int lease_expired(struct dhcpOfferedAddr *lease);
struct dhcpOfferedAddr *oldest_expired_lease(void);
-struct dhcpOfferedAddr *find_lease_by_chaddr(u_int8_t *chaddr);
-struct dhcpOfferedAddr *find_lease_by_yiaddr(u_int32_t yiaddr);
-u_int32_t find_address(int check_expired);
-int check_ip(u_int32_t addr);
+struct dhcpOfferedAddr *find_lease_by_chaddr(uint8_t *chaddr);
+struct dhcpOfferedAddr *find_lease_by_yiaddr(uint32_t yiaddr);
+uint32_t find_address(int check_expired);
+int check_ip(uint32_t addr);
#endif
diff -Naur ppp-2.4.7/pppd/plugins/dhcp.old/options.c ppp-2.4.7/pppd/plugins/dhcp/options.c
--- ppp-2.4.7/pppd/plugins/dhcp.old/options.c 2002-08-31 11:52:37.000000000 +0000
+++ ppp-2.4.7/pppd/plugins/dhcp/options.c 2019-05-09 23:42:33.566347764 +0000
@@ -148,17 +148,17 @@
/* add a one to four byte option to a packet */
-int add_simple_option(unsigned char *optionptr, unsigned char code, u_int32_t data)
+int add_simple_option(unsigned char *optionptr, unsigned char code, uint32_t data)
{
char length = 0;
int i;
unsigned char option[2 + 4];
unsigned char *u8;
- u_int16_t *u16;
- u_int32_t *u32;
- u_int32_t aligned;
+ uint16_t *u16;
+ uint32_t *u32;
+ uint32_t aligned;
u8 = (unsigned char *) &aligned;
- u16 = (u_int16_t *) &aligned;
+ u16 = (uint16_t *) &aligned;
u32 = &aligned;
for (i = 0; options[i].code; i++)
diff -Naur ppp-2.4.7/pppd/plugins/dhcp.old/options.h ppp-2.4.7/pppd/plugins/dhcp/options.h
--- ppp-2.4.7/pppd/plugins/dhcp.old/options.h 2002-08-23 13:06:28.000000000 +0000
+++ ppp-2.4.7/pppd/plugins/dhcp/options.h 2019-05-09 23:42:33.566347764 +0000
@@ -33,7 +33,7 @@
unsigned char *get_option(struct dhcpMessage *packet, int code);
int end_option(unsigned char *optionptr);
int add_option_string(unsigned char *optionptr, unsigned char *string);
-int add_simple_option(unsigned char *optionptr, unsigned char code, u_int32_t data);
+int add_simple_option(unsigned char *optionptr, unsigned char code, uint32_t data);
struct option_set *find_option(struct option_set *opt_list, char code);
void attach_option(struct option_set **opt_list, struct dhcp_option *option, char *buffer, int length);
diff -Naur ppp-2.4.7/pppd/plugins/dhcp.old/packet.c ppp-2.4.7/pppd/plugins/dhcp/packet.c
--- ppp-2.4.7/pppd/plugins/dhcp.old/packet.c 2019-05-09 23:41:38.732319544 +0000
+++ ppp-2.4.7/pppd/plugins/dhcp/packet.c 2019-05-09 23:42:33.566347764 +0000
@@ -83,13 +83,13 @@
}
-u_int16_t checksum(void *addr, int count)
+uint16_t checksum(void *addr, int count)
{
/* Compute Internet Checksum for "count" bytes
* beginning at location "addr".
*/
register int32_t sum = 0;
- u_int16_t *source = (u_int16_t *) addr;
+ uint16_t *source = (uint16_t *) addr;
while( count > 1 ) {
/* This is the inner loop */
@@ -110,8 +110,8 @@
/* Constuct a ip/udp header for a packet, and specify the source and dest hardware address */
-int raw_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port,
- u_int32_t dest_ip, int dest_port, unsigned char *dest_arp, int ifindex)
+int raw_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port,
+ uint32_t dest_ip, int dest_port, unsigned char *dest_arp, int ifindex)
{
int fd;
int result;
@@ -169,8 +169,8 @@
/* Let the kernel do all the work for packet generation */
-int kernel_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port,
- u_int32_t dest_ip, int dest_port)
+int kernel_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port,
+ uint32_t dest_ip, int dest_port)
{
int n = 1;
int fd, result;
diff -Naur ppp-2.4.7/pppd/plugins/dhcp.old/packet.h ppp-2.4.7/pppd/plugins/dhcp/packet.h
--- ppp-2.4.7/pppd/plugins/dhcp.old/packet.h 2002-08-23 13:04:56.000000000 +0000
+++ ppp-2.4.7/pppd/plugins/dhcp/packet.h 2019-05-09 23:42:33.566347764 +0000
@@ -5,22 +5,22 @@
#include <netinet/ip.h>
struct dhcpMessage {
- u_int8_t op;
- u_int8_t htype;
- u_int8_t hlen;
- u_int8_t hops;
- u_int32_t xid;
- u_int16_t secs;
- u_int16_t flags;
- u_int32_t ciaddr;
- u_int32_t yiaddr;
- u_int32_t siaddr;
- u_int32_t giaddr;
- u_int8_t chaddr[16];
- u_int8_t sname[64];
- u_int8_t file[128];
- u_int32_t cookie;
- u_int8_t options[308]; /* 312 - cookie */
+ uint8_t op;
+ uint8_t htype;
+ uint8_t hlen;
+ uint8_t hops;
+ uint32_t xid;
+ uint16_t secs;
+ uint16_t flags;
+ uint32_t ciaddr;
+ uint32_t yiaddr;
+ uint32_t siaddr;
+ uint32_t giaddr;
+ uint8_t chaddr[16];
+ uint8_t sname[64];
+ uint8_t file[128];
+ uint32_t cookie;
+ uint8_t options[308]; /* 312 - cookie */
};
struct udp_dhcp_packet {
@@ -31,11 +31,11 @@
void init_header(struct dhcpMessage *packet, char type);
int get_packet(struct dhcpMessage *packet, int fd);
-u_int16_t checksum(void *addr, int count);
-int raw_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port,
- u_int32_t dest_ip, int dest_port, unsigned char *dest_arp, int ifindex);
-int kernel_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port,
- u_int32_t dest_ip, int dest_port);
+uint16_t checksum(void *addr, int count);
+int raw_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port,
+ uint32_t dest_ip, int dest_port, unsigned char *dest_arp, int ifindex);
+int kernel_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port,
+ uint32_t dest_ip, int dest_port);
#endif
diff -Naur ppp-2.4.7/pppd/plugins/dhcp.old/socket.c ppp-2.4.7/pppd/plugins/dhcp/socket.c
--- ppp-2.4.7/pppd/plugins/dhcp.old/socket.c 2019-05-09 23:41:38.732319544 +0000
+++ ppp-2.4.7/pppd/plugins/dhcp/socket.c 2019-05-09 23:42:33.566347764 +0000
@@ -43,7 +43,7 @@
#include "debug.h"
-int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char *arp)
+int read_interface(char *interface, int *ifindex, uint32_t *addr, unsigned char *arp)
{
int fd;
struct ifreq ifr;
diff -Naur ppp-2.4.7/pppd/plugins/dhcp.old/socket.h ppp-2.4.7/pppd/plugins/dhcp/socket.h
--- ppp-2.4.7/pppd/plugins/dhcp.old/socket.h 2002-08-23 13:06:28.000000000 +0000
+++ ppp-2.4.7/pppd/plugins/dhcp/socket.h 2019-05-09 23:42:33.566347764 +0000
@@ -2,7 +2,7 @@
#ifndef _SOCKET_H
#define _SOCKET_H
-int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char *arp);
+int read_interface(char *interface, int *ifindex, uint32_t *addr, unsigned char *arp);
int listen_socket(unsigned int ip, int port, char *inf);
int raw_socket(int ifindex);
--- ppp-2.4.7/pppd/plugins/dhcp/Makefile.linux.old 2019-05-09 23:54:56.595427092 +0000
+++ ppp-2.4.7/pppd/plugins/dhcp/Makefile.linux 2019-05-09 23:56:53.012746364 +0000
@@ -1,6 +1,11 @@
PLUGIN=dhcpc.so
CFLAGS=$(COPTS) -I../.. -I../../../include -fPIC
+INSTALL = install
+DESTDIR = $(INSTROOT)/usr
+LIBDIR = $(DESTDIR)/lib/pppd/$(VERSION)
+
+VERSION = $(shell awk -F '"' '/VERSION/ { print $$2; }' ../../patchlevel.h)
all: $(PLUGIN)
--- ppp-ppp-2.4.8/pppd/plugins/dhcp/Makefile.linux.old 2020-02-26 04:02:43.528569753 +0000
+++ ppp-ppp-2.4.8/pppd/plugins/dhcp/Makefile.linux 2020-02-26 04:03:07.425957036 +0000
@@ -14,7 +14,7 @@
$(INSTALL) -s -c -m 755 dhcpc.so $(LIBDIR)
dhcpc.so: dhcpc.o clientpacket.o packet.o socket.o options.o
- $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^
+ $(CC) $(LDFLAGS) -shared $(CFLAGS) -o $@ $^
clean:
|