From 44b6985a5c9724e5f8b8f30000c5f022dee42863 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Sun, 11 Aug 2019 16:49:36 +0800
Subject: [PATCH] update pppd patch and build shell script, fix buildroot glibc build bug

---
 3rdparty/pppd/patch/ppp-2.4.7.patch |  130 +++++++++++++++++++++++++++++++++++--------
 1 files changed, 106 insertions(+), 24 deletions(-)

diff --git a/3rdparty/pppd/patch/ppp-2.4.7.patch b/3rdparty/pppd/patch/ppp-2.4.7.patch
index 2240678..5018006 100644
--- a/3rdparty/pppd/patch/ppp-2.4.7.patch
+++ b/3rdparty/pppd/patch/ppp-2.4.7.patch
@@ -1,6 +1,6 @@
 diff -Nuar ppp-2.4.7/chat/Makefile.linux ppp-2.4.7-fixed/chat/Makefile.linux
 --- ppp-2.4.7/chat/Makefile.linux	2014-08-09 20:31:39.000000000 +0800
-+++ ppp-2.4.7-fixed/chat/Makefile.linux	2019-08-02 12:47:14.580689353 +0800
++++ ppp-2.4.7-fixed/chat/Makefile.linux	2019-08-11 16:34:20.884222551 +0800
 @@ -21,7 +21,7 @@
  	$(CC) -o chat chat.o
  
@@ -12,7 +12,7 @@
  	mkdir -p $(BINDIR) $(MANDIR)
 diff -Nuar ppp-2.4.7/pppd/auth.c ppp-2.4.7-fixed/pppd/auth.c
 --- ppp-2.4.7/pppd/auth.c	2014-08-09 20:31:39.000000000 +0800
-+++ ppp-2.4.7-fixed/pppd/auth.c	2019-08-02 12:48:41.600691022 +0800
++++ ppp-2.4.7-fixed/pppd/auth.c	2019-08-11 16:34:20.884222551 +0800
 @@ -1322,7 +1322,8 @@
      int hadchap;
  
