--- 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: