aboutsummaryrefslogtreecommitdiffstats
path: root/package/network
diff options
context:
space:
mode:
authorMartin Schiller <ms@dev.tdt.de>2021-04-14 14:34:56 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2021-05-02 14:43:09 +0200
commit8788e86245e7c1579b3aea980c05dbdf4c74e419 (patch)
tree958cbd9f793c13449456acba7cfd3737220264e0 /package/network
parent4398a3506786715f3b8532714a840d2a212c0fac (diff)
downloadupstream-8788e86245e7c1579b3aea980c05dbdf4c74e419.tar.gz
upstream-8788e86245e7c1579b3aea980c05dbdf4c74e419.tar.bz2
upstream-8788e86245e7c1579b3aea980c05dbdf4c74e419.zip
ppp/pppoe-discovery: fix -W option
This patch is already included in ppp-2.4.9 which is used in openwrt master. Backport this patch to openwrt-19.07. Signed-off-by: Martin Schiller <ms@dev.tdt.de>
Diffstat (limited to 'package/network')
-rw-r--r--package/network/services/ppp/patches/520-fix_-W_option_for_pppoe-discovery_utility.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/package/network/services/ppp/patches/520-fix_-W_option_for_pppoe-discovery_utility.patch b/package/network/services/ppp/patches/520-fix_-W_option_for_pppoe-discovery_utility.patch
new file mode 100644
index 0000000000..b7498c8c75
--- /dev/null
+++ b/package/network/services/ppp/patches/520-fix_-W_option_for_pppoe-discovery_utility.patch
@@ -0,0 +1,60 @@
+From 22d9c14ae3930fe10f26bafc3eab45e3a17eb3fa Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
+Date: Sun, 19 Jul 2020 11:55:43 +0200
+Subject: [PATCH] Fix -W option for pppoe-discovery utility
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+pppoe-discovery's -W option is totally broken. pppoe-discovery currently
+expects that Host-Unique attribute equals to its own process pid if set.
+
+This patch fixes parsing received PPPoE PADO packets when -W option is set.
+Same implementation is in pppd pppoe plugin.
+
+Signed-off-by: Pali Rohár <pali@kernel.org>
+---
+ pppd/plugins/rp-pppoe/pppoe-discovery.c | 18 +++++++-----------
+ 1 file changed, 7 insertions(+), 11 deletions(-)
+
+--- a/pppd/plugins/rp-pppoe/pppoe-discovery.c
++++ b/pppd/plugins/rp-pppoe/pppoe-discovery.c
+@@ -327,14 +327,10 @@ void
+ parseForHostUniq(UINT16_t type, UINT16_t len, unsigned char *data,
+ void *extra)
+ {
+- int *val = (int *) extra;
+- if (type == TAG_HOST_UNIQ && len == sizeof(pid_t)) {
+- pid_t tmp;
+- memcpy(&tmp, data, len);
+- if (tmp == getpid()) {
+- *val = 1;
+- }
+- }
++ PPPoETag *tag = extra;
++
++ if (type == TAG_HOST_UNIQ && len == ntohs(tag->length))
++ tag->length = memcmp(data, tag->payload, len);
+ }
+
+ /**********************************************************************
+@@ -351,7 +347,7 @@ parseForHostUniq(UINT16_t type, UINT16_t
+ int
+ packetIsForMe(PPPoEConnection *conn, PPPoEPacket *packet)
+ {
+- int forMe = 0;
++ PPPoETag hostUniq = conn->hostUniq;
+
+ /* If packet is not directed to our MAC address, forget it */
+ if (memcmp(packet->ethHdr.h_dest, conn->myEth, ETH_ALEN)) return 0;
+@@ -359,8 +355,8 @@ packetIsForMe(PPPoEConnection *conn, PPP
+ /* If we're not using the Host-Unique tag, then accept the packet */
+ if (!conn->hostUniq.length) return 1;
+
+- parsePacket(packet, parseForHostUniq, &forMe);
+- return forMe;
++ parsePacket(packet, parseForHostUniq, &hostUniq);
++ return !hostUniq.length;
+ }
+
+ /**********************************************************************