[OpenWrt-Devel] [PATCH 2/2,v2] ppp: fix o_special option printing

Nathan Hintz nlhintz at hotmail.com
Wed Jul 16 02:32:26 EDT 2014


PPPD crashes (SEGV) when the 'dump' or 'dryrun' options are specified and
an option defined internally as "o_special" with an option flag of
"OPT_A2STRVAL" is used.  The crash occurs because the option value is not
saved when the parameter is processed, but is then referenced when printed.
Additionally, the "arg" parameter is missing from the call to the "printer"
utility.  This was encountered using xl2tpd and the l2tp_ppp kernel module;
the option PPPD crashes on is "pppol2tp 8".

Modify pppd to correctly save the option value, and to call the printer
utility with the correct parameters.

Signed-off-by: Nathan Hintz <nlhintz at hotmail.com>
---
v2: Address comments from Yousong Zhou

Please apply along with http://patchwork.openwrt.org/patch/5327/

 package/network/services/ppp/Makefile                       |  2 +-
 .../services/ppp/patches/501-save-pppol2tp_fd_str.patch     | 13 +++++++++++++
 .../network/services/ppp/patches/502-fix-printer-args.patch | 11 +++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 package/network/services/ppp/patches/501-save-pppol2tp_fd_str.patch
 create mode 100644 package/network/services/ppp/patches/502-fix-printer-args.patch

diff --git a/package/network/services/ppp/Makefile b/package/network/services/ppp/Makefile
index 4cee97a..724be30 100644
--- a/package/network/services/ppp/Makefile
+++ b/package/network/services/ppp/Makefile
@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=ppp
 PKG_VERSION:=2.4.6
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=ftp://ftp.samba.org/pub/ppp/
diff --git a/package/network/services/ppp/patches/501-save-pppol2tp_fd_str.patch b/package/network/services/ppp/patches/501-save-pppol2tp_fd_str.patch
new file mode 100644
index 0000000..44d7fc5
--- /dev/null
+++ b/package/network/services/ppp/patches/501-save-pppol2tp_fd_str.patch
@@ -0,0 +1,13 @@
+--- a/pppd/plugins/pppol2tp/pppol2tp.c
++++ b/pppd/plugins/pppol2tp/pppol2tp.c
+@@ -150,6 +150,10 @@ static int setdevname_pppol2tp(char **ar
+ 		fatal("PPPoL2TP kernel driver not installed");
+ 	}
+ 
++	pppol2tp_fd_str = strdup(*argv);
++    	if (pppol2tp_fd_str == NULL)
++		novm("PPPoL2TP FD");
++
+ 	/* Setup option defaults. Compression options are disabled! */
+ 
+ 	modem = 0;
diff --git a/package/network/services/ppp/patches/502-fix-printer-args.patch b/package/network/services/ppp/patches/502-fix-printer-args.patch
new file mode 100644
index 0000000..e9201f3
--- /dev/null
+++ b/package/network/services/ppp/patches/502-fix-printer-args.patch
@@ -0,0 +1,11 @@
+--- a/pppd/options.c
++++ b/pppd/options.c
+@@ -994,7 +994,7 @@ print_option(opt, mainopt, printer, arg)
+ 			p = (char *) opt->addr2;
+ 			if ((opt->flags & OPT_STATIC) == 0)
+ 				p = *(char **)p;
+-			printer("%q", p);
++			printer(arg, "%q", p);
+ 		} else if (opt->flags & OPT_A2LIST) {
+ 			struct option_value *ovp;
+ 
-- 
1.9.3
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list