summaryrefslogtreecommitdiff
path: root/package/ppp/patches
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2011-01-22 22:37:50 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2011-01-22 22:37:50 +0100
commit9436a026e2e23d207fbdcb9e8bc9b076e3573700 (patch)
treeadb1937bc90be8869a5f7c9636da84773414eb3b /package/ppp/patches
parent52b1b0100c53b1f8699955df618fcb47744e0a7e (diff)
activate GCC cflags check, cleanup FLAGS stuff in OpenADK.
* remove TCFLAGS/TLDFLAGS/TCPPFLAGS and only use TARGET_CFLAGS/TARGET_LDFLAGS/TARGET_CPPFLAGS, ... * activate GCC_HONOUR_COPTS and fix all packages to honour CFLAGS * use CC_FOR_BUILD, CFLAGS_FOR_BUILD, ... for all build compilation, remove HOST* variants * introduce KERNEL_MODULE_FLAGS for external kernel modules * mark rpm package as broken, mark syslinux for native builds only, mark libhugetlb for eglibc/glibc only usage
Diffstat (limited to 'package/ppp/patches')
-rw-r--r--package/ppp/patches/patch-chat_Makefile_linux52
-rw-r--r--package/ppp/patches/patch-configure84
-rw-r--r--package/ppp/patches/patch-linux_Makefile_top17
-rw-r--r--package/ppp/patches/patch-pppd_Makefile_linux224
-rw-r--r--package/ppp/patches/patch-pppd_ccp_c1362
-rw-r--r--package/ppp/patches/patch-pppd_ccp_h20
-rw-r--r--package/ppp/patches/patch-pppd_chap_ms_c22
-rw-r--r--package/ppp/patches/patch-pppd_plugins_Makefile_linux32
-rw-r--r--package/ppp/patches/patch-pppd_plugins_pppoatm_Makefile_linux50
-rw-r--r--package/ppp/patches/patch-pppd_plugins_pppol2tp_Makefile_linux36
-rw-r--r--package/ppp/patches/patch-pppd_plugins_radius_Makefile_linux88
-rw-r--r--package/ppp/patches/patch-pppd_plugins_rp-pppoe_Makefile_linux64
-rw-r--r--package/ppp/patches/patch-pppd_sys-linux_c16
-rw-r--r--package/ppp/patches/patch-pppdump_Makefile_linux37
-rw-r--r--package/ppp/patches/patch-pppstats_Makefile_linux48
15 files changed, 517 insertions, 1635 deletions
diff --git a/package/ppp/patches/patch-chat_Makefile_linux b/package/ppp/patches/patch-chat_Makefile_linux
index 3d0c3fdff..07f1a31cb 100644
--- a/package/ppp/patches/patch-chat_Makefile_linux
+++ b/package/ppp/patches/patch-chat_Makefile_linux
@@ -1,31 +1,51 @@
--- ppp-2.4.5.orig/chat/Makefile.linux 2009-11-16 23:26:07.000000000 +0100
-+++ ppp-2.4.5/chat/Makefile.linux 2011-01-16 15:56:59.000000000 +0100
-@@ -10,22 +10,23 @@ CDEF3= -UNO_SLEEP # Use the usleep fun
- CDEF4= -DFNDELAY=O_NDELAY # Old name value
- CDEFS= $(CDEF1) $(CDEF2) $(CDEF3) $(CDEF4)
++++ ppp-2.4.5/chat/Makefile.linux 2011-01-21 21:29:57.958658254 +0100
+@@ -1,32 +1,27 @@
+ # $Id: Makefile.linux,v 1.15 2006/06/04 05:07:46 paulus Exp $
+
+-DESTDIR = $(INSTROOT)@DESTDIR@
+-BINDIR = $(DESTDIR)/sbin
+-MANDIR = $(DESTDIR)/share/man/man8
+-
+-CDEF1= -DTERMIOS # Use the termios structure
+-CDEF2= -DSIGTYPE=void # Standard definition
+-CDEF3= -UNO_SLEEP # Use the usleep function
+-CDEF4= -DFNDELAY=O_NDELAY # Old name value
+-CDEFS= $(CDEF1) $(CDEF2) $(CDEF3) $(CDEF4)
++include ../Makedefs.com
-COPTS= -O2 -g -pipe
-CFLAGS= $(COPTS) $(CDEFS)
-+CPPFLAGS?=
-+CFLAGS?=-O2 -g -pipe
-+LDFLAGS?=
++CDEF1=-DTERMIOS # Use the termios structure
++CDEF2=-DSIGTYPE=void # Standard definition
++CDEF3=-UNO_SLEEP # Use the usleep function
++CDEF4=-DFNDELAY=O_NDELA # Old name value
++CDEFS=$(CDEF1) $(CDEF2) $(CDEF3) $(CDEF4)
- INSTALL= install
+-INSTALL= install
++CPPFLAGS += $(CDEFS)
- all: chat
+-all: chat
++PROG = chat
++OBJS = chat.o
- chat: chat.o
+-chat: chat.o
- $(CC) -o chat chat.o
-+ $(CC) $(LDFLAGS) -o chat chat.o
++all: $(PROG)
- chat.o: chat.c
+-chat.o: chat.c
- $(CC) -c $(CFLAGS) -o chat.o chat.c
-+ $(CC) -c $(CPPFLAGS) $(CFLAGS) -o chat.o chat.c
++$(PROG): $(OBJS)
- install: chat
- mkdir -p $(BINDIR) $(MANDIR)
+-install: chat
+- mkdir -p $(BINDIR) $(MANDIR)
- $(INSTALL) -s -c chat $(BINDIR)
-+ $(INSTALL) -c chat $(BINDIR)
++install: $(PROG)
++ $(INSTALL) -d -m 755 $(BINDIR)
++ $(INSTALL) -d -m 755 $(MANDIR)
++ $(INSTALL) $(STRIP) -c $(PROG) $(BINDIR)
$(INSTALL) -c -m 644 chat.8 $(MANDIR)
clean:
+- rm -f chat.o chat *~
++ rm -f $(OBJS) $(PROG) *~
diff --git a/package/ppp/patches/patch-configure b/package/ppp/patches/patch-configure
index 4ec084e2e..b4be911dd 100644
--- a/package/ppp/patches/patch-configure
+++ b/package/ppp/patches/patch-configure
@@ -1,15 +1,87 @@
---- ppp-2.4.4.orig/configure 2005-07-09 02:23:05.000000000 +0200
-+++ ppp-2.4.4/configure 2009-06-05 19:12:00.000000000 +0200
-@@ -8,9 +8,9 @@ SYSCONF=/etc
+--- ppp-2.4.5.orig/configure 2009-11-16 23:26:07.000000000 +0100
++++ ppp-2.4.5/configure 2011-01-21 21:29:57.977408326 +0100
+@@ -5,12 +5,42 @@
+ DESTDIR=/usr/local
+ SYSCONF=/etc
+
++# Parse arguments
++while [ $# -gt 0 ]; do
++ arg=$1
++ val=
++ shift
++ case $arg in
++ *=*)
++ val=`expr "x$arg" : 'x[^=]*=\(.*\)'`
++ arg=`expr "x$arg" : 'x\([^=]*\)=.*'`
++ ;;
++ --prefix|--sysconf|--system|--arch|--release)
++ if [ $# -eq 0 ]; then
++ echo "error: the $arg argument requires a value" 1>&2
++ exit 1
++ fi
++ val=$1
++ shift
++ ;;
++ esac
++ case $arg in
++ --prefix) DESTDIR=$val ;;
++ --sysconfdir) SYSCONF=$val ;;
++ --system) system=$val ;;
++ --release) release=$val ;;
++ --arch) arch=$val ;;
++ esac
++done
++
++echo "DESTDIR is $DESTDIR"
++
# if [ -d /NextApps ]; then
# system="NeXTStep"
# else
- system=`uname -s`
- release=`uname -r`
- arch=`uname -m`
-+ system=${UNAME_S:-`uname -s`}
-+ release=${UNAME_R:-`uname -r`}
-+ arch=${UNAME_M:-`uname -m`}
++if [ -z "$system" ];then system=`uname -s`;fi
++if [ -z "$release" ];then release=`uname -r`;fi
++if [ -z "$arch" ];then arch=`uname -m`;fi
# fi
state="unknown"
+@@ -18,6 +48,7 @@ case $system in
+ Linux)
+ makext="linux";
+ ksrc="linux";
++ compiletype=.gcc;
+ state="known";;
+ SunOS)
+ karch=`/usr/bin/isainfo -k`
+@@ -156,30 +187,6 @@ case $state in
+ echo "Configuring for $system";;
+ esac
+
+-# Parse arguments
+-while [ $# -gt 0 ]; do
+- arg=$1
+- val=
+- shift
+- case $arg in
+- *=*)
+- val=`expr "x$arg" : 'x[^=]*=\(.*\)'`
+- arg=`expr "x$arg" : 'x\([^=]*\)=.*'`
+- ;;
+- --prefix|--sysconf)
+- if [ $# -eq 0 ]; then
+- echo "error: the $arg argument requires a value" 1>&2
+- exit 1
+- fi
+- val=$1
+- shift
+- ;;
+- esac
+- case $arg in
+- --prefix) DESTDIR=$val ;;
+- --sysconfdir) SYSCONF=$val ;;
+- esac
+-done
+
+ mkmkf() {
+ rm -f $2
diff --git a/package/ppp/patches/patch-linux_Makefile_top b/package/ppp/patches/patch-linux_Makefile_top
new file mode 100644
index 000000000..b433c4dd9
--- /dev/null
+++ b/package/ppp/patches/patch-linux_Makefile_top
@@ -0,0 +1,17 @@
+--- ppp-2.4.5.orig/linux/Makefile.top 2009-11-16 23:26:07.000000000 +0100
++++ ppp-2.4.5/linux/Makefile.top 2011-01-21 21:29:58.018658307 +0100
+@@ -1,13 +1,6 @@
+ # PPP top-level Makefile for Linux.
+
+-DESTDIR = $(INSTROOT)@DESTDIR@
+-BINDIR = $(DESTDIR)/sbin
+-INCDIR = $(DESTDIR)/include
+-MANDIR = $(DESTDIR)/share/man
+-ETCDIR = $(INSTROOT)@SYSCONF@/ppp
+-
+-# uid 0 = root
+-INSTALL= install
++include Makedefs.com
+
+ all:
+ cd chat; $(MAKE) $(MFLAGS) all
diff --git a/package/ppp/patches/patch-pppd_Makefile_linux b/package/ppp/patches/patch-pppd_Makefile_linux
index a447ae1ea..0096f7018 100644
--- a/package/ppp/patches/patch-pppd_Makefile_linux
+++ b/package/ppp/patches/patch-pppd_Makefile_linux
@@ -1,109 +1,215 @@
--- ppp-2.4.5.orig/pppd/Makefile.linux 2009-11-16 23:26:07.000000000 +0100
-+++ ppp-2.4.5/pppd/Makefile.linux 2011-01-16 17:09:40.000000000 +0100
-@@ -2,12 +2,7 @@
- # pppd makefile for Linux
++++ ppp-2.4.5/pppd/Makefile.linux 2011-01-21 21:40:47.384898388 +0100
+@@ -3,11 +3,7 @@
# $Id: Makefile.linux,v 1.70 2007/06/19 02:08:34 carlsonj Exp $
#
--
+
-# Default installation locations
-DESTDIR = $(INSTROOT)@DESTDIR@
-BINDIR = $(DESTDIR)/sbin
-MANDIR = $(DESTDIR)/share/man/man8
-INCDIR = $(DESTDIR)/include
-+include ../makedefs.linux
++include ../Makedefs.com
TARGETS = pppd
-@@ -30,10 +25,6 @@ ifeq (.depend,$(wildcard .depend))
- include .depend
- endif
+@@ -24,17 +20,6 @@ PPPDOBJS = main.o magic.o fsm.o lcp.o ip
+ ecp.o auth.o options.o demand.o utils.o sys-linux.o ipxcp.o tty.o \
+ eap.o chap-md5.o session.o
+-#
+-# include dependencies if present
+-ifeq (.depend,$(wildcard .depend))
+-include .depend
+-endif
+-
-# CC = gcc
-#
-COPTS = -O2 -pipe -Wall -g
-LIBS =
-
+-
# Uncomment the next 2 lines to include support for Microsoft's
# MS-CHAP authentication protocol. Also, edit plugins/radius/Makefile.linux.
-@@ -48,7 +39,7 @@ MPPE=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
-
- # Uncomment the next line to enable multilink PPP (enabled by default)
- # Linux distributions: Please leave multilink ENABLED in your builds
-@@ -58,9 +49,9 @@ HAVE_MULTILINK=y
- # Uncomment the next line to enable the TDB database (enabled by default.)
- # If you enable multilink, then TDB is automatically enabled also.
- # Linux distributions: Please leave TDB ENABLED in your builds.
--USE_TDB=y
-+#USE_TDB=y
-
--HAS_SHADOW=y
-+#HAS_SHADOW=y
- #USE_PAM=y
- #HAVE_INET6=y
-
-@@ -75,11 +66,10 @@ PLUGIN=y
+ CHAPMS=y
+@@ -75,28 +60,25 @@ PLUGIN=y
MAXOCTETS=y
-INCLUDE_DIRS= -I../include
-
-COMPILE_FLAGS= -DHAVE_PATHS_H -DIPX_CHANGE -DHAVE_MMAP
-+CPPFLAGS += -I../include
-+CPPFLAGS += -DHAVE_PATHS_H -DHAVE_MMAP
-
+-
-CFLAGS= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS) '-DDESTDIR="@DESTDIR@"'
-+CFLAGS+= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS) '-DDESTDIR="@DESTDIR@"'
++CPPFLAGS += -I../include
++CPPFLAGS += -DHAVE_PATHS_H -DIPX_CHANGE -DHAVE_MMAP '-DDESTDIR="@DESTDIR@"'
ifdef CHAPMS
- CFLAGS += -DCHAPMS=1
-@@ -99,7 +89,7 @@ ifdef USE_SRP
- CFLAGS += -DUSE_SRP -DOPENSSL -I/usr/local/ssl/include
+-CFLAGS += -DCHAPMS=1
++CPPFLAGS += -DCHAPMS=1
+ NEEDDES=y
+ PPPDOBJS += md4.o chap_ms.o
+ HEADERS += md4.h chap_ms.h
+ ifdef MSLANMAN
+-CFLAGS += -DMSLANMAN=1
++CPPFLAGS += -DMSLANMAN=1
+ endif
+ ifdef MPPE
+-CFLAGS += -DMPPE=1
++CPPFLAGS += -DMPPE=1
+ endif
+ endif
+
+ # EAP SRP-SHA1
+ ifdef USE_SRP
+-CFLAGS += -DUSE_SRP -DOPENSSL -I/usr/local/ssl/include
++CPPFLAGS += -DUSE_SRP -DOPENSSL -I/usr/local/ssl/include
LIBS += -lsrp -L/usr/local/ssl/lib -lcrypto
TARGETS += srp-entry
--EXTRAINSTALL = $(INSTALL) -s -c -m 555 srp-entry $(BINDIR)/srp-entry
-+EXTRAINSTALL = $(INSTALL) -c -m 555 srp-entry $(BINDIR)/srp-entry
- MANPAGES += srp-entry.8
- EXTRACLEAN += srp-entry.o
- NEEDDES=y
-@@ -117,10 +107,8 @@ CFLAGS += -DHAS_SHADOW
+ EXTRAINSTALL = $(INSTALL) -s -c -m 555 srp-entry $(BINDIR)/srp-entry
+@@ -113,12 +95,12 @@ PPPDOBJS += sha1.o
+ endif
+
+ ifdef HAS_SHADOW
+-CFLAGS += -DHAS_SHADOW
++CPPFLAGS += -DHAS_SHADOW
#LIBS += -lshadow $(LIBS)
endif
--ifneq ($(wildcard /usr/include/crypt.h),)
- CFLAGS += -DHAVE_CRYPT_H=1
+ ifneq ($(wildcard /usr/include/crypt.h),)
+-CFLAGS += -DHAVE_CRYPT_H=1
++CPPFLAGS += -DHAVE_CRYPT_H=1
LIBS += -lcrypt
--endif
+ endif
- ifdef NEEDDES
+@@ -126,7 +108,7 @@ ifdef NEEDDES
ifndef USE_CRYPT
-@@ -200,16 +188,16 @@ all: $(TARGETS)
+ LIBS += -ldes $(LIBS)
+ else
+-CFLAGS += -DUSE_CRYPT=1
++CPPFLAGS += -DUSE_CRYPT=1
+ endif
+ PPPDOBJS += pppcrypt.o
+ HEADERS += pppcrypt.h
+@@ -134,36 +116,36 @@ endif
+
+ # For "Pluggable Authentication Modules", see ftp.redhat.com:/pub/pam/.
+ ifdef USE_PAM
+-CFLAGS += -DUSE_PAM
++CPPFLAGS += -DUSE_PAM
+ LIBS += -lpam -ldl
+ endif
+
+ # Multi-linnk
+ ifdef HAVE_MULTILINK
+- # Multilink implies the use of TDB
+- USE_TDB=y
++# Multilink implies the use of TDB
++USE_TDB=y
+
+- CFLAGS += -DHAVE_MULTILINK
+- PPPDSRCS += multilink.c
+- PPPDOBJS += multilink.o
++CPPFLAGS += -DHAVE_MULTILINK
++PPPDSRCS += multilink.c
++PPPDOBJS += multilink.o
+ endif
+
+ # TDB
+ ifdef USE_TDB
+- CFLAGS += -DUSE_TDB=1
+- PPPDSRCS += tdb.c spinlock.c
+- PPPDOBJS += tdb.o spinlock.o
+- HEADERS += tdb.h spinlock.h
++CPPFLAGS += -DUSE_TDB=1
++PPPDSRCS += tdb.c spinlock.c
++PPPDOBJS += tdb.o spinlock.o
++HEADERS += tdb.h spinlock.h
+ endif
+
+ # Lock library binary for Linux is included in 'linux' subdirectory.
+ ifdef LOCKLIB
+ LIBS += -llock
+-CFLAGS += -DLOCKLIB=1
++CPPFLAGS += -DLOCKLIB=1
+ endif
+
+ ifdef PLUGIN
+-CFLAGS += -DPLUGIN
++CPPFLAGS += -DPLUGIN
+ LDFLAGS += -Wl,-E
+ LIBS += -ldl
+ endif
+@@ -171,52 +153,51 @@ endif
+ ifdef FILTER
+ ifneq ($(wildcard /usr/include/pcap-bpf.h),)
+ LIBS += -lpcap
+-CFLAGS += -DPPP_FILTER
++CPPFLAGS += -DPPP_FILTER
+ endif
+ endif
+
+ ifdef HAVE_INET6
+- PPPDSRCS += ipv6cp.c eui64.c
+- HEADERS += ipv6cp.h eui64.h
+- PPPDOBJS += ipv6cp.o eui64.o
+- CFLAGS += -DINET6=1
++PPPDSRCS += ipv6cp.c eui64.c
++HEADERS += ipv6cp.h eui64.h
++PPPDOBJS += ipv6cp.o eui64.o
++CPPFLAGS += -DINET6=1
+ endif
+
+ ifdef CBCP
+- PPPDSRCS += cbcp.c
+- PPPDOBJS += cbcp.o
+- CFLAGS += -DCBCP_SUPPORT
+- HEADERS += cbcp.h
++PPPDSRCS += cbcp.c
++PPPDOBJS += cbcp.o
++CPPFLAGS += -DCBCP_SUPPORT
++HEADERS += cbcp.h
+ endif
+
+ ifdef MAXOCTETS
+- CFLAGS += -DMAXOCTETS
++CPPFLAGS += -DMAXOCTETS
+ endif
+
+-INSTALL= install
+-
+ all: $(TARGETS)
+
++# generate dependencies
++#include $(PPPDSRCS:.c=.d)
++
install: pppd
- mkdir -p $(BINDIR) $(MANDIR)
+- mkdir -p $(BINDIR) $(MANDIR)
++ $(INSTALL) -d -m 755 $(BINDIR)
++ $(INSTALL) -d -m 755 $(MANDIR)
$(EXTRAINSTALL)
- $(INSTALL) -s -c -m 555 pppd $(BINDIR)/pppd
-+ $(INSTALL) -c -m 555 pppd $(BINDIR)/pppd
++ $(INSTALL) $(STRIP) -c -m 555 pppd $(BINDIR)/pppd
if chgrp pppusers $(BINDIR)/pppd 2>/dev/null; then \
chmod o-rx,u+s $(BINDIR)/pppd; fi
$(INSTALL) -c -m 444 pppd.8 $(MANDIR)
pppd: $(PPPDOBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) -o pppd $(PPPDOBJS) $(LIBS)
-+ $(CC) $(LDFLAGS) -o pppd $(PPPDOBJS) $(LIBS)
++ $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
- srp-entry: srp-entry.c
+-srp-entry: srp-entry.c
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ srp-entry.c $(LIBS)
-+ $(CC) $(LDFLAGS) -o $@ srp-entry.c $(LIBS)
++srp-entry: srp-entry.o
++ $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
install-devel:
- mkdir -p $(INCDIR)/pppd
-@@ -219,4 +207,4 @@ clean:
- rm -f $(PPPDOBJS) $(EXTRACLEAN) $(TARGETS) *~ #* core
+- mkdir -p $(INCDIR)/pppd
++ $(INSTALL) -d -m 755 $(INCDIR)/pppd
+ $(INSTALL) -c -m 644 $(HEADERS) $(INCDIR)/pppd
- depend:
+ clean:
+- rm -f $(PPPDOBJS) $(EXTRACLEAN) $(TARGETS) *~ #* core
+-
+-depend:
- $(CPP) -M $(CFLAGS) $(PPPDSRCS) >.depend
-+ $(CPP) -M $(CPPFLAGS) $(CFLAGS) $(PPPDSRCS) >.depend
++ rm -f $(PPPDOBJS) $(EXTRACLEAN) $(TARGETS) *.d *~ #* core
diff --git a/package/ppp/patches/patch-pppd_ccp_c b/package/ppp/patches/patch-pppd_ccp_c
deleted file mode 100644
index 66b76b03d..000000000
--- a/package/ppp/patches/patch-pppd_ccp_c
+++ /dev/null
@@ -1,1362 +0,0 @@
---- ppp-2.4.4.orig/pppd/ccp.c 2005-07-09 02:23:05.000000000 +0200
-+++ ppp-2.4.4/pppd/ccp.c 2009-06-05 19:12:00.000000000 +0200
-@@ -62,12 +62,10 @@ static int setdeflate __P((char **));
- static char bsd_value[8];
- static char deflate_value[8];
-
--/*
-- * Option variables.
-- */
- #ifdef MPPE
--bool refuse_mppe_stateful = 1; /* Allow stateful mode? */
--#endif
-+static int setmppe(char **);
-+static int setnomppe(void);
-+#endif /* MPPE */
-
- static option_t ccp_option_list[] = {
- { "noccp", o_bool, &ccp_protent.enabled_flag,
-@@ -108,54 +106,36 @@ static option_t ccp_option_list[] = {
- "don't allow Predictor-1", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR,
- &ccp_allowoptions[0].predictor_1 },
-
--#ifdef MPPE
-- /* MPPE options are symmetrical ... we only set wantoptions here */
-- { "require-mppe", o_bool, &ccp_wantoptions[0].mppe,
-- "require MPPE encryption",
-- OPT_PRIO | MPPE_OPT_40 | MPPE_OPT_128 },
-- { "+mppe", o_bool, &ccp_wantoptions[0].mppe,
-- "require MPPE encryption",
-- OPT_ALIAS | OPT_PRIO | MPPE_OPT_40 | MPPE_OPT_128 },
-- { "nomppe", o_bool, &ccp_wantoptions[0].mppe,
-- "don't allow MPPE encryption", OPT_PRIO },
-- { "-mppe", o_bool, &ccp_wantoptions[0].mppe,
-- "don't allow MPPE encryption", OPT_ALIAS | OPT_PRIO },
--
-- /* We use ccp_allowoptions[0].mppe as a junk var ... it is reset later */
-- { "require-mppe-40", o_bool, &ccp_allowoptions[0].mppe,
-- "require MPPE 40-bit encryption", OPT_PRIO | OPT_A2OR | MPPE_OPT_40,
-- &ccp_wantoptions[0].mppe },
-- { "+mppe-40", o_bool, &ccp_allowoptions[0].mppe,
-- "require MPPE 40-bit encryption", OPT_PRIO | OPT_A2OR | MPPE_OPT_40,
-- &ccp_wantoptions[0].mppe },
-- { "nomppe-40", o_bool, &ccp_allowoptions[0].mppe,
-- "don't allow MPPE 40-bit encryption",
-- OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_40, &ccp_wantoptions[0].mppe },
-- { "-mppe-40", o_bool, &ccp_allowoptions[0].mppe,
-- "don't allow MPPE 40-bit encryption",
-- OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_40,
-- &ccp_wantoptions[0].mppe },
--
-- { "require-mppe-128", o_bool, &ccp_allowoptions[0].mppe,
-- "require MPPE 128-bit encryption", OPT_PRIO | OPT_A2OR | MPPE_OPT_128,
-- &ccp_wantoptions[0].mppe },
-- { "+mppe-128", o_bool, &ccp_allowoptions[0].mppe,
-- "require MPPE 128-bit encryption",
-- OPT_ALIAS | OPT_PRIO | OPT_A2OR | MPPE_OPT_128,
-- &ccp_wantoptions[0].mppe },
-- { "nomppe-128", o_bool, &ccp_allowoptions[0].mppe,
-- "don't allow MPPE 128-bit encryption",
-- OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_128, &ccp_wantoptions[0].mppe },
-- { "-mppe-128", o_bool, &ccp_allowoptions[0].mppe,
-- "don't allow MPPE 128-bit encryption",
-- OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_128,
-- &ccp_wantoptions[0].mppe },
-+ { "lzs", o_bool, &ccp_wantoptions[0].lzs,
-+ "request Stac LZS", 1, &ccp_allowoptions[0].lzs, OPT_PRIO },
-+ { "+lzs", o_bool, &ccp_wantoptions[0].lzs,
-+ "request Stac LZS", 1, &ccp_allowoptions[0].lzs, OPT_ALIAS | OPT_PRIO },
-+ { "nolzs", o_bool, &ccp_wantoptions[0].lzs,
-+ "don't allow Stac LZS", OPT_PRIOSUB | OPT_A2CLR,
-+ &ccp_allowoptions[0].lzs },
-+ { "-lzs", o_bool, &ccp_wantoptions[0].lzs,
-+ "don't allow Stac LZS", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR,
-+ &ccp_allowoptions[0].lzs },
-
-- /* strange one; we always request stateless, but will we allow stateful? */
-- { "mppe-stateful", o_bool, &refuse_mppe_stateful,
-- "allow MPPE stateful mode", OPT_PRIO },
-- { "nomppe-stateful", o_bool, &refuse_mppe_stateful,
-- "disallow MPPE stateful mode", OPT_PRIO | 1 },
-+#ifdef MPPE
-+ { "mppc", o_bool, &ccp_wantoptions[0].mppc,
-+ "request MPPC compression", 1, &ccp_allowoptions[0].mppc },
-+ { "+mppc", o_bool, &ccp_wantoptions[0].mppc,
-+ "request MPPC compression", 1, &ccp_allowoptions[0].mppc, OPT_ALIAS },
-+ { "nomppc", o_bool, &ccp_wantoptions[0].mppc,
-+ "don't allow MPPC compression", OPT_PRIOSUB | OPT_A2CLR,
-+ &ccp_allowoptions[0].mppc },
-+ { "-mppc", o_bool, &ccp_wantoptions[0].mppc,
-+ "don't allow MPPC compression", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR,
-+ &ccp_allowoptions[0].mppc },
-+ { "mppe", o_special, (void *)setmppe,
-+ "request MPPE encryption" },
-+ { "+mppe", o_special, (void *)setmppe,
-+ "request MPPE encryption" },
-+ { "nomppe", o_special_noarg, (void *)setnomppe,
-+ "don't allow MPPE encryption" },
-+ { "-mppe", o_special_noarg, (void *)setnomppe,
-+ "don't allow MPPE encryption" },
- #endif /* MPPE */
-
- { NULL }
-@@ -241,7 +221,7 @@ static fsm_callbacks ccp_callbacks = {
- */
- #define ANY_COMPRESS(opt) ((opt).deflate || (opt).bsd_compress \
- || (opt).predictor_1 || (opt).predictor_2 \
-- || (opt).mppe)
-+ || (opt).lzs || (opt).mppc || (opt).mppe)
-
- /*
- * Local state (mainly for handling reset-reqs and reset-acks).
-@@ -344,6 +324,100 @@ setdeflate(argv)
- return 1;
- }
-
-+#ifdef MPPE
-+/*
-+ * Functions called from config options
-+ */
-+/*
-+ MPPE suboptions:
-+ required - require MPPE; disconnect if peer doesn't support it
-+ stateless - use stateless mode
-+ no40 - disable 40 bit keys
-+ no56 - disable 56 bit keys
-+ no128 - disable 128 bit keys
-+*/
-+int setmppe(char **argv)
-+{
-+ int i;
-+ char *str, cmdbuf[16];
-+
-+ ccp_allowoptions[0].mppe = 1;
-+ ccp_allowoptions[0].mppe_40 = 1;
-+ ccp_allowoptions[0].mppe_56 = 1;
-+ ccp_allowoptions[0].mppe_128 = 1;
-+ ccp_allowoptions[0].mppe_stateless = 0;
-+ ccp_wantoptions[0].mppe = 0;
-+
-+ str = *argv;
-+
-+ while (1) {
-+ i = 0;
-+ memset(cmdbuf, '\0', 16);
-+ while ((i < 16) && (*str != ',') && (*str != '\0'))
-+ cmdbuf[i++] = *str++;
-+ cmdbuf[i] = '\0';
-+ if (!strncasecmp(cmdbuf, "no40", strlen("no40"))) {
-+ ccp_allowoptions[0].mppe_40 = 0;
-+ goto next_param;
-+ } else if (!strncasecmp(cmdbuf, "no56", strlen("no56"))) {
-+ ccp_allowoptions[0].mppe_56 = 0;
-+ goto next_param;
-+ } else if (!strncasecmp(cmdbuf, "no128", strlen("no128"))) {
-+ ccp_allowoptions[0].mppe_128 = 0;
-+ goto next_param;
-+ } else if (!strncasecmp(cmdbuf, "stateless", strlen("stateless"))) {
-+ ccp_allowoptions[0].mppe_stateless = 1;
-+ goto next_param;
-+ } else if (!strncasecmp(cmdbuf, "required", strlen("required"))) {
-+ ccp_wantoptions[0].mppe = 1;
-+ goto next_param;
-+ } else {
-+ option_error("invalid parameter '%s' for mppe option", cmdbuf);
-+ return 0;
-+ }
-+
-+ next_param:
-+ if (*str == ',') {
-+ str++;
-+ continue;
-+ }
-+ if (*str == '\0') {
-+ if (!(ccp_allowoptions[0].mppe_40 || ccp_allowoptions[0].mppe_56 ||
-+ ccp_allowoptions[0].mppe_128)) {
-+ if (ccp_wantoptions[0].mppe == 1) {
-+ option_error("You require MPPE but you have switched off "
-+ "all encryption key lengths.");
-+ return 0;
-+ }
-+ ccp_wantoptions[0].mppe = ccp_allowoptions[0].mppe = 0;
-+ ccp_wantoptions[0].mppe_stateless =
-+ ccp_allowoptions[0].mppe_stateless = 0;
-+ } else {
-+ ccp_allowoptions[0].mppe = 1;
-+ ccp_wantoptions[0].mppe_stateless =
-+ ccp_allowoptions[0].mppe_stateless;
-+ if (ccp_wantoptions[0].mppe == 1) {
-+ ccp_wantoptions[0].mppe_40 = ccp_allowoptions[0].mppe_40;
-+ ccp_wantoptions[0].mppe_56 = ccp_allowoptions[0].mppe_56;
-+ ccp_wantoptions[0].mppe_128 = ccp_allowoptions[0].mppe_128;
-+ }
-+ }
-+ return 1;
-+ }
-+ }
-+}
-+
-+int setnomppe(void)
-+{
-+ ccp_wantoptions[0].mppe = ccp_allowoptions[0].mppe = 0;
-+ ccp_wantoptions[0].mppe_40 = ccp_allowoptions[0].mppe_40 = 0;
-+ ccp_wantoptions[0].mppe_56 = ccp_allowoptions[0].mppe_56 = 0;
-+ ccp_wantoptions[0].mppe_128 = ccp_allowoptions[0].mppe_128 = 0;
-+ ccp_wantoptions[0].mppe_stateless = ccp_allowoptions[0].mppe_stateless = 0;
-+ return 1;
-+}
-+#endif /* MPPE */
-+
- /*
- * ccp_init - initialize CCP.
- */
-@@ -378,6 +452,30 @@ ccp_init(unit)
- ccp_allowoptions[0].bsd_bits = BSD_MAX_BITS;
-
- ccp_allowoptions[0].predictor_1 = 1;
-+
-+ ccp_wantoptions[0].lzs = 0; /* Stac LZS - will be enabled in the future */
-+ ccp_wantoptions[0].lzs_mode = LZS_MODE_SEQ;
-+ ccp_wantoptions[0].lzs_hists = 1;
-+ ccp_allowoptions[0].lzs = 0; /* Stac LZS - will be enabled in the future */
-+ ccp_allowoptions[0].lzs_mode = LZS_MODE_SEQ;
-+ ccp_allowoptions[0].lzs_hists = 1;
-+
-+#ifdef MPPE
-+ /* by default allow and request MPPC... */
-+ ccp_wantoptions[0].mppc = ccp_allowoptions[0].mppc = 1;
-+
-+ /* ... and allow but don't request MPPE */
-+ ccp_allowoptions[0].mppe = 1;
-+ ccp_allowoptions[0].mppe_40 = 1;
-+ ccp_allowoptions[0].mppe_56 = 1;
-+ ccp_allowoptions[0].mppe_128 = 1;
-+ ccp_allowoptions[0].mppe_stateless = 1;
-+ ccp_wantoptions[0].mppe = 0;
-+ ccp_wantoptions[0].mppe_40 = 0;
-+ ccp_wantoptions[0].mppe_56 = 0;
-+ ccp_wantoptions[0].mppe_128 = 0;
-+ ccp_wantoptions[0].mppe_stateless = 0;
-+#endif /* MPPE */
- }
-
- /*
-@@ -455,11 +553,11 @@ ccp_input(unit, p, len)
- if (oldstate == OPENED && p[0] == TERMREQ && f->state != OPENED) {
- notice("Compression disabled by peer.");
- #ifdef MPPE
-- if (ccp_gotoptions[unit].mppe) {
-+ if (ccp_wantoptions[unit].mppe) {
- error("MPPE disabled, closing LCP");
- lcp_close(unit, "MPPE disabled by peer");
- }
--#endif
-+#endif /* MPPE */
- }
-
- /*
-@@ -487,6 +585,15 @@ ccp_extcode(f, code, id, p, len)
- break;
- /* send a reset-ack, which the transmitter will see and
- reset its compression state. */
-+
-+ /* In case of MPPE/MPPC or LZS we shouldn't send CCP_RESETACK,
-+ but we do it in order to reset compressor; CCP_RESETACK is
-+ then silently discarded. See functions ppp_send_frame and
-+ ppp_ccp_peek in ppp_generic.c (Linux only !!!). All the
-+ confusion is caused by the fact that CCP code is splited
-+ into two parts - one part is handled by pppd, the other one
-+ is handled by kernel. */
-+
- fsm_sdata(f, CCP_RESETACK, id, NULL, 0);
- break;
-
-@@ -515,12 +622,11 @@ ccp_protrej(unit)
- fsm_lowerdown(&ccp_fsm[unit]);
-
- #ifdef MPPE
-- if (ccp_gotoptions[unit].mppe) {
-+ if (ccp_wantoptions[unit].mppe) {
- error("MPPE required but peer negotiation failed");
- lcp_close(unit, "MPPE required but peer negotiation failed");
- }
--#endif
--
-+#endif /* MPPE */
- }
-
- /*
-@@ -537,7 +643,7 @@ ccp_resetci(f)
- all_rejected[f->unit] = 0;
-
- #ifdef MPPE
-- if (go->mppe) {
-+ if (go->mppe || go->mppc) {
- ccp_options *ao = &ccp_allowoptions[f->unit];
- int auth_mschap_bits = auth_done[f->unit];
- int numbits;
-@@ -551,80 +657,109 @@ ccp_resetci(f)
- * NB: If MPPE is required, all other compression opts are invalid.
- * So, we return right away if we can't do it.
- */
-+ if (ccp_wantoptions[f->unit].mppe) {
-+ /* Leave only the mschap auth bits set */
-+ auth_mschap_bits &= (CHAP_MS_WITHPEER | CHAP_MS_PEER |
-+ CHAP_MS2_WITHPEER | CHAP_MS2_PEER);
-+ /* Count the mschap auths */
-+ auth_mschap_bits >>= CHAP_MS_SHIFT;
-+ numbits = 0;
-+ do {
-+ numbits += auth_mschap_bits & 1;
-+ auth_mschap_bits >>= 1;
-+ } while (auth_mschap_bits);
-+ if (numbits > 1) {
-+ error("MPPE required, but auth done in both directions.");
-+ lcp_close(f->unit, "MPPE required but not available");
-+ return;
-+ }
-+ if (!numbits) {
-+ error("MPPE required, but MS-CHAP[v2] auth not performed.");
-+ lcp_close(f->unit, "MPPE required but not available");
-+ return;
-+ }
-
-- /* Leave only the mschap auth bits set */
-- auth_mschap_bits &= (CHAP_MS_WITHPEER | CHAP_MS_PEER |
-- CHAP_MS2_WITHPEER | CHAP_MS2_PEER);
-- /* Count the mschap auths */
-- auth_mschap_bits >>= CHAP_MS_SHIFT;
-- numbits = 0;
-- do {
-- numbits += auth_mschap_bits & 1;
-- auth_mschap_bits >>= 1;
-- } while (auth_mschap_bits);
-- if (numbits > 1) {
-- error("MPPE required, but auth done in both directions.");
-- lcp_close(f->unit, "MPPE required but not available");
-- return;
-- }
-- if (!numbits) {
-- error("MPPE required, but MS-CHAP[v2] auth not performed.");
-- lcp_close(f->unit, "MPPE required but not available");
-- return;
-+ /* A plugin (eg radius) may not have obtained key material. */
-+ if (!mppe_keys_set) {
-+ error("MPPE required, but keys are not available. "
-+ "Possible plugin problem?");
-+ lcp_close(f->unit, "MPPE required but not available");
-+ return;
-+ }
- }
-
-- /* A plugin (eg radius) may not have obtained key material. */
-- if (!mppe_keys_set) {
-- error("MPPE required, but keys are not available. "
-- "Possible plugin problem?");
-- lcp_close(f->unit, "MPPE required but not available");
-- return;
-+ /*
-+ * Check whether the kernel knows about the various
-+ * compression methods we might request. Key material
-+ * unimportant here.
-+ */
-+ if (go->mppc) {
-+ opt_buf[0] = CI_MPPE;
-+ opt_buf[1] = CILEN_MPPE;
-+ opt_buf[2] = 0;
-+ opt_buf[3] = 0;
-+ opt_buf[4] = 0;
-+ opt_buf[5] = MPPE_MPPC;
-+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE, 0) <= 0)
-+ go->mppc = 0;
- }
--
-- /* LM auth not supported for MPPE */
-- if (auth_done[f->unit] & (CHAP_MS_WITHPEER | CHAP_MS_PEER)) {
-- /* This might be noise */
-- if (go->mppe & MPPE_OPT_40) {
-- notice("Disabling 40-bit MPPE; MS-CHAP LM not supported");
-- go->mppe &= ~MPPE_OPT_40;
-- ccp_wantoptions[f->unit].mppe &= ~MPPE_OPT_40;
-- }
-+ if (go->mppe_40) {
-+ opt_buf[0] = CI_MPPE;
-+ opt_buf[1] = CILEN_MPPE;
-+ opt_buf[2] = MPPE_STATELESS;
-+ opt_buf[3] = 0;
-+ opt_buf[4] = 0;
-+ opt_buf[5] = MPPE_40BIT;
-+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0)
-+ go->mppe_40 = 0;
- }
--
-- /* Last check: can we actually negotiate something? */
-- if (!(go->mppe & (MPPE_OPT_40 | MPPE_OPT_128))) {
-- /* Could be misconfig, could be 40-bit disabled above. */
-- error("MPPE required, but both 40-bit and 128-bit disabled.");
-- lcp_close(f->unit, "MPPE required but not available");
-- return;
-+ if (go->mppe_56) {
-+ opt_buf[0] = CI_MPPE;
-+ opt_buf[1] = CILEN_MPPE;
-+ opt_buf[2] = MPPE_STATELESS;
-+ opt_buf[3] = 0;
-+ opt_buf[4] = 0;
-+ opt_buf[5] = MPPE_56BIT;
-+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0)
-+ go->mppe_56 = 0;
-+ }
-+ if (go->mppe_128) {
-+ opt_buf[0] = CI_MPPE;
-+ opt_buf[1] = CILEN_MPPE;
-+ opt_buf[2] = MPPE_STATELESS;
-+ opt_buf[3] = 0;
-+ opt_buf[4] = 0;
-+ opt_buf[5] = MPPE_128BIT;
-+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0)
-+ go->mppe_128 = 0;
-+ }
-+ if (!go->mppe_40 && !go->mppe_56 && !go->mppe_128) {
-+ if (ccp_wantoptions[f->unit].mppe) {
-+ error("MPPE required, but kernel has no support.");
-+ lcp_close(f->unit, "MPPE required but not available");
-+ }
-+ go->mppe = go->mppe_stateless = 0;
-+ } else {
-+ /* MPPE is not compatible with other compression types */
-+ if (ccp_wantoptions[f->unit].mppe) {
-+ ao->bsd_compress = go->bsd_compress = 0;
-+ ao->predictor_1 = go->predictor_1 = 0;
-+ ao->predictor_2 = go->predictor_2 = 0;
-+ ao->deflate = go->deflate = 0;
-+ ao->lzs = go->lzs = 0;
-+ }
- }
--
-- /* sync options */
-- ao->mppe = go->mppe;
-- /* MPPE is not compatible with other compression types */
-- ao->bsd_compress = go->bsd_compress = 0;
-- ao->predictor_1 = go->predictor_1 = 0;
-- ao->predictor_2 = go->predictor_2 = 0;
-- ao->deflate = go->deflate = 0;
- }
- #endif /* MPPE */
--
-- /*
-- * Check whether the kernel knows about the various
-- * compression methods we might request.
-- */
--#ifdef MPPE
-- if (go->mppe) {
-- opt_buf[0] = CI_MPPE;
-- opt_buf[1] = CILEN_MPPE;
-- MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]);
-- /* Key material unimportant here. */
-- if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0) {
-- error("MPPE required, but kernel has no support.");
-- lcp_close(f->unit, "MPPE required but not available");
-- }
-+ if (go->lzs) {
-+ opt_buf[0] = CI_LZS;
-+ opt_buf[1] = CILEN_LZS;
-+ opt_buf[2] = go->lzs_hists >> 8;
-+ opt_buf[3] = go->lzs_hists & 0xff;
-+ opt_buf[4] = LZS_MODE_SEQ;
-+ if (ccp_test(f->unit, opt_buf, CILEN_LZS, 0) <= 0)
-+ go->lzs = 0;
- }
--#endif
- if (go->bsd_compress) {
- opt_buf[0] = CI_BSD_COMPRESS;
- opt_buf[1] = CILEN_BSD_COMPRESS;
-@@ -679,7 +814,8 @@ ccp_cilen(f)