@@ -25,32 +25,114 @@
  	    (hadchap = have_chap_secret(user, (explicit_remote? remote_name:
 diff -Nuar ppp-2.4.7/pppd/Makefile.linux ppp-2.4.7-fixed/pppd/Makefile.linux
 --- ppp-2.4.7/pppd/Makefile.linux	2014-08-09 20:31:39.000000000 +0800
-+++ ppp-2.4.7-fixed/pppd/Makefile.linux	2019-08-02 12:48:18.064690571 +0800
-@@ -43,12 +43,12 @@
++++ ppp-2.4.7-fixed/pppd/Makefile.linux	2019-08-11 16:35:13.888223567 +0800
+@@ -33,12 +33,12 @@
+ # CC = gcc
+ #
+ COPTS = -O2 -pipe -Wall -g
+-LIBS =
++LIBS = -lpthread
+ 
+-# Uncomment the next 2 lines to include support for Microsoft's
++# Uncomment the next line to include support for Microsoft's
+ # MS-CHAP authentication protocol.  Also, edit plugins/radius/Makefile.linux.
+ CHAPMS=y
+-USE_CRYPT=y
++#USE_CRYPT=y
+ # Don't use MSLANMAN unless you really know what you're doing.
  #MSLANMAN=y
  # Uncomment the next line to include support for MPPE.  CHAPMS (above) must
- # also be enabled.  Also, edit plugins/radius/Makefile.linux.
--MPPE=y
-+#MPPE=y
+@@ -79,6 +79,7 @@
+ MAXOCTETS=y
  
- # Uncomment the next line to include support for PPP packet filtering.
- # This requires that the libpcap library and headers be installed
- # and that the kernel driver support PPP packet filtering.
--FILTER=y
-+#FILTER=y
+ INCLUDE_DIRS= -I../include
++OPENSSL_INCLUDE_DIR= /usr/include/openssl
  
- # Uncomment the next line to enable multilink PPP (enabled by default)
- # Linux distributions: Please leave multilink ENABLED in your builds
-@@ -62,10 +62,10 @@
+ COMPILE_FLAGS= -DHAVE_PATHS_H -DIPX_CHANGE -DHAVE_MMAP
  
- HAS_SHADOW=y
- #USE_PAM=y
--HAVE_INET6=y
-+#HAVE_INET6=y
+@@ -132,7 +133,8 @@
  
- # Enable plugins
--PLUGIN=y
-+#PLUGIN=y
+ ifdef NEEDDES
+ ifndef USE_CRYPT
+-LIBS     += -ldes $(LIBS)
++CFLAGS   += -I$(OPENSSL_INCLUDE_DIR)
++LIBS     += -lcrypto -lpthread
+ else
+ CFLAGS   += -DUSE_CRYPT=1
+ endif
+diff -Nuar ppp-2.4.7/pppd/plugins/rp-pppoe/pppoe.h ppp-2.4.7-fixed/pppd/plugins/rp-pppoe/pppoe.h
+--- ppp-2.4.7/pppd/plugins/rp-pppoe/pppoe.h	2014-08-09 20:31:39.000000000 +0800
++++ ppp-2.4.7-fixed/pppd/plugins/rp-pppoe/pppoe.h	2019-08-11 16:34:20.884222551 +0800
+@@ -47,6 +47,8 @@
+ #include <sys/socket.h>
+ #endif
  
- # Enable Microsoft proprietary Callback Control Protocol
- #CBCP=y
++#include <netinet/in.h>
++
+ /* Ugly header files on some Linux boxes... */
+ #if defined(HAVE_LINUX_IF_H)
+ #include <linux/if.h>
+@@ -84,8 +86,6 @@
+ #include <linux/if_ether.h>
+ #endif
+ 
+-#include <netinet/in.h>
+-
+ #ifdef HAVE_NETINET_IF_ETHER_H
+ #include <sys/types.h>
+ 
+diff -Nuar ppp-2.4.7/pppd/pppcrypt.c ppp-2.4.7-fixed/pppd/pppcrypt.c
+--- ppp-2.4.7/pppd/pppcrypt.c	2014-08-09 20:31:39.000000000 +0800
++++ ppp-2.4.7-fixed/pppd/pppcrypt.c	2019-08-11 16:34:20.888222551 +0800
+@@ -64,7 +64,7 @@
+ 	des_key[7] = Get7Bits(key, 49);
+ 
+ #ifndef USE_CRYPT
+-	des_set_odd_parity((des_cblock *)des_key);
++	DES_set_odd_parity((DES_cblock *)des_key);
+ #endif
+ }
+ 
+@@ -158,25 +158,25 @@
+ }
+ 
+ #else /* USE_CRYPT */
+-static des_key_schedule	key_schedule;
++static DES_key_schedule	key_schedule;
+ 
+ bool
+ DesSetkey(key)
+ u_char *key;
+ {
+-	des_cblock des_key;
++	DES_cblock des_key;
+ 	MakeKey(key, des_key);
+-	des_set_key(&des_key, key_schedule);
++	DES_set_key(&des_key, &key_schedule);
+ 	return (1);
+ }
+ 
+ bool
+-DesEncrypt(clear, key, cipher)
++DesEncrypt(clear, cipher)
+ u_char *clear;	/* IN  8 octets */
+ u_char *cipher;	/* OUT 8 octets */
+ {
+-	des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher,
+-	    key_schedule, 1);
++	DES_ecb_encrypt((DES_cblock *)clear, (DES_cblock *)cipher,
++	    &key_schedule, 1);
+ 	return (1);
+ }
+ 
+@@ -185,8 +185,8 @@
+ u_char *cipher;	/* IN  8 octets */
+ u_char *clear;	/* OUT 8 octets */
+ {
+-	des_ecb_encrypt((des_cblock *)cipher, (des_cblock *)clear,
+-	    key_schedule, 0);
++	DES_ecb_encrypt((DES_cblock *)cipher, (DES_cblock *)clear,
++	    &key_schedule, 0);
+ 	return (1);
+ }
+ 

--
Gitblit v1.9.1