diff --git a/.github/update.log b/.github/update.log index 283761f664..5158671196 100644 --- a/.github/update.log +++ b/.github/update.log @@ -1191,3 +1191,4 @@ Update On Thu Nov 20 19:39:36 CET 2025 Update On Fri Nov 21 19:35:09 CET 2025 Update On Sat Nov 22 19:36:29 CET 2025 Update On Sun Nov 23 19:36:55 CET 2025 +Update On Mon Nov 24 19:40:17 CET 2025 diff --git a/clash-meta/go.mod b/clash-meta/go.mod index 2047d0eb11..3c1ab95762 100644 --- a/clash-meta/go.mod +++ b/clash-meta/go.mod @@ -32,7 +32,7 @@ require ( github.com/metacubex/sing-shadowsocks v0.2.12 github.com/metacubex/sing-shadowsocks2 v0.2.7 github.com/metacubex/sing-shadowtls v0.0.0-20250503063515-5d9f966d17a2 - github.com/metacubex/sing-tun v0.4.9 + github.com/metacubex/sing-tun v0.4.10-0.20251124160354-85cd06f11a84 github.com/metacubex/sing-vmess v0.2.4 github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f github.com/metacubex/smux v0.0.0-20251111013112-03f8d12dafc1 diff --git a/clash-meta/go.sum b/clash-meta/go.sum index bc29d7fef7..74a5c27619 100644 --- a/clash-meta/go.sum +++ b/clash-meta/go.sum @@ -129,8 +129,8 @@ github.com/metacubex/sing-shadowsocks2 v0.2.7 h1:hSuuc0YpsfiqYqt1o+fP4m34BQz4e6w github.com/metacubex/sing-shadowsocks2 v0.2.7/go.mod h1:vOEbfKC60txi0ca+yUlqEwOGc3Obl6cnSgx9Gf45KjE= github.com/metacubex/sing-shadowtls v0.0.0-20250503063515-5d9f966d17a2 h1:gXU+MYPm7Wme3/OAY2FFzVq9d9GxPHOqu5AQfg/ddhI= github.com/metacubex/sing-shadowtls v0.0.0-20250503063515-5d9f966d17a2/go.mod h1:mbfboaXauKJNIHJYxQRa+NJs4JU9NZfkA+I33dS2+9E= -github.com/metacubex/sing-tun v0.4.9 h1:jY0Yyt8nnN3yQRN/jTxgqNCmGi1dsFdxdIi7pQUlVVU= -github.com/metacubex/sing-tun v0.4.9/go.mod h1:L/TjQY5JEGy8nvsuYmy/XgMFMCPiF0+AWSFCYfS6r9w= +github.com/metacubex/sing-tun v0.4.10-0.20251124160354-85cd06f11a84 h1:PlVO8aCeAnVUsvO9X077iX9wz23nSnbRjtPRdE0GsY8= +github.com/metacubex/sing-tun v0.4.10-0.20251124160354-85cd06f11a84/go.mod h1:L/TjQY5JEGy8nvsuYmy/XgMFMCPiF0+AWSFCYfS6r9w= github.com/metacubex/sing-vmess v0.2.4 h1:Tx6AGgCiEf400E/xyDuYyafsel6sGbR8oF7RkAaus6I= github.com/metacubex/sing-vmess v0.2.4/go.mod h1:21R5R1u90uUvBQF0owoooEu96/SAYYD56nDrwm6nFaM= github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f h1:Sr/DYKYofKHKc4GF3qkRGNuj6XA6c0eqPgEDN+VAsYU= diff --git a/clash-nyanpasu/manifest/version.json b/clash-nyanpasu/manifest/version.json index 8f05ecee9f..de0b61638c 100644 --- a/clash-nyanpasu/manifest/version.json +++ b/clash-nyanpasu/manifest/version.json @@ -2,7 +2,7 @@ "manifest_version": 1, "latest": { "mihomo": "v1.19.16", - "mihomo_alpha": "alpha-140d892", + "mihomo_alpha": "alpha-7571c87", "clash_rs": "v0.9.2", "clash_premium": "2023-09-05-gdcc8d87", "clash_rs_alpha": "0.9.2-alpha+sha.87c7b2c" @@ -69,5 +69,5 @@ "linux-armv7hf": "clash-armv7-unknown-linux-gnueabihf" } }, - "updated_at": "2025-11-22T22:21:07.536Z" + "updated_at": "2025-11-23T22:21:13.537Z" } diff --git a/filebrowser/frontend/pnpm-lock.yaml b/filebrowser/frontend/pnpm-lock.yaml index c94699bb8b..46047119ac 100644 --- a/filebrowser/frontend/pnpm-lock.yaml +++ b/filebrowser/frontend/pnpm-lock.yaml @@ -10,13 +10,13 @@ importers: dependencies: '@chenfengyuan/vue-number-input': specifier: ^2.0.1 - version: 2.0.1(vue@3.5.24(typescript@5.9.3)) + version: 2.0.1(vue@3.5.25(typescript@5.9.3)) '@vueuse/core': specifier: ^14.0.0 - version: 14.0.0(vue@3.5.24(typescript@5.9.3)) + version: 14.0.0(vue@3.5.25(typescript@5.9.3)) '@vueuse/integrations': specifier: ^14.0.0 - version: 14.0.0(focus-trap@7.6.2)(jwt-decode@4.0.0)(vue@3.5.24(typescript@5.9.3)) + version: 14.0.0(focus-trap@7.6.2)(jwt-decode@4.0.0)(vue@3.5.25(typescript@5.9.3)) ace-builds: specifier: ^1.43.2 version: 1.43.4 @@ -52,13 +52,13 @@ importers: version: 8.0.1 pinia: specifier: ^3.0.4 - version: 3.0.4(typescript@5.9.3)(vue@3.5.24(typescript@5.9.3)) + version: 3.0.4(typescript@5.9.3)(vue@3.5.25(typescript@5.9.3)) pretty-bytes: specifier: ^7.1.0 version: 7.1.0 qrcode.vue: specifier: ^3.6.0 - version: 3.6.0(vue@3.5.24(typescript@5.9.3)) + version: 3.6.0(vue@3.5.25(typescript@5.9.3)) tus-js-client: specifier: ^4.3.1 version: 4.3.1 @@ -76,13 +76,13 @@ importers: version: 1.1.1(video.js@8.23.4) vue: specifier: ^3.5.17 - version: 3.5.24(typescript@5.9.3) + version: 3.5.25(typescript@5.9.3) vue-final-modal: specifier: ^4.5.5 - version: 4.5.5(@vueuse/core@14.0.0(vue@3.5.24(typescript@5.9.3)))(@vueuse/integrations@14.0.0(focus-trap@7.6.2)(jwt-decode@4.0.0)(vue@3.5.24(typescript@5.9.3)))(focus-trap@7.6.2)(vue@3.5.24(typescript@5.9.3)) + version: 4.5.5(@vueuse/core@14.0.0(vue@3.5.25(typescript@5.9.3)))(@vueuse/integrations@14.0.0(focus-trap@7.6.2)(jwt-decode@4.0.0)(vue@3.5.25(typescript@5.9.3)))(focus-trap@7.6.2)(vue@3.5.25(typescript@5.9.3)) vue-i18n: specifier: ^11.1.10 - version: 11.2.1(vue@3.5.24(typescript@5.9.3)) + version: 11.2.1(vue@3.5.25(typescript@5.9.3)) vue-lazyload: specifier: ^3.0.0 version: 3.0.0 @@ -91,14 +91,14 @@ importers: version: 1.3.3 vue-router: specifier: ^4.5.1 - version: 4.6.3(vue@3.5.24(typescript@5.9.3)) + version: 4.6.3(vue@3.5.25(typescript@5.9.3)) vue-toastification: specifier: ^2.0.0-rc.5 - version: 2.0.0-rc.5(vue@3.5.24(typescript@5.9.3)) + version: 2.0.0-rc.5(vue@3.5.25(typescript@5.9.3)) devDependencies: '@intlify/unplugin-vue-i18n': specifier: ^11.0.1 - version: 11.0.1(@vue/compiler-dom@3.5.24)(eslint@9.39.1)(rollup@4.53.3)(typescript@5.9.3)(vue-i18n@11.2.1(vue@3.5.24(typescript@5.9.3)))(vue@3.5.24(typescript@5.9.3)) + version: 11.0.1(@vue/compiler-dom@3.5.25)(eslint@9.39.1)(rollup@4.53.3)(typescript@5.9.3)(vue-i18n@11.2.1(vue@3.5.25(typescript@5.9.3)))(vue@3.5.25(typescript@5.9.3)) '@tsconfig/node24': specifier: ^24.0.2 version: 24.0.3 @@ -116,7 +116,7 @@ importers: version: 7.2.1(terser@5.44.1)(vite@7.2.4(@types/node@24.10.1)(terser@5.44.1)(yaml@2.7.0)) '@vitejs/plugin-vue': specifier: ^6.0.1 - version: 6.0.2(vite@7.2.4(@types/node@24.10.1)(terser@5.44.1)(yaml@2.7.0))(vue@3.5.24(typescript@5.9.3)) + version: 6.0.2(vite@7.2.4(@types/node@24.10.1)(terser@5.44.1)(yaml@2.7.0))(vue@3.5.25(typescript@5.9.3)) '@vue/eslint-config-prettier': specifier: ^10.2.0 version: 10.2.0(eslint@9.39.1)(prettier@3.6.2) @@ -125,7 +125,7 @@ importers: version: 14.6.0(eslint-plugin-vue@10.6.0(@typescript-eslint/parser@8.37.0(eslint@9.39.1)(typescript@5.9.3))(eslint@9.39.1)(vue-eslint-parser@10.2.0(eslint@9.39.1)))(eslint@9.39.1)(typescript@5.9.3) '@vue/tsconfig': specifier: ^0.8.1 - version: 0.8.1(typescript@5.9.3)(vue@3.5.24(typescript@5.9.3)) + version: 0.8.1(typescript@5.9.3)(vue@3.5.25(typescript@5.9.3)) autoprefixer: specifier: ^10.4.21 version: 10.4.22(postcss@8.5.6) @@ -1296,17 +1296,17 @@ packages: '@volar/typescript@2.4.23': resolution: {integrity: sha512-lAB5zJghWxVPqfcStmAP1ZqQacMpe90UrP5RJ3arDyrhy4aCUQqmxPPLB2PWDKugvylmO41ljK7vZ+t6INMTag==} - '@vue/compiler-core@3.5.24': - resolution: {integrity: sha512-eDl5H57AOpNakGNAkFDH+y7kTqrQpJkZFXhWZQGyx/5Wh7B1uQYvcWkvZi11BDhscPgj8N7XV3oRwiPnx1Vrig==} + '@vue/compiler-core@3.5.25': + resolution: {integrity: sha512-vay5/oQJdsNHmliWoZfHPoVZZRmnSWhug0BYT34njkYTPqClh3DNWLkZNJBVSjsNMrg0CCrBfoKkjZQPM/QVUw==} - '@vue/compiler-dom@3.5.24': - resolution: {integrity: sha512-1QHGAvs53gXkWdd3ZMGYuvQFXHW4ksKWPG8HP8/2BscrbZ0brw183q2oNWjMrSWImYLHxHrx1ItBQr50I/q2zw==} + '@vue/compiler-dom@3.5.25': + resolution: {integrity: sha512-4We0OAcMZsKgYoGlMjzYvaoErltdFI2/25wqanuTu+S4gismOTRTBPi4IASOjxWdzIwrYSjnqONfKvuqkXzE2Q==} - '@vue/compiler-sfc@3.5.24': - resolution: {integrity: sha512-8EG5YPRgmTB+YxYBM3VXy8zHD9SWHUJLIGPhDovo3Z8VOgvP+O7UP5vl0J4BBPWYD9vxtBabzW1EuEZ+Cqs14g==} + '@vue/compiler-sfc@3.5.25': + resolution: {integrity: sha512-PUgKp2rn8fFsI++lF2sO7gwO2d9Yj57Utr5yEsDf3GNaQcowCLKL7sf+LvVFvtJDXUp/03+dC6f2+LCv5aK1ag==} - '@vue/compiler-ssr@3.5.24': - resolution: {integrity: sha512-trOvMWNBMQ/odMRHW7Ae1CdfYx+7MuiQu62Jtu36gMLXcaoqKvAyh+P73sYG9ll+6jLB6QPovqoKGGZROzkFFg==} + '@vue/compiler-ssr@3.5.25': + resolution: {integrity: sha512-ritPSKLBcParnsKYi+GNtbdbrIE1mtuFEJ4U1sWeuOMlIziK5GtOL85t5RhsNy4uWIXPgk+OUdpnXiTdzn8o3A==} '@vue/devtools-api@6.6.4': resolution: {integrity: sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==} @@ -1345,22 +1345,22 @@ packages: typescript: optional: true - '@vue/reactivity@3.5.24': - resolution: {integrity: sha512-BM8kBhtlkkbnyl4q+HiF5R5BL0ycDPfihowulm02q3WYp2vxgPcJuZO866qa/0u3idbMntKEtVNuAUp5bw4teg==} + '@vue/reactivity@3.5.25': + resolution: {integrity: sha512-5xfAypCQepv4Jog1U4zn8cZIcbKKFka3AgWHEFQeK65OW+Ys4XybP6z2kKgws4YB43KGpqp5D/K3go2UPPunLA==} - '@vue/runtime-core@3.5.24': - resolution: {integrity: sha512-RYP/byyKDgNIqfX/gNb2PB55dJmM97jc9wyF3jK7QUInYKypK2exmZMNwnjueWwGceEkP6NChd3D2ZVEp9undQ==} + '@vue/runtime-core@3.5.25': + resolution: {integrity: sha512-Z751v203YWwYzy460bzsYQISDfPjHTl+6Zzwo/a3CsAf+0ccEjQ8c+0CdX1WsumRTHeywvyUFtW6KvNukT/smA==} - '@vue/runtime-dom@3.5.24': - resolution: {integrity: sha512-Z8ANhr/i0XIluonHVjbUkjvn+CyrxbXRIxR7wn7+X7xlcb7dJsfITZbkVOeJZdP8VZwfrWRsWdShH6pngMxRjw==} + '@vue/runtime-dom@3.5.25': + resolution: {integrity: sha512-a4WrkYFbb19i9pjkz38zJBg8wa/rboNERq3+hRRb0dHiJh13c+6kAbgqCPfMaJ2gg4weWD3APZswASOfmKwamA==} - '@vue/server-renderer@3.5.24': - resolution: {integrity: sha512-Yh2j2Y4G/0/4z/xJ1Bad4mxaAk++C2v4kaa8oSYTMJBJ00/ndPuxCnWeot0/7/qafQFLh5pr6xeV6SdMcE/G1w==} + '@vue/server-renderer@3.5.25': + resolution: {integrity: sha512-UJaXR54vMG61i8XNIzTSf2Q7MOqZHpp8+x3XLGtE3+fL+nQd+k7O5+X3D/uWrnQXOdMw5VPih+Uremcw+u1woQ==} peerDependencies: - vue: 3.5.24 + vue: 3.5.25 - '@vue/shared@3.5.24': - resolution: {integrity: sha512-9cwHL2EsJBdi8NY22pngYYWzkTDhld6fAD6jlaeloNGciNSJL6bLpbxVgXl96X00Jtc6YWQv96YA/0sxex/k1A==} + '@vue/shared@3.5.25': + resolution: {integrity: sha512-AbOPdQQnAnzs58H2FrrDxYj/TJfmeS2jdfEEhgiKINy+bnOANmVizIEgq1r+C5zsbs6l1CCQxtcj71rwNQ4jWg==} '@vue/tsconfig@0.8.1': resolution: {integrity: sha512-aK7feIWPXFSUhsCP9PFqPyFOcz4ENkb8hZ2pneL6m2UjCkccvaOhC/5KCKluuBufvp2KzkbdA2W2pk20vLzu3g==} @@ -1578,8 +1578,8 @@ packages: engines: {node: '>=4'} hasBin: true - csstype@3.1.3: - resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} + csstype@3.2.3: + resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==} custom-error-instance@2.1.1: resolution: {integrity: sha512-p6JFxJc3M4OTD2li2qaHkDCw9SfMw82Ldr6OC9Je1aXiGfhx2W8p3GaoeaGrPJTUN9NirTM/KTxHWMUdR1rsUg==} @@ -2524,8 +2524,8 @@ packages: peerDependencies: typescript: '>=5.0.0' - vue@3.5.24: - resolution: {integrity: sha512-uTHDOpVQTMjcGgrqFPSb8iO2m1DUvo+WbGqoXQz8Y1CeBYQ0FXf2z1gLRaBtHjlRz7zZUBHxjVB5VTLzYkvftg==} + vue@3.5.25: + resolution: {integrity: sha512-YLVdgv2K13WJ6n+kD5owehKtEXwdwXuj2TTyJMsO7pSeKw2bfRNZGjhB7YzrpbMYj5b5QsUebHpOqR3R3ziy/g==} peerDependencies: typescript: '*' peerDependenciesMeta: @@ -3220,9 +3220,9 @@ snapshots: '@babel/helper-string-parser': 7.27.1 '@babel/helper-validator-identifier': 7.28.5 - '@chenfengyuan/vue-number-input@2.0.1(vue@3.5.24(typescript@5.9.3))': + '@chenfengyuan/vue-number-input@2.0.1(vue@3.5.25(typescript@5.9.3))': dependencies: - vue: 3.5.24(typescript@5.9.3) + vue: 3.5.25(typescript@5.9.3) '@esbuild/aix-ppc64@0.25.12': optional: true @@ -3359,7 +3359,7 @@ snapshots: '@humanwhocodes/retry@0.4.3': {} - '@intlify/bundle-utils@11.0.1(vue-i18n@11.2.1(vue@3.5.24(typescript@5.9.3)))': + '@intlify/bundle-utils@11.0.1(vue-i18n@11.2.1(vue@3.5.25(typescript@5.9.3)))': dependencies: '@intlify/message-compiler': 11.2.1 '@intlify/shared': 11.1.12 @@ -3371,7 +3371,7 @@ snapshots: source-map-js: 1.2.1 yaml-eslint-parser: 1.2.3 optionalDependencies: - vue-i18n: 11.2.1(vue@3.5.24(typescript@5.9.3)) + vue-i18n: 11.2.1(vue@3.5.25(typescript@5.9.3)) '@intlify/core-base@11.2.1': dependencies: @@ -3387,12 +3387,12 @@ snapshots: '@intlify/shared@11.2.1': {} - '@intlify/unplugin-vue-i18n@11.0.1(@vue/compiler-dom@3.5.24)(eslint@9.39.1)(rollup@4.53.3)(typescript@5.9.3)(vue-i18n@11.2.1(vue@3.5.24(typescript@5.9.3)))(vue@3.5.24(typescript@5.9.3))': + '@intlify/unplugin-vue-i18n@11.0.1(@vue/compiler-dom@3.5.25)(eslint@9.39.1)(rollup@4.53.3)(typescript@5.9.3)(vue-i18n@11.2.1(vue@3.5.25(typescript@5.9.3)))(vue@3.5.25(typescript@5.9.3))': dependencies: '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1) - '@intlify/bundle-utils': 11.0.1(vue-i18n@11.2.1(vue@3.5.24(typescript@5.9.3))) + '@intlify/bundle-utils': 11.0.1(vue-i18n@11.2.1(vue@3.5.25(typescript@5.9.3))) '@intlify/shared': 11.1.12 - '@intlify/vue-i18n-extensions': 8.0.0(@intlify/shared@11.1.12)(@vue/compiler-dom@3.5.24)(vue-i18n@11.2.1(vue@3.5.24(typescript@5.9.3)))(vue@3.5.24(typescript@5.9.3)) + '@intlify/vue-i18n-extensions': 8.0.0(@intlify/shared@11.1.12)(@vue/compiler-dom@3.5.25)(vue-i18n@11.2.1(vue@3.5.25(typescript@5.9.3)))(vue@3.5.25(typescript@5.9.3)) '@rollup/pluginutils': 5.3.0(rollup@4.53.3) '@typescript-eslint/scope-manager': 8.46.4 '@typescript-eslint/typescript-estree': 8.46.4(typescript@5.9.3) @@ -3401,9 +3401,9 @@ snapshots: pathe: 2.0.3 picocolors: 1.1.1 unplugin: 2.3.10 - vue: 3.5.24(typescript@5.9.3) + vue: 3.5.25(typescript@5.9.3) optionalDependencies: - vue-i18n: 11.2.1(vue@3.5.24(typescript@5.9.3)) + vue-i18n: 11.2.1(vue@3.5.25(typescript@5.9.3)) transitivePeerDependencies: - '@vue/compiler-dom' - eslint @@ -3411,14 +3411,14 @@ snapshots: - supports-color - typescript - '@intlify/vue-i18n-extensions@8.0.0(@intlify/shared@11.1.12)(@vue/compiler-dom@3.5.24)(vue-i18n@11.2.1(vue@3.5.24(typescript@5.9.3)))(vue@3.5.24(typescript@5.9.3))': + '@intlify/vue-i18n-extensions@8.0.0(@intlify/shared@11.1.12)(@vue/compiler-dom@3.5.25)(vue-i18n@11.2.1(vue@3.5.25(typescript@5.9.3)))(vue@3.5.25(typescript@5.9.3))': dependencies: '@babel/parser': 7.28.5 optionalDependencies: '@intlify/shared': 11.1.12 - '@vue/compiler-dom': 3.5.24 - vue: 3.5.24(typescript@5.9.3) - vue-i18n: 11.2.1(vue@3.5.24(typescript@5.9.3)) + '@vue/compiler-dom': 3.5.25 + vue: 3.5.25(typescript@5.9.3) + vue-i18n: 11.2.1(vue@3.5.25(typescript@5.9.3)) '@jridgewell/gen-mapping@0.3.13': dependencies: @@ -3815,11 +3815,11 @@ snapshots: transitivePeerDependencies: - supports-color - '@vitejs/plugin-vue@6.0.2(vite@7.2.4(@types/node@24.10.1)(terser@5.44.1)(yaml@2.7.0))(vue@3.5.24(typescript@5.9.3))': + '@vitejs/plugin-vue@6.0.2(vite@7.2.4(@types/node@24.10.1)(terser@5.44.1)(yaml@2.7.0))(vue@3.5.25(typescript@5.9.3))': dependencies: '@rolldown/pluginutils': 1.0.0-beta.50 vite: 7.2.4(@types/node@24.10.1)(terser@5.44.1)(yaml@2.7.0) - vue: 3.5.24(typescript@5.9.3) + vue: 3.5.25(typescript@5.9.3) '@volar/language-core@2.4.23': dependencies: @@ -3833,35 +3833,35 @@ snapshots: path-browserify: 1.0.1 vscode-uri: 3.1.0 - '@vue/compiler-core@3.5.24': + '@vue/compiler-core@3.5.25': dependencies: '@babel/parser': 7.28.5 - '@vue/shared': 3.5.24 + '@vue/shared': 3.5.25 entities: 4.5.0 estree-walker: 2.0.2 source-map-js: 1.2.1 - '@vue/compiler-dom@3.5.24': + '@vue/compiler-dom@3.5.25': dependencies: - '@vue/compiler-core': 3.5.24 - '@vue/shared': 3.5.24 + '@vue/compiler-core': 3.5.25 + '@vue/shared': 3.5.25 - '@vue/compiler-sfc@3.5.24': + '@vue/compiler-sfc@3.5.25': dependencies: '@babel/parser': 7.28.5 - '@vue/compiler-core': 3.5.24 - '@vue/compiler-dom': 3.5.24 - '@vue/compiler-ssr': 3.5.24 - '@vue/shared': 3.5.24 + '@vue/compiler-core': 3.5.25 + '@vue/compiler-dom': 3.5.25 + '@vue/compiler-ssr': 3.5.25 + '@vue/shared': 3.5.25 estree-walker: 2.0.2 magic-string: 0.30.21 postcss: 8.5.6 source-map-js: 1.2.1 - '@vue/compiler-ssr@3.5.24': + '@vue/compiler-ssr@3.5.25': dependencies: - '@vue/compiler-dom': 3.5.24 - '@vue/shared': 3.5.24 + '@vue/compiler-dom': 3.5.25 + '@vue/shared': 3.5.25 '@vue/devtools-api@6.6.4': {} @@ -3908,8 +3908,8 @@ snapshots: '@vue/language-core@3.1.5(typescript@5.9.3)': dependencies: '@volar/language-core': 2.4.23 - '@vue/compiler-dom': 3.5.24 - '@vue/shared': 3.5.24 + '@vue/compiler-dom': 3.5.25 + '@vue/shared': 3.5.25 alien-signals: 3.1.0 muggle-string: 0.4.1 path-browserify: 1.0.1 @@ -3917,56 +3917,56 @@ snapshots: optionalDependencies: typescript: 5.9.3 - '@vue/reactivity@3.5.24': + '@vue/reactivity@3.5.25': dependencies: - '@vue/shared': 3.5.24 + '@vue/shared': 3.5.25 - '@vue/runtime-core@3.5.24': + '@vue/runtime-core@3.5.25': dependencies: - '@vue/reactivity': 3.5.24 - '@vue/shared': 3.5.24 + '@vue/reactivity': 3.5.25 + '@vue/shared': 3.5.25 - '@vue/runtime-dom@3.5.24': + '@vue/runtime-dom@3.5.25': dependencies: - '@vue/reactivity': 3.5.24 - '@vue/runtime-core': 3.5.24 - '@vue/shared': 3.5.24 - csstype: 3.1.3 + '@vue/reactivity': 3.5.25 + '@vue/runtime-core': 3.5.25 + '@vue/shared': 3.5.25 + csstype: 3.2.3 - '@vue/server-renderer@3.5.24(vue@3.5.24(typescript@5.9.3))': + '@vue/server-renderer@3.5.25(vue@3.5.25(typescript@5.9.3))': dependencies: - '@vue/compiler-ssr': 3.5.24 - '@vue/shared': 3.5.24 - vue: 3.5.24(typescript@5.9.3) + '@vue/compiler-ssr': 3.5.25 + '@vue/shared': 3.5.25 + vue: 3.5.25(typescript@5.9.3) - '@vue/shared@3.5.24': {} + '@vue/shared@3.5.25': {} - '@vue/tsconfig@0.8.1(typescript@5.9.3)(vue@3.5.24(typescript@5.9.3))': + '@vue/tsconfig@0.8.1(typescript@5.9.3)(vue@3.5.25(typescript@5.9.3))': optionalDependencies: typescript: 5.9.3 - vue: 3.5.24(typescript@5.9.3) + vue: 3.5.25(typescript@5.9.3) - '@vueuse/core@14.0.0(vue@3.5.24(typescript@5.9.3))': + '@vueuse/core@14.0.0(vue@3.5.25(typescript@5.9.3))': dependencies: '@types/web-bluetooth': 0.0.21 '@vueuse/metadata': 14.0.0 - '@vueuse/shared': 14.0.0(vue@3.5.24(typescript@5.9.3)) - vue: 3.5.24(typescript@5.9.3) + '@vueuse/shared': 14.0.0(vue@3.5.25(typescript@5.9.3)) + vue: 3.5.25(typescript@5.9.3) - '@vueuse/integrations@14.0.0(focus-trap@7.6.2)(jwt-decode@4.0.0)(vue@3.5.24(typescript@5.9.3))': + '@vueuse/integrations@14.0.0(focus-trap@7.6.2)(jwt-decode@4.0.0)(vue@3.5.25(typescript@5.9.3))': dependencies: - '@vueuse/core': 14.0.0(vue@3.5.24(typescript@5.9.3)) - '@vueuse/shared': 14.0.0(vue@3.5.24(typescript@5.9.3)) - vue: 3.5.24(typescript@5.9.3) + '@vueuse/core': 14.0.0(vue@3.5.25(typescript@5.9.3)) + '@vueuse/shared': 14.0.0(vue@3.5.25(typescript@5.9.3)) + vue: 3.5.25(typescript@5.9.3) optionalDependencies: focus-trap: 7.6.2 jwt-decode: 4.0.0 '@vueuse/metadata@14.0.0': {} - '@vueuse/shared@14.0.0(vue@3.5.24(typescript@5.9.3))': + '@vueuse/shared@14.0.0(vue@3.5.25(typescript@5.9.3))': dependencies: - vue: 3.5.24(typescript@5.9.3) + vue: 3.5.25(typescript@5.9.3) '@xmldom/xmldom@0.7.13': {} @@ -4118,7 +4118,7 @@ snapshots: cssesc@3.0.0: {} - csstype@3.1.3: {} + csstype@3.2.3: {} custom-error-instance@2.1.1: {} @@ -4668,10 +4668,10 @@ snapshots: picomatch@4.0.3: {} - pinia@3.0.4(typescript@5.9.3)(vue@3.5.24(typescript@5.9.3)): + pinia@3.0.4(typescript@5.9.3)(vue@3.5.25(typescript@5.9.3)): dependencies: '@vue/devtools-api': 7.7.8 - vue: 3.5.24(typescript@5.9.3) + vue: 3.5.25(typescript@5.9.3) optionalDependencies: typescript: 5.9.3 @@ -4714,9 +4714,9 @@ snapshots: punycode@2.3.1: {} - qrcode.vue@3.6.0(vue@3.5.24(typescript@5.9.3)): + qrcode.vue@3.6.0(vue@3.5.25(typescript@5.9.3)): dependencies: - vue: 3.5.24(typescript@5.9.3) + vue: 3.5.25(typescript@5.9.3) querystringify@2.2.0: {} @@ -5014,19 +5014,19 @@ snapshots: transitivePeerDependencies: - supports-color - vue-final-modal@4.5.5(@vueuse/core@14.0.0(vue@3.5.24(typescript@5.9.3)))(@vueuse/integrations@14.0.0(focus-trap@7.6.2)(jwt-decode@4.0.0)(vue@3.5.24(typescript@5.9.3)))(focus-trap@7.6.2)(vue@3.5.24(typescript@5.9.3)): + vue-final-modal@4.5.5(@vueuse/core@14.0.0(vue@3.5.25(typescript@5.9.3)))(@vueuse/integrations@14.0.0(focus-trap@7.6.2)(jwt-decode@4.0.0)(vue@3.5.25(typescript@5.9.3)))(focus-trap@7.6.2)(vue@3.5.25(typescript@5.9.3)): dependencies: - '@vueuse/core': 14.0.0(vue@3.5.24(typescript@5.9.3)) - '@vueuse/integrations': 14.0.0(focus-trap@7.6.2)(jwt-decode@4.0.0)(vue@3.5.24(typescript@5.9.3)) + '@vueuse/core': 14.0.0(vue@3.5.25(typescript@5.9.3)) + '@vueuse/integrations': 14.0.0(focus-trap@7.6.2)(jwt-decode@4.0.0)(vue@3.5.25(typescript@5.9.3)) focus-trap: 7.6.2 - vue: 3.5.24(typescript@5.9.3) + vue: 3.5.25(typescript@5.9.3) - vue-i18n@11.2.1(vue@3.5.24(typescript@5.9.3)): + vue-i18n@11.2.1(vue@3.5.25(typescript@5.9.3)): dependencies: '@intlify/core-base': 11.2.1 '@intlify/shared': 11.2.1 '@vue/devtools-api': 6.6.4 - vue: 3.5.24(typescript@5.9.3) + vue: 3.5.25(typescript@5.9.3) vue-lazyload@3.0.0: {} @@ -5034,14 +5034,14 @@ snapshots: dependencies: epubjs: 0.3.93 - vue-router@4.6.3(vue@3.5.24(typescript@5.9.3)): + vue-router@4.6.3(vue@3.5.25(typescript@5.9.3)): dependencies: '@vue/devtools-api': 6.6.4 - vue: 3.5.24(typescript@5.9.3) + vue: 3.5.25(typescript@5.9.3) - vue-toastification@2.0.0-rc.5(vue@3.5.24(typescript@5.9.3)): + vue-toastification@2.0.0-rc.5(vue@3.5.25(typescript@5.9.3)): dependencies: - vue: 3.5.24(typescript@5.9.3) + vue: 3.5.25(typescript@5.9.3) vue-tsc@3.1.5(typescript@5.9.3): dependencies: @@ -5049,13 +5049,13 @@ snapshots: '@vue/language-core': 3.1.5(typescript@5.9.3) typescript: 5.9.3 - vue@3.5.24(typescript@5.9.3): + vue@3.5.25(typescript@5.9.3): dependencies: - '@vue/compiler-dom': 3.5.24 - '@vue/compiler-sfc': 3.5.24 - '@vue/runtime-dom': 3.5.24 - '@vue/server-renderer': 3.5.24(vue@3.5.24(typescript@5.9.3)) - '@vue/shared': 3.5.24 + '@vue/compiler-dom': 3.5.25 + '@vue/compiler-sfc': 3.5.25 + '@vue/runtime-dom': 3.5.25 + '@vue/server-renderer': 3.5.25(vue@3.5.25(typescript@5.9.3)) + '@vue/shared': 3.5.25 optionalDependencies: typescript: 5.9.3 diff --git a/lede/package/network/services/ppp/Makefile b/lede/package/network/services/ppp/Makefile index 419136ca18..0fef19e360 100644 --- a/lede/package/network/services/ppp/Makefile +++ b/lede/package/network/services/ppp/Makefile @@ -9,27 +9,43 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ppp -PKG_RELEASE:=6 +PKG_VERSION:=2.5.2 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/paulusmack/ppp -PKG_SOURCE_DATE:=2021-01-04 -PKG_SOURCE_VERSION:=4fb319056f168bb8379865b91b4fd3e1ada73f1e -PKG_MIRROR_HASH:=429cb5fcff36e1d8698766130711d4764347f08b83233dfb4831bea21616efef +PKG_SOURCE_URL:=https://github.com/ppp-project/ppp +PKG_MIRROR_HASH:=495bc264c765fd57b64f85e8ecb40b965e1da0818fc63d1fa5c9f3761b049471 +PKG_SOURCE_DATE:=2024-12-31 +PKG_SOURCE_VERSION:=9f612dc02c34509f062ed63b60bcc7e937e25178 + PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-4-Clause PKG_CPE_ID:=cpe:/a:samba:ppp -PKG_RELEASE_VERSION:=2.4.9 -PKG_VERSION:=$(PKG_RELEASE_VERSION).git-$(PKG_SOURCE_DATE) - -PKG_BUILD_DEPENDS:=libpcap - PKG_ASLR_PIE_REGULAR:=1 +PKG_BUILD_DEPENDS:=libpcap +PKG_BUILD_FLAGS:=gc-sections lto PKG_BUILD_PARALLEL:=1 +PKG_FIXUP:=autoreconf PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk +CONFIGURE_ARGS += \ + --disable-cbcp \ + --disable-eaptls \ + --disable-mslanman \ + --disable-openssl-engine \ + --disable-peap \ + --disable-systemd \ + --enable-ipv6cp \ + --enable-microsoft-extensions \ + --enable-plugins \ + --with-atm \ + --with-static-pcap \ + --without-openssl \ + --without-pam \ + --without-pcap \ + --without-srp define Package/ppp/Default SECTION:=net @@ -39,14 +55,14 @@ endef define Package/ppp $(call Package/ppp/Default) - DEPENDS:=+kmod-ppp +libpthread +shellsync +kmod-mppe + DEPENDS:= +USE_GLIBC:libcrypt-compat +kmod-ppp +shellsync +kmod-mppe TITLE:=PPP daemon VARIANT:=default endef define Package/ppp-multilink $(call Package/ppp/Default) - DEPENDS:=+kmod-ppp + DEPENDS:= +USE_GLIBC:libcrypt-compat +kmod-ppp TITLE:=PPP daemon (with multilink support) VARIANT:=multilink endef @@ -173,54 +189,25 @@ This tool performs the same discovery process as pppoe, but does not initiate a session. Can be useful to debug pppoe. endef - -define Build/Configure -$(call Build/Configure/Default,, \ - UNAME_S="Linux" \ - UNAME_R="$(LINUX_VERSION)" \ - UNAME_M="$(ARCH)" \ -) - mkdir -p $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux - $(CP) \ - $(LINUX_DIR)/include/linux/compiler.h \ - $(LINUX_DIR)/include/$(LINUX_UAPI_DIR)linux/atm*.h \ - $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/ - - # Kernel 4.14.9+ only, ignore the exit status of cp in case the file - # doesn't exits - -$(CP) $(LINUX_DIR)/include/linux/compiler_types.h \ - $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/ -endef - -TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto -TARGET_LDFLAGS += -Wl,--gc-sections -flto -fuse-linker-plugin - -MAKE_FLAGS += COPTS="$(TARGET_CFLAGS)" \ - PRECOMPILED_FILTER=1 \ - STAGING_DIR="$(STAGING_DIR)" - ifeq ($(BUILD_VARIANT),multilink) - MAKE_FLAGS += HAVE_MULTILINK=y -else - MAKE_FLAGS += HAVE_MULTILINK= -endif - -ifdef CONFIG_USE_MUSL - MAKE_FLAGS += USE_LIBUTIL= + CONFIGURE_ARGS += \ + --enable-multilink endif define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include - $(CP) $(PKG_INSTALL_DIR)/include/pppd $(1)/usr/include/ + $(CP) $(PKG_INSTALL_DIR)/usr/include/pppd $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig endef define Package/ppp/script_install endef define Package/ppp/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppd $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pppd $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/etc/ppp $(INSTALL_CONF) ./files/etc/ppp/chap-secrets $(1)/etc/ppp/ $(INSTALL_DATA) ./files/etc/ppp/filter $(1)/etc/ppp/ @@ -235,21 +222,21 @@ endef Package/ppp-multilink/install=$(Package/ppp/install) define Package/ppp-mod-pppoa/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/pppoatm.so \ - $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/pppoatm.so \ + $(1)/usr/lib/pppd/$(PKG_VERSION)/ endef define Package/ppp-mod-pppoe/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/pppoe.so \ - $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/pppoe.so \ + $(1)/usr/lib/pppd/$(PKG_VERSION)/ endef define Package/ppp-mod-radius/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/radius.so \ - $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/radius.so \ + $(1)/usr/lib/pppd/$(PKG_VERSION)/ $(INSTALL_DIR) $(1)/etc/ppp $(INSTALL_DATA) ./files/etc/ppp/radius.conf $(1)/etc/ppp/ $(INSTALL_DIR) $(1)/etc/ppp/radius @@ -260,43 +247,43 @@ define Package/ppp-mod-radius/install endef define Package/ppp-mod-pppol2tp/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/pppol2tp.so \ - $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/pppol2tp.so \ + $(1)/usr/lib/pppd/$(PKG_VERSION)/ endef define Package/ppp-mod-pptp/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/pptp.so \ - $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/pptp.so \ + $(1)/usr/lib/pppd/$(PKG_VERSION)/ $(INSTALL_DIR) $(1)/etc/ppp $(INSTALL_DATA) ./files/etc/ppp/options.pptp $(1)/etc/ppp/ endef define Package/ppp-mod-passwordfd/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/passwordfd.so \ - $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/passwordfd.so \ + $(1)/usr/lib/pppd/$(PKG_VERSION)/ endef define Package/chat/install $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/chat $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/chat $(1)/usr/sbin/ endef define Package/pppdump/install $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppdump $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pppdump $(1)/usr/sbin/ endef define Package/pppstats/install $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppstats $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pppstats $(1)/usr/sbin/ endef define Package/pppoe-discovery/install $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppoe-discovery $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pppoe-discovery $(1)/usr/sbin/ endef $(eval $(call BuildPackage,ppp)) diff --git a/lede/package/network/services/ppp/files/etc/ppp/options.pptp b/lede/package/network/services/ppp/files/etc/ppp/options.pptp index 46a3f48112..a4705bc0e1 100644 --- a/lede/package/network/services/ppp/files/etc/ppp/options.pptp +++ b/lede/package/network/services/ppp/files/etc/ppp/options.pptp @@ -3,5 +3,7 @@ noauth nobsdcomp nodeflate idle 0 -mppe required,no40,no56,stateless +nomppe-40 +require-mppe-128 +nomppe-stateful maxfail 0 diff --git a/lede/package/network/services/ppp/files/lib/netifd/ppp-down b/lede/package/network/services/ppp/files/lib/netifd/ppp-down index 94cefc415e..8c9b6912ec 100755 --- a/lede/package/network/services/ppp/files/lib/netifd/ppp-down +++ b/lede/package/network/services/ppp/files/lib/netifd/ppp-down @@ -11,3 +11,4 @@ proto_send_update "$PPP_IPPARAM" [ -x "$SCRIPT" ] && "$SCRIPT" "$@" done } +sleep 3 diff --git a/lede/package/network/services/ppp/files/lib/netifd/ppp6-up b/lede/package/network/services/ppp/files/lib/netifd/ppp6-up index 3852bf63ff..913e50015f 100755 --- a/lede/package/network/services/ppp/files/lib/netifd/ppp6-up +++ b/lede/package/network/services/ppp/files/lib/netifd/ppp6-up @@ -26,7 +26,11 @@ if [ -n "$AUTOIPV6" ]; then [ -n "$ZONE" ] && json_add_string zone "$ZONE" [ -n "$EXTENDPREFIX" ] && json_add_string extendprefix 1 [ -n "$IP6TABLE" ] && json_add_string ip6table $IP6TABLE + [ -n "$REQPREFIX" ] && json_add_string reqprefix $REQPREFIX [ -n "$PEERDNS" ] && json_add_boolean peerdns $PEERDNS + [ "$NOSOURCEFILTER" = "1" ] && json_add_boolean sourcefilter "0" + [ "$DELEGATE" = "0" ] && json_add_boolean delegate "0" + [ -n "$NORELEASE" ] && json_add_boolean norelease "1" json_close_object ubus call network add_dynamic "$(json_dump)" fi diff --git a/lede/package/network/services/ppp/files/ppp.sh b/lede/package/network/services/ppp/files/ppp.sh index f6c43b5740..c85384ac90 100755 --- a/lede/package/network/services/ppp/files/ppp.sh +++ b/lede/package/network/services/ppp/files/ppp.sh @@ -79,16 +79,20 @@ ppp_generic_init_config() { proto_config_add_int mtu proto_config_add_string pppname proto_config_add_string unnumbered + proto_config_add_string reqprefix proto_config_add_boolean persist proto_config_add_int maxfail proto_config_add_int holdoff + proto_config_add_boolean sourcefilter + proto_config_add_boolean delegate + proto_config_add_boolean norelease } ppp_generic_setup() { local config="$1"; shift local localip - json_get_vars ip6table demand keepalive keepalive_adaptive username password pppd_options pppname unnumbered persist maxfail holdoff peerdns + json_get_vars ip6table demand keepalive keepalive_adaptive username password pppd_options pppname unnumbered reqprefix persist maxfail holdoff peerdns sourcefilter delegate norelease [ ! -e /proc/sys/net/ipv6 ] && ipv6=0 || json_get_var ipv6 ipv6 @@ -99,6 +103,11 @@ ppp_generic_setup() { autoipv6=1 fi + if [ "$autoipv6" != 1 ]; then + reqprefix="" + norelease="" + fi + if [ "${demand:-0}" -gt 0 ]; then demand="precompiled-active-filter /etc/ppp/filter demand idle $demand" else @@ -133,6 +142,9 @@ ppp_generic_setup() { [ "${keepalive_adaptive:-1}" -lt 1 ] && lcp_adaptive="" [ -n "$connect" ] || json_get_var connect connect [ -n "$disconnect" ] || json_get_var disconnect disconnect + [ "$sourcefilter" = "0" ] || sourcefilter="" + [ "$delegate" != "0" ] && delegate="" + [ "$norelease" = "1" ] || norelease="" proto_run_command "$config" /usr/sbin/pppd \ nodetach ipparam "$config" \ @@ -141,8 +153,12 @@ ppp_generic_setup() { ${lcp_failure:+lcp-echo-interval $lcp_interval lcp-echo-failure $lcp_failure $lcp_adaptive} \ ${ipv6:++ipv6} \ ${autoipv6:+set AUTOIPV6=1} \ + ${reqprefix:+set REQPREFIX=$reqprefix} \ + ${norelease:+set NORELEASE=1} \ ${ip6table:+set IP6TABLE=$ip6table} \ ${peerdns:+set PEERDNS=$peerdns} \ + ${sourcefilter:+set NOSOURCEFILTER=1} \ + ${delegate:+set DELEGATE=0} \ nodefaultroute \ usepeerdns \ $demand $persist maxfail $maxfail \ @@ -209,6 +225,7 @@ proto_pppoe_init_config() { ppp_generic_init_config proto_config_add_string "ac" proto_config_add_string "service" + proto_config_add_string "ac_mac" proto_config_add_string "host_uniq" proto_config_add_int "padi_attempts" proto_config_add_int "padi_timeout" @@ -227,6 +244,7 @@ proto_pppoe_setup() { json_get_var ac ac json_get_var service service + json_get_var ac_mac ac_mac json_get_var host_uniq host_uniq json_get_var padi_attempts padi_attempts json_get_var padi_timeout padi_timeout @@ -244,6 +262,7 @@ proto_pppoe_setup() { plugin pppoe.so \ ${ac:+rp_pppoe_ac "$ac"} \ ${service:+rp_pppoe_service "$service"} \ + ${ac_mac:+pppoe-mac "$ac_mac"} \ ${host_uniq:+host-uniq "$host_uniq"} \ ${padi_attempts:+pppoe-padi-attempts $padi_attempts} \ ${padi_timeout:+pppoe-padi-timeout $padi_timeout} \ diff --git a/lede/package/network/services/ppp/patches/000-pppd-session-fixed-building-with-gcc-15.patch b/lede/package/network/services/ppp/patches/000-pppd-session-fixed-building-with-gcc-15.patch new file mode 100644 index 0000000000..6b4f1bd365 --- /dev/null +++ b/lede/package/network/services/ppp/patches/000-pppd-session-fixed-building-with-gcc-15.patch @@ -0,0 +1,30 @@ +From 5edcb01f1d8d521c819d45df1f1bb87697252130 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 17 Mar 2025 14:38:26 -0700 +Subject: [PATCH] pppd/session: Fixed building with GCC 15 + +Fixed building with GCC 15 which defaults to C23 +and find conflicting declration of getspnam() here +with the one provided by shadow.h (extern struct spwd *getspnam (const char *__name);) + +Fixes +../../ppp-2.5.2/pppd/session.c: In function 'session_start': +../../ppp-2.5.2/pppd/session.c:185:18: error: conflicting types for 'getspnam'; have 'struct spwd *(void)' + 185 | struct spwd *getspnam(); + | ^~~~~~~~ + +Signed-off-by: Khem Raj +--- + pppd/session.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/pppd/session.c ++++ b/pppd/session.c +@@ -182,7 +182,6 @@ session_start(const int flags, const cha + char *cbuf; + #ifdef HAVE_SHADOW_H + struct spwd *spwd; +- struct spwd *getspnam(); + long now = 0; + #endif /* #ifdef HAVE_SHADOW_H */ + #endif /* #ifdef PPP_WITH_PAM */ diff --git a/lede/package/network/services/ppp/patches/001-pppdump-fixed-building-with-gcc-15.patch b/lede/package/network/services/ppp/patches/001-pppdump-fixed-building-with-gcc-15.patch new file mode 100644 index 0000000000..cd3f670772 --- /dev/null +++ b/lede/package/network/services/ppp/patches/001-pppdump-fixed-building-with-gcc-15.patch @@ -0,0 +1,70 @@ +From c6c84c77c16878745be4955f2f5baac1f2280c96 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= +Date: Thu, 27 Feb 2025 11:44:08 +0100 +Subject: [PATCH] Fixed building with GCC 15 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +GCC 15 defaults to C23 which does not allow K&R declarations. + +Credit Yaakov Selkowitz in: +https://src.fedoraproject.org/rpms/ppp/pull-request/12 + +Signed-off-by: Jaroslav Škarvada +--- + pppdump/pppdump.c | 20 +++++++------------- + 1 file changed, 7 insertions(+), 13 deletions(-) + +--- a/pppdump/pppdump.c ++++ b/pppdump/pppdump.c +@@ -42,14 +42,12 @@ int tot_sent, tot_rcvd; + extern int optind; + extern char *optarg; + +-void dumplog(); +-void dumpppp(); +-void show_time(); ++void dumplog(FILE *); ++void dumpppp(FILE *); ++void show_time(FILE *, int); + + int +-main(ac, av) +- int ac; +- char **av; ++main(int ac, char **av) + { + int i; + char *p; +@@ -97,8 +95,7 @@ main(ac, av) + } + + void +-dumplog(f) +- FILE *f; ++dumplog(FILE *f) + { + int c, n, k, col; + int nb, c2; +@@ -241,8 +238,7 @@ struct pkt { + unsigned char dbuf[8192]; + + void +-dumpppp(f) +- FILE *f; ++dumpppp(FILE *f) + { + int c, n, k; + int nb, nl, dn, proto, rv; +@@ -375,9 +371,7 @@ dumpppp(f) + } + + void +-show_time(f, c) +- FILE *f; +- int c; ++show_time(FILE *f, int c) + { + time_t t; + int n; diff --git a/lede/package/network/services/ppp/patches/010-use_target_for_configure.patch b/lede/package/network/services/ppp/patches/010-use_target_for_configure.patch deleted file mode 100644 index 9e8618f83c..0000000000 --- a/lede/package/network/services/ppp/patches/010-use_target_for_configure.patch +++ /dev/null @@ -1,24 +0,0 @@ -configure: Allow overriding uname results - -In a cross compile setting it makes no sense to rely on the "uname" values -reported by the build host system. This patch allows overriding the -"uname -r", "uname -s" and "uname -m" results with the "UNAME_R", "UNAME_S" -and "UNAME_M" environment variables. - -Signed-off-by: Jo-Philipp Wich - ---- a/configure -+++ b/configure -@@ -10,9 +10,9 @@ CROSS_COMPILE= - CC=cc - CFLAGS= - --system=`uname -s` --release=`uname -r` --arch=`uname -m` -+system=${UNAME_S:-`uname -s`} -+release=${UNAME_R:-`uname -r`} -+arch=${UNAME_M:-`uname -m`} - state="unknown" - - case $system in diff --git a/lede/package/network/services/ppp/patches/105-debian_demand.patch b/lede/package/network/services/ppp/patches/105-debian_demand.patch index ff66aa8ea5..25f1644aa4 100644 --- a/lede/package/network/services/ppp/patches/105-debian_demand.patch +++ b/lede/package/network/services/ppp/patches/105-debian_demand.patch @@ -1,6 +1,6 @@ --- a/pppd/demand.c +++ b/pppd/demand.c -@@ -36,6 +36,8 @@ +@@ -34,6 +34,8 @@ #include #include #include @@ -9,16 +9,16 @@ #include #include #include -@@ -43,6 +45,8 @@ +@@ -41,6 +43,8 @@ #include #include #include +#include +#include - #ifdef PPP_FILTER + #ifdef PPP_WITH_FILTER #include #endif -@@ -218,6 +222,14 @@ loop_chars(unsigned char *p, int n) +@@ -217,6 +221,14 @@ loop_chars(unsigned char *p, int n) int c, rv; rv = 0; @@ -33,7 +33,7 @@ for (; n > 0; --n) { c = *p++; if (c == PPP_FLAG) { -@@ -294,16 +306,100 @@ loop_frame(unsigned char *frame, int len +@@ -293,16 +305,100 @@ loop_frame(unsigned char *frame, int len * loopback, now that the real serial link is up. */ void @@ -137,7 +137,7 @@ } else { --- a/pppd/ipcp.c +++ b/pppd/ipcp.c -@@ -1850,7 +1850,7 @@ ipcp_up(fsm *f) +@@ -1915,7 +1915,7 @@ ipcp_up(fsm *f) proxy_arp_set[f->unit] = 1; } @@ -148,7 +148,7 @@ } else { --- a/pppd/ipv6cp.c +++ b/pppd/ipv6cp.c -@@ -1253,7 +1253,7 @@ ipv6cp_up(fsm *f) +@@ -1338,7 +1338,7 @@ ipv6cp_up(fsm *f) if (sif6defaultroute(f->unit, go->ourid, ho->hisid)) default_route_set[f->unit] = 1; } @@ -157,14 +157,14 @@ sifnpmode(f->unit, PPP_IPV6, NPMODE_PASS); } else { ---- a/pppd/pppd.h -+++ b/pppd/pppd.h -@@ -598,7 +598,7 @@ void demand_conf(void); /* config interf +--- a/pppd/pppd-private.h ++++ b/pppd/pppd-private.h +@@ -370,7 +370,7 @@ void demand_conf(void); /* config interf void demand_block(void); /* set all NPs to queue up packets */ void demand_unblock(void); /* set all NPs to pass packets */ void demand_discard(void); /* set all NPs to discard packets */ -void demand_rexmit(int); /* retransmit saved frames for an NP */ -+void demand_rexmit(int, u_int32_t); /* retransmit saved frames for an NP*/ ++void demand_rexmit(int, u_int32_t); /* retransmit saved frames for an NP */ int loop_chars(unsigned char *, int); /* process chars from loopback */ int loop_frame(unsigned char *, int); /* should we bring link up? */ diff --git a/lede/package/network/services/ppp/patches/120-debian_ipv6_updown_option.patch b/lede/package/network/services/ppp/patches/120-debian_ipv6_updown_option.patch deleted file mode 100644 index 11e8d81f43..0000000000 --- a/lede/package/network/services/ppp/patches/120-debian_ipv6_updown_option.patch +++ /dev/null @@ -1,95 +0,0 @@ -pppd: Allow specifying ipv6-up and ipv6-down scripts - -This patch implements the "ipv6-up-script" and "ipv6-down-script" options -which allow to specify the path of the ipv6-up and ipv6-down scripts to call. - -These options default to _PATH_IPV6UP and _PATH_IPV6DOWN to retain the -existing behaviour. - -The patch originated from the Debian project. - -Signed-off-by: Jo-Philipp Wich - ---- a/pppd/main.c -+++ b/pppd/main.c -@@ -295,6 +295,8 @@ main(int argc, char *argv[]) - - strlcpy(path_ipup, _PATH_IPUP, sizeof(path_ipup)); - strlcpy(path_ipdown, _PATH_IPDOWN, sizeof(path_ipdown)); -+ strlcpy(path_ipv6up, _PATH_IPV6UP, sizeof(path_ipv6up)); -+ strlcpy(path_ipv6down, _PATH_IPV6DOWN, sizeof(path_ipv6down)); - - link_stats_valid = 0; - new_phase(PHASE_INITIALIZE); ---- a/pppd/options.c -+++ b/pppd/options.c -@@ -118,6 +118,8 @@ int req_unit = -1; /* requested interfa - char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */ - char path_ipdown[MAXPATHLEN];/* pathname of ip-down script */ - char req_ifname[MAXIFNAMELEN]; /* requested interface name */ -+char path_ipv6up[MAXPATHLEN]; /* pathname of ipv6-up script */ -+char path_ipv6down[MAXPATHLEN];/* pathname of ipv6-down script */ - bool multilink = 0; /* Enable multilink operation */ - char *bundle_name = NULL; /* bundle name for multilink */ - bool dump_options; /* print out option values */ -@@ -324,6 +326,13 @@ option_t general_options[] = { - "Set pathname of ip-down script", - OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN }, - -+ { "ipv6-up-script", o_string, path_ipv6up, -+ "Set pathname of ipv6-up script", -+ OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN }, -+ { "ipv6-down-script", o_string, path_ipv6down, -+ "Set pathname of ipv6-down script", -+ OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN }, -+ - #ifdef HAVE_MULTILINK - { "multilink", o_bool, &multilink, - "Enable multilink operation", OPT_PRIO | 1 }, ---- a/pppd/ipv6cp.c -+++ b/pppd/ipv6cp.c -@@ -1295,7 +1295,7 @@ ipv6cp_up(fsm *f) - */ - if (ipv6cp_script_state == s_down && ipv6cp_script_pid == 0) { - ipv6cp_script_state = s_up; -- ipv6cp_script(_PATH_IPV6UP); -+ ipv6cp_script(path_ipv6up); - } - } - -@@ -1346,7 +1346,7 @@ ipv6cp_down(fsm *f) - /* Execute the ipv6-down script */ - if (ipv6cp_script_state == s_up && ipv6cp_script_pid == 0) { - ipv6cp_script_state = s_down; -- ipv6cp_script(_PATH_IPV6DOWN); -+ ipv6cp_script(path_ipv6down); - } - } - -@@ -1384,13 +1384,13 @@ ipv6cp_script_done(void *arg) - case s_up: - if (ipv6cp_fsm[0].state != OPENED) { - ipv6cp_script_state = s_down; -- ipv6cp_script(_PATH_IPV6DOWN); -+ ipv6cp_script(path_ipv6down); - } - break; - case s_down: - if (ipv6cp_fsm[0].state == OPENED) { - ipv6cp_script_state = s_up; -- ipv6cp_script(_PATH_IPV6UP); -+ ipv6cp_script(path_ipv6up); - } - break; - } ---- a/pppd/pppd.h -+++ b/pppd/pppd.h -@@ -328,6 +328,8 @@ extern int req_unit; /* interface unit n - extern char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */ - extern char path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */ - extern char req_ifname[MAXIFNAMELEN]; /* interface name to use */ -+extern char path_ipv6up[MAXPATHLEN]; /* pathname of ipv6-up script */ -+extern char path_ipv6down[MAXPATHLEN]; /* pathname of ipv6-down script */ - extern bool multilink; /* enable multilink operation */ - extern bool noendpoint; /* don't send or accept endpt. discrim. */ - extern char *bundle_name; /* bundle name for multilink */ diff --git a/lede/package/network/services/ppp/patches/133-fix_sha1_include.patch b/lede/package/network/services/ppp/patches/133-fix_sha1_include.patch deleted file mode 100644 index 357d951441..0000000000 --- a/lede/package/network/services/ppp/patches/133-fix_sha1_include.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/pppd/sha1.c -+++ b/pppd/sha1.c -@@ -19,7 +19,7 @@ - #include - #include - #include /* htonl() */ --#include -+#include "pppd.h" - #include "sha1.h" - - static void diff --git a/lede/package/network/services/ppp/patches/200-makefile.patch b/lede/package/network/services/ppp/patches/200-makefile.patch deleted file mode 100644 index d0b9a9a99b..0000000000 --- a/lede/package/network/services/ppp/patches/200-makefile.patch +++ /dev/null @@ -1,56 +0,0 @@ -pppd: tune Linux config defaults for OpenWrt - -This patch adjusts a number defaults to properly match the OpenWrt environment. -It is not intended for upstream. - -Signed-off-by: Jo-Philipp Wich - ---- a/pppd/Makefile.linux -+++ b/pppd/Makefile.linux -@@ -49,7 +49,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 -@@ -59,7 +59,7 @@ 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 - - # Uncomment the next line to enable Type=notify services in systemd - # If enabled, and the user sets the up_sdnotify option, then -@@ -85,13 +85,13 @@ USE_LIBUTIL=y - endif - - # Enable EAP-TLS authentication (requires MPPE support, libssl and libcrypto) --USE_EAPTLS=y -+#USE_EAPTLS=y - - MAXOCTETS=y - - INCLUDE_DIRS= -I../include - --COMPILE_FLAGS= -DHAVE_PATHS_H -DIPX_CHANGE -DHAVE_MMAP -pipe -+COMPILE_FLAGS= -DHAVE_PATHS_H -DHAVE_MMAP -pipe - - CFLAGS= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS) '-DDESTDIR="@DESTDIR@"' - -@@ -143,10 +143,10 @@ CFLAGS += -DHAS_SHADOW - #LIBS += -lshadow $(LIBS) - endif - --ifeq ($(shell echo '\#include ' | $(CC) -E - >/dev/null 2>&1 && echo yes),yes) -+#ifeq ($(shell echo '\#include ' | $(CC) -E - >/dev/null 2>&1 && echo yes),yes) - CFLAGS += -DHAVE_CRYPT_H=1 - LIBS += -lcrypt --endif -+#endif - - ifdef USE_LIBUTIL - CFLAGS += -DHAVE_LOGWTMP=1 diff --git a/lede/package/network/services/ppp/patches/201-mppe_mppc_1.1.patch b/lede/package/network/services/ppp/patches/201-mppe_mppc_1.1.patch deleted file mode 100644 index 3c30517e42..0000000000 --- a/lede/package/network/services/ppp/patches/201-mppe_mppc_1.1.patch +++ /dev/null @@ -1,1518 +0,0 @@ -pppd: add support for MPPE and MPPC encryption and compression protocols - -This is a forward ported version of ppp-2.4.3-mppe-mppc-1.1.patch.gz found on -http://mppe-mppc.alphacron.de/ . - -Signed-off-by: Jo-Philipp Wich - ---- a/include/linux/ppp-comp.h -+++ b/include/linux/ppp-comp.h -@@ -36,7 +36,7 @@ - */ - - /* -- * ==FILEVERSION 20020319== -+ * ==FILEVERSION 20020715== - * - * NOTE TO MAINTAINERS: - * If you modify this file at all, please set the above date. -@@ -201,6 +201,33 @@ struct compressor { - #define CI_MPPE 18 /* config option for MPPE */ - #define CILEN_MPPE 6 /* length of config option */ - -+/* MPPE/MPPC definitions by J.D.*/ -+#define MPPE_STATELESS MPPE_H_BIT /* configuration bit H */ -+#define MPPE_40BIT MPPE_L_BIT /* configuration bit L */ -+#define MPPE_56BIT MPPE_M_BIT /* configuration bit M */ -+#define MPPE_128BIT MPPE_S_BIT /* configuration bit S */ -+#define MPPE_MPPC MPPE_C_BIT /* configuration bit C */ -+ -+/* -+ * Definitions for Stac LZS. -+ */ -+ -+#define CI_LZS 17 /* config option for Stac LZS */ -+#define CILEN_LZS 5 /* length of config option */ -+ -+#define LZS_OVHD 4 /* max. LZS overhead */ -+#define LZS_HIST_LEN 2048 /* LZS history size */ -+#define LZS_MAX_CCOUNT 0x0FFF /* max. coherency counter value */ -+ -+#define LZS_MODE_NONE 0 -+#define LZS_MODE_LCB 1 -+#define LZS_MODE_CRC 2 -+#define LZS_MODE_SEQ 3 -+#define LZS_MODE_EXT 4 -+ -+#define LZS_EXT_BIT_FLUSHED 0x80 /* bit A */ -+#define LZS_EXT_BIT_COMP 0x20 /* bit C */ -+ - /* - * Definitions for other, as yet unsupported, compression methods. - */ ---- a/include/net/ppp-comp.h -+++ b/include/net/ppp-comp.h -@@ -168,6 +168,33 @@ struct compressor { - #define CI_MPPE 18 /* config option for MPPE */ - #define CILEN_MPPE 6 /* length of config option */ - -+/* MPPE/MPPC definitions by J.D.*/ -+#define MPPE_STATELESS MPPE_H_BIT /* configuration bit H */ -+#define MPPE_40BIT MPPE_L_BIT /* configuration bit L */ -+#define MPPE_56BIT MPPE_M_BIT /* configuration bit M */ -+#define MPPE_128BIT MPPE_S_BIT /* configuration bit S */ -+#define MPPE_MPPC MPPE_C_BIT /* configuration bit C */ -+ -+/* -+ * Definitions for Stac LZS. -+ */ -+ -+#define CI_LZS 17 /* config option for Stac LZS */ -+#define CILEN_LZS 5 /* length of config option */ -+ -+#define LZS_OVHD 4 /* max. LZS overhead */ -+#define LZS_HIST_LEN 2048 /* LZS history size */ -+#define LZS_MAX_CCOUNT 0x0FFF /* max. coherency counter value */ -+ -+#define LZS_MODE_NONE 0 -+#define LZS_MODE_LCB 1 -+#define LZS_MODE_CRC 2 -+#define LZS_MODE_SEQ 3 -+#define LZS_MODE_EXT 4 -+ -+#define LZS_EXT_BIT_FLUSHED 0x80 /* bit A */ -+#define LZS_EXT_BIT_COMP 0x20 /* bit C */ -+ - /* - * Definitions for other, as yet unsupported, compression methods. - */ ---- a/pppd/ccp.c -+++ b/pppd/ccp.c -@@ -61,12 +61,10 @@ static int setdeflate (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, -@@ -107,54 +105,36 @@ static option_t ccp_option_list[] = { - "don't allow Predictor-1", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR, - &ccp_allowoptions[0].predictor_1 }, - -+ { "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 }, -+ - #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 }, -- -- /* 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 }, -+ { "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 } -@@ -240,7 +220,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). -@@ -341,6 +321,100 @@ setdeflate(char **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. - */ -@@ -374,6 +448,30 @@ ccp_init(int 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 */ - } - - /* -@@ -443,11 +541,11 @@ ccp_input(int unit, u_char *p, int 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 */ - } - - /* -@@ -471,6 +569,15 @@ ccp_extcode(fsm *f, int code, int id, u_ - 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; - -@@ -498,12 +605,11 @@ ccp_protrej(int 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 */ - } - - /* -@@ -519,7 +625,7 @@ ccp_resetci(fsm *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]; - #ifdef USE_EAPTLS -@@ -536,95 +642,124 @@ ccp_resetci(fsm *f) - * NB: If MPPE is required, all other compression opts are invalid. - * So, we return right away if we can't do it. - */ -- -- /* 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 (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; -+ } - - #ifdef USE_EAPTLS -- /* -- * MPPE is also possible in combination with EAP-TLS. -- * It is not possible to detect if we're doing EAP or EAP-TLS -- * at this stage, hence we accept all forms of EAP. If TLS is -- * not used then the MPPE keys will not be derived anyway. -- */ -- /* Leave only the eap auth bits set */ -- auth_eap_bits &= (EAP_WITHPEER | EAP_PEER ); -+ /* -+ * MPPE is also possible in combination with EAP-TLS. -+ * It is not possible to detect if we're doing EAP or EAP-TLS -+ * at this stage, hence we accept all forms of EAP. If TLS is -+ * not used then the MPPE keys will not be derived anyway. -+ */ -+ /* Leave only the eap auth bits set */ -+ auth_eap_bits &= (EAP_WITHPEER | EAP_PEER ); - -- if ((numbits == 0) && (auth_eap_bits == 0)) { -- error("MPPE required, but MS-CHAP[v2] nor EAP-TLS auth are performed."); -+ if ((numbits == 0) && (auth_eap_bits == 0)) { -+ error("MPPE required, but MS-CHAP[v2] nor EAP-TLS auth are performed."); - #else -- if (!numbits) { -- error("MPPE required, but MS-CHAP[v2] auth not performed."); -+ if (!numbits) { -+ error("MPPE required, but MS-CHAP[v2] auth not performed."); - #endif -- lcp_close(f->unit, "MPPE required but not available"); -- return; -- } -+ 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; -- } -- -- /* 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; -+ /* 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; - } - } - -- /* 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; -+ /* -+ * 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; -+ } -+ 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; -+ } -+ 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 @@ static int - + (go->deflate && go->deflate_draft? CILEN_DEFLATE: 0) - + (go->predictor_1? CILEN_PREDICTOR_1: 0) - + (go->predictor_2? CILEN_PREDICTOR_2: 0) -- + (go->mppe? CILEN_MPPE: 0); -+ + (go->lzs? CILEN_LZS: 0) -+ + ((go->mppe || go->mppc)? CILEN_MPPE: 0); - } - - /* -@@ -690,6 +826,8 @@ static void - { - int res; - ccp_options *go = &ccp_gotoptions[f->unit]; -+ ccp_options *ao = &ccp_allowoptions[f->unit]; -+ ccp_options *wo = &ccp_wantoptions[f->unit]; - u_char *p0 = p; - - /* -@@ -698,22 +836,43 @@ static void - * in case it gets Acked. - */ - #ifdef MPPE -- if (go->mppe) { -+ if (go->mppe || go->mppc || (!wo->mppe && ao->mppe)) { - u_char opt_buf[CILEN_MPPE + MPPE_MAX_KEY_LEN]; - -- p[0] = opt_buf[0] = CI_MPPE; -- p[1] = opt_buf[1] = CILEN_MPPE; -- MPPE_OPTS_TO_CI(go->mppe, &p[2]); -- MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]); -+ p[0] = CI_MPPE; -+ p[1] = CILEN_MPPE; -+ p[2] = (go->mppe_stateless ? MPPE_STATELESS : 0); -+ p[3] = 0; -+ p[4] = 0; -+ p[5] = (go->mppe_40 ? MPPE_40BIT : 0) | (go->mppe_56 ? MPPE_56BIT : 0) | -+ (go->mppe_128 ? MPPE_128BIT : 0) | (go->mppc ? MPPE_MPPC : 0); -+ -+ BCOPY(p, opt_buf, CILEN_MPPE); - BCOPY(mppe_recv_key, &opt_buf[CILEN_MPPE], MPPE_MAX_KEY_LEN); - res = ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0); -- if (res > 0) -+ if (res > 0) { - p += CILEN_MPPE; -- else -+ } else { - /* This shouldn't happen, we've already tested it! */ -- lcp_close(f->unit, "MPPE required but not available in kernel"); -+ go->mppe = go->mppe_40 = go->mppe_56 = go->mppe_128 = -+ go->mppe_stateless = go->mppc = 0; -+ if (ccp_wantoptions[f->unit].mppe) -+ lcp_close(f->unit, "MPPE required but not available in kernel"); -+ } -+ } -+#endif /* MPPE */ -+ if (go->lzs) { -+ p[0] = CI_LZS; -+ p[1] = CILEN_LZS; -+ p[2] = go->lzs_hists >> 8; -+ p[3] = go->lzs_hists & 0xff; -+ p[4] = LZS_MODE_SEQ; -+ res = ccp_test(f->unit, p, CILEN_LZS, 0); -+ if (res > 0) { -+ p += CILEN_LZS; -+ } else -+ go->lzs = 0; - } --#endif - if (go->deflate) { - p[0] = go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT; - p[1] = CILEN_DEFLATE; -@@ -799,30 +958,50 @@ static void - - /* - * ccp_ackci - process a received configure-ack, and return -- * 1 iff the packet was OK. -+ * 1 if the packet was OK. - */ - static int - ccp_ackci(fsm *f, u_char *p, int len) - { - ccp_options *go = &ccp_gotoptions[f->unit]; -+ ccp_options *ao = &ccp_allowoptions[f->unit]; -+ ccp_options *wo = &ccp_wantoptions[f->unit]; - u_char *p0 = p; - - #ifdef MPPE -- if (go->mppe) { -- u_char opt_buf[CILEN_MPPE]; -- -- opt_buf[0] = CI_MPPE; -- opt_buf[1] = CILEN_MPPE; -- MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]); -- if (len < CILEN_MPPE || memcmp(opt_buf, p, CILEN_MPPE)) -+ if (go->mppe || go->mppc || (!wo->mppe && ao->mppe)) { -+ if (len < CILEN_MPPE -+ || p[1] != CILEN_MPPE || p[0] != CI_MPPE -+ || p[2] != (go->mppe_stateless ? MPPE_STATELESS : 0) -+ || p[3] != 0 -+ || p[4] != 0 -+ || (p[5] != ((go->mppe_40 ? MPPE_40BIT : 0) | -+ (go->mppc ? MPPE_MPPC : 0)) -+ && p[5] != ((go->mppe_56 ? MPPE_56BIT : 0) | -+ (go->mppc ? MPPE_MPPC : 0)) -+ && p[5] != ((go->mppe_128 ? MPPE_128BIT : 0) | -+ (go->mppc ? MPPE_MPPC : 0)))) - return 0; -+ if (go->mppe_40 || go->mppe_56 || go->mppe_128) -+ go->mppe = 1; - p += CILEN_MPPE; - len -= CILEN_MPPE; -+ /* Cope with first/fast ack */ -+ if (p == p0 && len == 0) -+ return 1; -+ } -+#endif /* MPPE */ -+ if (go->lzs) { -+ if (len < CILEN_LZS || p[0] != CI_LZS || p[1] != CILEN_LZS -+ || p[2] != go->lzs_hists>>8 || p[3] != (go->lzs_hists&0xff) -+ || p[4] != LZS_MODE_SEQ) -+ return 0; -+ p += CILEN_LZS; -+ len -= CILEN_LZS; - /* XXX Cope with first/fast ack */ -- if (len == 0) -+ if (p == p0 && len == 0) - return 1; - } --#endif - if (go->deflate) { - if (len < CILEN_DEFLATE - || p[0] != (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT) -@@ -891,6 +1070,8 @@ static int - ccp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) - { - ccp_options *go = &ccp_gotoptions[f->unit]; -+ ccp_options *ao = &ccp_allowoptions[f->unit]; -+ ccp_options *wo = &ccp_wantoptions[f->unit]; - ccp_options no; /* options we've seen already */ - ccp_options try; /* options to ask for next time */ - -@@ -898,28 +1079,100 @@ static int - try = *go; - - #ifdef MPPE -- if (go->mppe && len >= CILEN_MPPE -- && p[0] == CI_MPPE && p[1] == CILEN_MPPE) { -- no.mppe = 1; -- /* -- * Peer wants us to use a different strength or other setting. -- * Fail if we aren't willing to use his suggestion. -- */ -- MPPE_CI_TO_OPTS(&p[2], try.mppe); -- if ((try.mppe & MPPE_OPT_STATEFUL) && refuse_mppe_stateful) { -- error("Refusing MPPE stateful mode offered by peer"); -- try.mppe = 0; -- } else if (((go->mppe | MPPE_OPT_STATEFUL) & try.mppe) != try.mppe) { -- /* Peer must have set options we didn't request (suggest) */ -- try.mppe = 0; -- } -+ if ((go->mppe || go->mppc || (!wo->mppe && ao->mppe)) && -+ len >= CILEN_MPPE && p[0] == CI_MPPE && p[1] == CILEN_MPPE) { - -- if (!try.mppe) { -- error("MPPE required but peer negotiation failed"); -- lcp_close(f->unit, "MPPE required but peer negotiation failed"); -+ if (go->mppc) { -+ no.mppc = 1; -+ if (!(p[5] & MPPE_MPPC)) -+ try.mppc = 0; -+ } -+ -+ if (go->mppe) -+ no.mppe = 1; -+ if (go->mppe_40) -+ no.mppe_40 = 1; -+ if (go->mppe_56) -+ no.mppe_56 = 1; -+ if (go->mppe_128) -+ no.mppe_128 = 1; -+ if (go->mppe_stateless) -+ no.mppe_stateless = 1; -+ -+ if (ao->mppe_40) { -+ if ((p[5] & MPPE_40BIT)) -+ try.mppe_40 = 1; -+ else -+ try.mppe_40 = (p[5] == 0) ? 1 : 0; -+ } -+ if (ao->mppe_56) { -+ if ((p[5] & MPPE_56BIT)) -+ try.mppe_56 = 1; -+ else -+ try.mppe_56 = (p[5] == 0) ? 1 : 0; -+ } -+ if (ao->mppe_128) { -+ if ((p[5] & MPPE_128BIT)) -+ try.mppe_128 = 1; -+ else -+ try.mppe_128 = (p[5] == 0) ? 1 : 0; -+ } -+ -+ if (ao->mppe_stateless) { -+ if ((p[2] & MPPE_STATELESS) || wo->mppe_stateless) -+ try.mppe_stateless = 1; -+ else -+ try.mppe_stateless = 0; -+ } -+ -+ if (!try.mppe_56 && !try.mppe_40 && !try.mppe_128) { -+ try.mppe = try.mppe_stateless = 0; -+ if (wo->mppe) { -+ /* we require encryption, but peer doesn't support it -+ so we close connection */ -+ wo->mppc = wo->mppe = wo->mppe_stateless = wo->mppe_40 = -+ wo->mppe_56 = wo->mppe_128 = 0; -+ lcp_close(f->unit, "MPPE required but cannot negotiate MPPE " -+ "key length"); -+ } -+ } -+ if (wo->mppe && (wo->mppe_40 != try.mppe_40) && -+ (wo->mppe_56 != try.mppe_56) && (wo->mppe_128 != try.mppe_128)) { -+ /* cannot negotiate key length */ -+ wo->mppc = wo->mppe = wo->mppe_stateless = wo->mppe_40 = -+ wo->mppe_56 = wo->mppe_128 = 0; -+ lcp_close(f->unit, "Cannot negotiate MPPE key length"); - } -+ if (try.mppe_40 && try.mppe_56 && try.mppe_128) -+ try.mppe_40 = try.mppe_56 = 0; -+ else -+ if (try.mppe_56 && try.mppe_128) -+ try.mppe_56 = 0; -+ else -+ if (try.mppe_40 && try.mppe_128) -+ try.mppe_40 = 0; -+ else -+ if (try.mppe_40 && try.mppe_56) -+ try.mppe_40 = 0; -+ -+ p += CILEN_MPPE; -+ len -= CILEN_MPPE; - } - #endif /* MPPE */ -+ -+ if (go->lzs && len >= CILEN_LZS && p[0] == CI_LZS && p[1] == CILEN_LZS) { -+ no.lzs = 1; -+ if (((p[2]<<8)|p[3]) > 1 || (p[4] != LZS_MODE_SEQ && -+ p[4] != LZS_MODE_EXT)) -+ try.lzs = 0; -+ else { -+ try.lzs_mode = p[4]; -+ try.lzs_hists = (p[2] << 8) | p[3]; -+ } -+ p += CILEN_LZS; -+ len -= CILEN_LZS; -+ } -+ - if (go->deflate && len >= CILEN_DEFLATE - && p[0] == (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT) - && p[1] == CILEN_DEFLATE) { -@@ -989,14 +1242,50 @@ ccp_rejci(fsm *f, u_char *p, int len) - return -1; - - #ifdef MPPE -- if (go->mppe && len >= CILEN_MPPE -+ if ((go->mppe || go->mppc) && len >= CILEN_MPPE - && p[0] == CI_MPPE && p[1] == CILEN_MPPE) { -- error("MPPE required but peer refused"); -- lcp_close(f->unit, "MPPE required but peer refused"); -+ ccp_options *wo = &ccp_wantoptions[f->unit]; -+ if (p[2] != (go->mppe_stateless ? MPPE_STATELESS : 0) || -+ p[3] != 0 || -+ p[4] != 0 || -+ p[5] != ((go->mppe_40 ? MPPE_40BIT : 0) | -+ (go->mppe_56 ? MPPE_56BIT : 0) | -+ (go->mppe_128 ? MPPE_128BIT : 0) | -+ (go->mppc ? MPPE_MPPC : 0))) -+ return 0; -+ if (go->mppc) -+ try.mppc = 0; -+ if (go->mppe) { -+ try.mppe = 0; -+ if (go->mppe_40) -+ try.mppe_40 = 0; -+ if (go->mppe_56) -+ try.mppe_56 = 0; -+ if (go->mppe_128) -+ try.mppe_128 = 0; -+ if (go->mppe_stateless) -+ try.mppe_stateless = 0; -+ if (!try.mppe_56 && !try.mppe_40 && !try.mppe_128) -+ try.mppe = try.mppe_stateless = 0; -+ if (wo->mppe) { /* we want MPPE but cannot negotiate key length */ -+ wo->mppc = wo->mppe = wo->mppe_stateless = wo->mppe_40 = -+ wo->mppe_56 = wo->mppe_128 = 0; -+ lcp_close(f->unit, "MPPE required but cannot negotiate MPPE " -+ "key length"); -+ } -+ } - p += CILEN_MPPE; - len -= CILEN_MPPE; - } --#endif -+#endif /* MPPE */ -+ if (go->lzs && len >= CILEN_LZS && p[0] == CI_LZS && p[1] == CILEN_LZS) { -+ if (p[2] != go->lzs_hists>>8 || p[3] != (go->lzs_hists&0xff) -+ || p[4] != go->lzs_mode) -+ return 0; -+ try.lzs = 0; -+ p += CILEN_LZS; -+ len -= CILEN_LZS; -+ } - if (go->deflate_correct && len >= CILEN_DEFLATE - && p[0] == CI_DEFLATE && p[1] == CILEN_DEFLATE) { - if (p[2] != DEFLATE_MAKE_OPT(go->deflate_size) -@@ -1056,14 +1345,15 @@ static int - ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak) - { - int ret, newret, res; -- u_char *p0, *retp; -+ u_char *p0, *retp, p2, p5; - int len, clen, type, nb; - ccp_options *ho = &ccp_hisoptions[f->unit]; - ccp_options *ao = &ccp_allowoptions[f->unit]; -+ ccp_options *wo = &ccp_wantoptions[f->unit]; - #ifdef MPPE -- bool rej_for_ci_mppe = 1; /* Are we rejecting based on a bad/missing */ -- /* CI_MPPE, or due to other options? */ --#endif -+ u_char opt_buf[CILEN_MPPE + MPPE_MAX_KEY_LEN]; -+/* int mtu; */ -+#endif /* MPPE */ - - ret = CONFACK; - retp = p0 = p; -@@ -1086,106 +1376,302 @@ ccp_reqci(fsm *f, u_char *p, int *lenp, - switch (type) { - #ifdef MPPE - case CI_MPPE: -- if (!ao->mppe || clen != CILEN_MPPE) { -+ if ((!ao->mppc && !ao->mppe) || clen != CILEN_MPPE) { - newret = CONFREJ; - break; - } -- MPPE_CI_TO_OPTS(&p[2], ho->mppe); -- -- /* Nak if anything unsupported or unknown are set. */ -- if (ho->mppe & MPPE_OPT_UNSUPPORTED) { -+ p2 = p[2]; -+ p5 = p[5]; -+ /* not sure what they want, tell 'em what we got */ -+ if (((p[2] & ~MPPE_STATELESS) != 0 || p[3] != 0 || p[4] != 0 || -+ (p[5] & ~(MPPE_40BIT | MPPE_56BIT | MPPE_128BIT | -+ MPPE_MPPC)) != 0 || p[5] == 0) || -+ (p[2] == 0 && p[3] == 0 && p[4] == 0 && p[5] == 0)) { - newret = CONFNAK; -- ho->mppe &= ~MPPE_OPT_UNSUPPORTED; -- } -- if (ho->mppe & MPPE_OPT_UNKNOWN) { -- newret = CONFNAK; -- ho->mppe &= ~MPPE_OPT_UNKNOWN; -- } -- -- /* Check state opt */ -- if (ho->mppe & MPPE_OPT_STATEFUL) { -- /* -- * We can Nak and request stateless, but it's a -- * lot easier to just assume the peer will request -- * it if he can do it; stateful mode is bad over -- * the Internet -- which is where we expect MPPE. -- */ -- if (refuse_mppe_stateful) { -- error("Refusing MPPE stateful mode offered by peer"); -- newret = CONFREJ; -- break; -+ p[2] = (wo->mppe_stateless ? MPPE_STATELESS : 0); -+ p[3] = 0; -+ p[4] = 0; -+ p[5] = (wo->mppe_40 ? MPPE_40BIT : 0) | -+ (wo->mppe_56 ? MPPE_56BIT : 0) | -+ (wo->mppe_128 ? MPPE_128BIT : 0) | -+ (wo->mppc ? MPPE_MPPC : 0); -+ break; -+ } -+ -+ if ((p[5] & MPPE_MPPC)) { -+ if (ao->mppc) { -+ ho->mppc = 1; -+ BCOPY(p, opt_buf, CILEN_MPPE); -+ opt_buf[2] = opt_buf[3] = opt_buf[4] = 0; -+ opt_buf[5] = MPPE_MPPC; -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE, 1) <= 0) { -+ ho->mppc = 0; -+ p[5] &= ~MPPE_MPPC; -+ newret = CONFNAK; -+ } -+ } else { -+ newret = CONFREJ; -+ if (wo->mppe || ao->mppe) { -+ p[5] &= ~MPPE_MPPC; -+ newret = CONFNAK; -+ } - } - } -- -- /* Find out which of {S,L} are set. */ -- if ((ho->mppe & MPPE_OPT_128) -- && (ho->mppe & MPPE_OPT_40)) { -- /* Both are set, negotiate the strongest. */ -- newret = CONFNAK; -- if (ao->mppe & MPPE_OPT_128) -- ho->mppe &= ~MPPE_OPT_40; -- else if (ao->mppe & MPPE_OPT_40) -- ho->mppe &= ~MPPE_OPT_128; -- else { -- newret = CONFREJ; -- break; -- } -- } else if (ho->mppe & MPPE_OPT_128) { -- if (!(ao->mppe & MPPE_OPT_128)) { -- newret = CONFREJ; -- break; -- } -- } else if (ho->mppe & MPPE_OPT_40) { -- if (!(ao->mppe & MPPE_OPT_40)) { -- newret = CONFREJ; -- break; -- } -+ if (ao->mppe) -+ ho->mppe = 1; -+ -+ if ((p[2] & MPPE_STATELESS)) { -+ if (ao->mppe_stateless) { -+ if (wo->mppe_stateless) -+ ho->mppe_stateless = 1; -+ else { -+ newret = CONFNAK; -+ if (!dont_nak) -+ p[2] &= ~MPPE_STATELESS; -+ } -+ } else { -+ newret = CONFNAK; -+ if (!dont_nak) -+ p[2] &= ~MPPE_STATELESS; -+ } -+ } else { -+ if (wo->mppe_stateless && !dont_nak) { -+ wo->mppe_stateless = 0; -+ newret = CONFNAK; -+ p[2] |= MPPE_STATELESS; -+ } -+ } -+ -+ if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_56BIT|MPPE_128BIT)) { -+ newret = CONFNAK; -+ if (ao->mppe_128) { -+ ho->mppe_128 = 1; -+ p[5] &= ~(MPPE_40BIT|MPPE_56BIT); -+ BCOPY(p, opt_buf, CILEN_MPPE); -+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], -+ MPPE_MAX_KEY_LEN); -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + -+ MPPE_MAX_KEY_LEN, 1) <= 0) { -+ ho->mppe_128 = 0; -+ p[5] |= (MPPE_40BIT|MPPE_56BIT); -+ p[5] &= ~MPPE_128BIT; -+ goto check_mppe_56_40; -+ } -+ goto check_mppe; -+ } -+ p[5] &= ~MPPE_128BIT; -+ goto check_mppe_56_40; -+ } -+ if ((p[5] & ~MPPE_MPPC) == (MPPE_56BIT|MPPE_128BIT)) { -+ newret = CONFNAK; -+ if (ao->mppe_128) { -+ ho->mppe_128 = 1; -+ p[5] &= ~MPPE_56BIT; -+ BCOPY(p, opt_buf, CILEN_MPPE); -+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], -+ MPPE_MAX_KEY_LEN); -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + -+ MPPE_MAX_KEY_LEN, 1) <= 0) { -+ ho->mppe_128 = 0; -+ p[5] |= MPPE_56BIT; -+ p[5] &= ~MPPE_128BIT; -+ goto check_mppe_56; -+ } -+ goto check_mppe; -+ } -+ p[5] &= ~MPPE_128BIT; -+ goto check_mppe_56; -+ } -+ if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_128BIT)) { -+ newret = CONFNAK; -+ if (ao->mppe_128) { -+ ho->mppe_128 = 1; -+ p[5] &= ~MPPE_40BIT; -+ BCOPY(p, opt_buf, CILEN_MPPE); -+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], -+ MPPE_MAX_KEY_LEN); -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + -+ MPPE_MAX_KEY_LEN, 1) <= 0) { -+ ho->mppe_128 = 0; -+ p[5] |= MPPE_40BIT; -+ p[5] &= ~MPPE_128BIT; -+ goto check_mppe_40; -+ } -+ goto check_mppe; -+ } -+ p[5] &= ~MPPE_128BIT; -+ goto check_mppe_40; -+ } -+ if ((p[5] & ~MPPE_MPPC) == MPPE_128BIT) { -+ if (ao->mppe_128) { -+ ho->mppe_128 = 1; -+ BCOPY(p, opt_buf, CILEN_MPPE); -+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], -+ MPPE_MAX_KEY_LEN); -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + -+ MPPE_MAX_KEY_LEN, 1) <= 0) { -+ ho->mppe_128 = 0; -+ p[5] &= ~MPPE_128BIT; -+ newret = CONFNAK; -+ } -+ goto check_mppe; -+ } -+ p[5] &= ~MPPE_128BIT; -+ newret = CONFNAK; -+ goto check_mppe; -+ } -+ check_mppe_56_40: -+ if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_56BIT)) { -+ newret = CONFNAK; -+ if (ao->mppe_56) { -+ ho->mppe_56 = 1; -+ p[5] &= ~MPPE_40BIT; -+ BCOPY(p, opt_buf, CILEN_MPPE); -+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], -+ MPPE_MAX_KEY_LEN); -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + -+ MPPE_MAX_KEY_LEN, 1) <= 0) { -+ ho->mppe_56 = 0; -+ p[5] |= MPPE_40BIT; -+ p[5] &= ~MPPE_56BIT; -+ newret = CONFNAK; -+ goto check_mppe_40; -+ } -+ goto check_mppe; -+ } -+ p[5] &= ~MPPE_56BIT; -+ goto check_mppe_40; -+ } -+ check_mppe_56: -+ if ((p[5] & ~MPPE_MPPC) == MPPE_56BIT) { -+ if (ao->mppe_56) { -+ ho->mppe_56 = 1; -+ BCOPY(p, opt_buf, CILEN_MPPE); -+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], -+ MPPE_MAX_KEY_LEN); -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + -+ MPPE_MAX_KEY_LEN, 1) <= 0) { -+ ho->mppe_56 = 0; -+ p[5] &= ~MPPE_56BIT; -+ newret = CONFNAK; -+ } -+ goto check_mppe; -+ } -+ p[5] &= ~MPPE_56BIT; -+ newret = CONFNAK; -+ goto check_mppe; -+ } -+ check_mppe_40: -+ if ((p[5] & ~MPPE_MPPC) == MPPE_40BIT) { -+ if (ao->mppe_40) { -+ ho->mppe_40 = 1; -+ BCOPY(p, opt_buf, CILEN_MPPE); -+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], -+ MPPE_MAX_KEY_LEN); -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + -+ MPPE_MAX_KEY_LEN, 1) <= 0) { -+ ho->mppe_40 = 0; -+ p[5] &= ~MPPE_40BIT; -+ newret = CONFNAK; -+ } -+ goto check_mppe; -+ } -+ p[5] &= ~MPPE_40BIT; -+ } -+ -+ check_mppe: -+ if (!ho->mppe_40 && !ho->mppe_56 && !ho->mppe_128) { -+ if (wo->mppe_40 || wo->mppe_56 || wo->mppe_128) { -+ newret = CONFNAK; -+ p[2] |= (wo->mppe_stateless ? MPPE_STATELESS : 0); -+ p[5] |= (wo->mppe_40 ? MPPE_40BIT : 0) | -+ (wo->mppe_56 ? MPPE_56BIT : 0) | -+ (wo->mppe_128 ? MPPE_128BIT : 0) | -+ (wo->mppc ? MPPE_MPPC : 0); -+ } else { -+ ho->mppe = ho->mppe_stateless = 0; -+ } - } else { -- /* Neither are set. */ -- /* We cannot accept this. */ -- newret = CONFNAK; -- /* Give the peer our idea of what can be used, -- so it can choose and confirm */ -- ho->mppe = ao->mppe; -- } -- -- /* rebuild the opts */ -- MPPE_OPTS_TO_CI(ho->mppe, &p[2]); -- if (newret == CONFACK) { -- u_char opt_buf[CILEN_MPPE + MPPE_MAX_KEY_LEN]; -- int mtu; -- -- BCOPY(p, opt_buf, CILEN_MPPE); -- BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], -- MPPE_MAX_KEY_LEN); -- if (ccp_test(f->unit, opt_buf, -- CILEN_MPPE + MPPE_MAX_KEY_LEN, 1) <= 0) { -- /* This shouldn't happen, we've already tested it! */ -- error("MPPE required, but kernel has no support."); -- lcp_close(f->unit, "MPPE required but not available"); -- newret = CONFREJ; -- break; -- } -- /* -- * We need to decrease the interface MTU by MPPE_PAD -- * because MPPE frames **grow**. The kernel [must] -- * allocate MPPE_PAD extra bytes in xmit buffers. -- */ -- mtu = netif_get_mtu(f->unit); -- if (mtu) -- netif_set_mtu(f->unit, mtu - MPPE_PAD); -- else -- newret = CONFREJ; -- } -- -- /* -- * We have accepted MPPE or are willing to negotiate -- * MPPE parameters. A CONFREJ is due to subsequent -- * (non-MPPE) processing. -- */ -- rej_for_ci_mppe = 0; -- break; --#endif /* MPPE */ -+ /* MPPE is not compatible with other compression types */ -+ if (wo->mppe) { -+ ao->bsd_compress = 0; -+ ao->predictor_1 = 0; -+ ao->predictor_2 = 0; -+ ao->deflate = 0; -+ ao->lzs = 0; -+ } -+ } -+ if ((!ho->mppc || !ao->mppc) && !ho->mppe) { -+ p[2] = p2; -+ p[5] = p5; -+ newret = CONFREJ; -+ break; -+ } -+ -+ /* -+ * I have commented the code below because according to RFC1547 -+ * MTU is only information for higher level protocols about -+ * "the maximum allowable length for a packet (q.v.) transmitted -+ * over a point-to-point link without incurring network layer -+ * fragmentation." Of course a PPP implementation should be able -+ * to handle overhead added by MPPE - in our case apropriate code -+ * is located in drivers/net/ppp_generic.c in the kernel sources. -+ * -+ * According to RFC1661: -+ * - when negotiated MRU is less than 1500 octets, a PPP -+ * implementation must still be able to receive at least 1500 -+ * octets, -+ * - when PFC is negotiated, a PPP implementation is still -+ * required to receive frames with uncompressed protocol field. -+ * -+ * So why not to handle MPPE overhead without changing MTU value? -+ * I am sure that RFC3078, unfortunately silently, assumes that. -+ */ -+ -+ /* -+ * We need to decrease the interface MTU by MPPE_PAD -+ * because MPPE frames **grow**. The kernel [must] -+ * allocate MPPE_PAD extra bytes in xmit buffers. -+ */ -+ /* -+ mtu = netif_get_mtu(f->unit); -+ if (mtu) { -+ netif_set_mtu(f->unit, mtu - MPPE_PAD); -+ } else { -+ newret = CONFREJ; -+ if (ccp_wantoptions[f->unit].mppe) { -+ error("Cannot adjust MTU needed by MPPE."); -+ lcp_close(f->unit, "Cannot adjust MTU needed by MPPE."); -+ } -+ } -+ */ -+ break; -+ #endif /* MPPE */ -+ -+ case CI_LZS: -+ if (!ao->lzs || clen != CILEN_LZS) { -+ newret = CONFREJ; -+ break; -+ } -+ -+ ho->lzs = 1; -+ ho->lzs_hists = (p[2] << 8) | p[3]; -+ ho->lzs_mode = p[4]; -+ if ((ho->lzs_hists != ao->lzs_hists) || -+ (ho->lzs_mode != ao->lzs_mode)) { -+ newret = CONFNAK; -+ if (!dont_nak) { -+ p[2] = ao->lzs_hists >> 8; -+ p[3] = ao->lzs_hists & 0xff; -+ p[4] = ao->lzs_mode; -+ } else -+ break; -+ } -+ -+ if (p == p0 && ccp_test(f->unit, p, CILEN_LZS, 1) <= 0) { -+ newret = CONFREJ; -+ } -+ break; - case CI_DEFLATE: - case CI_DEFLATE_DRAFT: - if (!ao->deflate || clen != CILEN_DEFLATE -@@ -1327,12 +1813,6 @@ ccp_reqci(fsm *f, u_char *p, int *lenp, - else - *lenp = retp - p0; - } --#ifdef MPPE -- if (ret == CONFREJ && ao->mppe && rej_for_ci_mppe) { -- error("MPPE required but peer negotiation failed"); -- lcp_close(f->unit, "MPPE required but peer negotiation failed"); -- } --#endif - return ret; - } - -@@ -1353,24 +1833,35 @@ method_name(ccp_options *opt, ccp_option - char *p = result; - char *q = result + sizeof(result); /* 1 past result */ - -- slprintf(p, q - p, "MPPE "); -- p += 5; -- if (opt->mppe & MPPE_OPT_128) { -- slprintf(p, q - p, "128-bit "); -- p += 8; -- } -- if (opt->mppe & MPPE_OPT_40) { -- slprintf(p, q - p, "40-bit "); -- p += 7; -- } -- if (opt->mppe & MPPE_OPT_STATEFUL) -- slprintf(p, q - p, "stateful"); -- else -- slprintf(p, q - p, "stateless"); -- -+ if (opt->mppe) { -+ if (opt->mppc) { -+ slprintf(p, q - p, "MPPC/MPPE "); -+ p += 10; -+ } else { -+ slprintf(p, q - p, "MPPE "); -+ p += 5; -+ } -+ if (opt->mppe_128) { -+ slprintf(p, q - p, "128-bit "); -+ p += 8; -+ } else if (opt->mppe_56) { -+ slprintf(p, q - p, "56-bit "); -+ p += 7; -+ } else if (opt->mppe_40) { -+ slprintf(p, q - p, "40-bit "); -+ p += 7; -+ } -+ if (opt->mppe_stateless) -+ slprintf(p, q - p, "stateless"); -+ else -+ slprintf(p, q - p, "stateful"); -+ } else if (opt->mppc) -+ slprintf(p, q - p, "MPPC"); - break; - } --#endif -+#endif /* MPPE */ -+ case CI_LZS: -+ return "Stac LZS"; - case CI_DEFLATE: - case CI_DEFLATE_DRAFT: - if (opt2 != NULL && opt2->deflate_size != opt->deflate_size) -@@ -1425,12 +1916,12 @@ ccp_up(fsm *f) - } else if (ANY_COMPRESS(*ho)) - notice("%s transmit compression enabled", method_name(ho, NULL)); - #ifdef MPPE -- if (go->mppe) { -+ if (go->mppe || go->mppc) { - BZERO(mppe_recv_key, MPPE_MAX_KEY_LEN); - BZERO(mppe_send_key, MPPE_MAX_KEY_LEN); - continue_networks(f->unit); /* Bring up IP et al */ - } --#endif -+#endif /* MPPE */ - } - - /* -@@ -1452,7 +1943,7 @@ ccp_down(fsm *f) - lcp_close(f->unit, "MPPE disabled"); - } - } --#endif -+#endif /* MPPE */ - } - - /* -@@ -1509,24 +2000,28 @@ ccp_printpkt(u_char *p, int plen, - #ifdef MPPE - case CI_MPPE: - if (optlen >= CILEN_MPPE) { -- u_char mppe_opts; -- -- MPPE_CI_TO_OPTS(&p[2], mppe_opts); -- printer(arg, "mppe %s %s %s %s %s %s%s", -- (p[2] & MPPE_H_BIT)? "+H": "-H", -- (p[5] & MPPE_M_BIT)? "+M": "-M", -- (p[5] & MPPE_S_BIT)? "+S": "-S", -- (p[5] & MPPE_L_BIT)? "+L": "-L", -+ printer(arg, "mppe %s %s %s %s %s %s", -+ (p[2] & MPPE_STATELESS)? "+H": "-H", -+ (p[5] & MPPE_56BIT)? "+M": "-M", -+ (p[5] & MPPE_128BIT)? "+S": "-S", -+ (p[5] & MPPE_40BIT)? "+L": "-L", - (p[5] & MPPE_D_BIT)? "+D": "-D", -- (p[5] & MPPE_C_BIT)? "+C": "-C", -- (mppe_opts & MPPE_OPT_UNKNOWN)? " +U": ""); -- if (mppe_opts & MPPE_OPT_UNKNOWN) -+ (p[5] & MPPE_MPPC)? "+C": "-C"); -+ if ((p[5] & ~(MPPE_56BIT | MPPE_128BIT | MPPE_40BIT | -+ MPPE_D_BIT | MPPE_MPPC)) || -+ (p[2] & ~MPPE_STATELESS)) - printer(arg, " (%.2x %.2x %.2x %.2x)", - p[2], p[3], p[4], p[5]); - p += CILEN_MPPE; - } - break; --#endif -+#endif /* MPPE */ -+ case CI_LZS: -+ if (optlen >= CILEN_LZS) { -+ printer(arg, "lzs %.2x %.2x %.2x", p[2], p[3], p[4]); -+ p += CILEN_LZS; -+ } -+ break; - case CI_DEFLATE: - case CI_DEFLATE_DRAFT: - if (optlen >= CILEN_DEFLATE) { -@@ -1609,6 +2104,7 @@ ccp_datainput(int unit, u_char *pkt, int - error("Lost compression sync: disabling compression"); - ccp_close(unit, "Lost compression sync"); - #ifdef MPPE -+ /* My module dosn't need this. J.D., 2003-07-06 */ - /* - * If we were doing MPPE, we must also take the link down. - */ -@@ -1616,9 +2112,18 @@ ccp_datainput(int unit, u_char *pkt, int - error("Too many MPPE errors, closing LCP"); - lcp_close(unit, "Too many MPPE errors"); - } --#endif -+#endif /* MPPE */ - } else { - /* -+ * When LZS or MPPE/MPPC is negotiated we just send CCP_RESETREQ -+ * and don't wait for CCP_RESETACK -+ */ -+ if ((ccp_gotoptions[f->unit].method == CI_LZS) || -+ (ccp_gotoptions[f->unit].method == CI_MPPE)) { -+ fsm_sdata(f, CCP_RESETREQ, f->reqid = ++f->id, NULL, 0); -+ return; -+ } -+ /* - * Send a reset-request to reset the peer's compressor. - * We don't do that if we are still waiting for an - * acknowledgement to a previous reset-request. ---- a/pppd/ccp.h -+++ b/pppd/ccp.h -@@ -37,9 +37,17 @@ typedef struct ccp_options { - bool predictor_2; /* do Predictor-2? */ - bool deflate_correct; /* use correct code for deflate? */ - bool deflate_draft; /* use draft RFC code for deflate? */ -+ bool lzs; /* do Stac LZS? */ -+ bool mppc; /* do MPPC? */ - u_char mppe; /* MPPE bitfield */ -+ bool mppe_40; /* allow 40 bit encryption? */ -+ bool mppe_56; /* allow 56 bit encryption? */ -+ bool mppe_128; /* allow 128 bit encryption? */ -+ bool mppe_stateless; /* allow stateless encryption */ - u_short bsd_bits; /* # bits/code for BSD Compress */ - u_short deflate_size; /* lg(window size) for Deflate */ -+ u_short lzs_mode; /* LZS check mode */ -+ u_short lzs_hists; /* number of LZS histories */ - short method; /* code for chosen compression method */ - } ccp_options; - ---- a/pppd/chap_ms.c -+++ b/pppd/chap_ms.c -@@ -964,13 +964,17 @@ set_mppe_enc_types(int policy, int types - /* - * Disable undesirable encryption types. Note that we don't ENABLE - * any encryption types, to avoid overriding manual configuration. -+ * -+ * It seems that 56 bit keys are unsupported in MS-RADIUS (see RFC 2548) - */ - switch(types) { - case MPPE_ENC_TYPES_RC4_40: -- ccp_wantoptions[0].mppe &= ~MPPE_OPT_128; /* disable 128-bit */ -+ ccp_wantoptions[0].mppe_128 = 0; /* disable 128-bit */ -+ ccp_wantoptions[0].mppe_56 = 0; /* disable 56-bit */ - break; - case MPPE_ENC_TYPES_RC4_128: -- ccp_wantoptions[0].mppe &= ~MPPE_OPT_40; /* disable 40-bit */ -+ ccp_wantoptions[0].mppe_56 = 0; /* disable 56-bit */ -+ ccp_wantoptions[0].mppe_40 = 0; /* disable 40-bit */ - break; - default: - break; diff --git a/lede/package/network/services/ppp/patches/203-opt_flags.patch b/lede/package/network/services/ppp/patches/203-opt_flags.patch deleted file mode 100644 index 705959e7ba..0000000000 --- a/lede/package/network/services/ppp/patches/203-opt_flags.patch +++ /dev/null @@ -1,38 +0,0 @@ -build: Move optimization flags into a separate variable - -Isolate optimization related compiler flags from CFLAGS and move them into a -separate COPTS variable so that it is easier to override optimizations from -the environment. - -Signed-off-by: Jo-Philipp Wich - ---- a/pppd/plugins/radius/Makefile.linux -+++ b/pppd/plugins/radius/Makefile.linux -@@ -47,13 +47,13 @@ install: all - $(INSTALL) -c -m 444 pppd-radattr.8 $(MANDIR) - - radius.so: radius.o libradiusclient.a -- $(CC) $(LDFLAGS) -o radius.so -shared radius.o libradiusclient.a -+ $(CC) $(LDFLAGS) -fPIC -o radius.so -shared radius.o libradiusclient.a - - radattr.so: radattr.o -- $(CC) $(LDFLAGS) -o radattr.so -shared radattr.o -+ $(CC) $(LDFLAGS) -fPIC -o radattr.so -shared radattr.o - - radrealms.so: radrealms.o -- $(CC) $(LDFLAGS) -o radrealms.so -shared radrealms.o -+ $(CC) $(LDFLAGS) -fPIC -o radrealms.so -shared radrealms.o - - CLIENTOBJS = avpair.o buildreq.o config.o dict.o ip_util.o \ - clientid.o sendserver.o lock.o util.o md5.o ---- a/pppd/plugins/pppoe/Makefile.linux -+++ b/pppd/plugins/pppoe/Makefile.linux -@@ -38,7 +38,7 @@ debug.o: debug.c - $(CC) $(CFLAGS) -I../../.. -c -o debug.o debug.c - - pppoe.so: plugin.o discovery.o if.o common.o -- $(CC) $(LDFLAGS) -o pppoe.so -shared plugin.o discovery.o if.o common.o -+ $(CC) $(LDFLAGS) -fPIC -o pppoe.so -shared plugin.o discovery.o if.o common.o - - install: all - $(INSTALL) -d -m 755 $(LIBDIR) diff --git a/lede/package/network/services/ppp/patches/204-radius_config.patch b/lede/package/network/services/ppp/patches/204-radius_config.patch index 2f30b9d3dc..1f5fdffa95 100644 --- a/lede/package/network/services/ppp/patches/204-radius_config.patch +++ b/lede/package/network/services/ppp/patches/204-radius_config.patch @@ -1,6 +1,6 @@ --- a/pppd/plugins/radius/config.c +++ b/pppd/plugins/radius/config.c -@@ -371,31 +371,37 @@ static int test_config(char *filename) +@@ -379,31 +379,37 @@ static int test_config(char *filename) } #endif @@ -40,7 +40,7 @@ } --- a/pppd/plugins/radius/options.h +++ b/pppd/plugins/radius/options.h -@@ -31,24 +31,21 @@ typedef struct _option { +@@ -29,24 +29,21 @@ typedef struct _option { static SERVER acctserver = {0}; static SERVER authserver = {0}; diff --git a/lede/package/network/services/ppp/patches/205-no_exponential_timeout.patch b/lede/package/network/services/ppp/patches/205-no_exponential_timeout.patch deleted file mode 100644 index b08c2eff89..0000000000 --- a/lede/package/network/services/ppp/patches/205-no_exponential_timeout.patch +++ /dev/null @@ -1,29 +0,0 @@ -pppd: Don't use exponential timeout in discovery phase - -This patch removes the exponential timeout increase between PADO or PADS -discovery attempts. - -Signed-off-by: Jo-Philipp Wich - ---- a/pppd/plugins/pppoe/discovery.c -+++ b/pppd/plugins/pppoe/discovery.c -@@ -632,7 +632,9 @@ discovery(PPPoEConnection *conn) - conn->discoveryState = STATE_SENT_PADI; - waitForPADO(conn, timeout); - -+#if 0 - timeout *= 2; -+#endif - } while (conn->discoveryState == STATE_SENT_PADI); - - timeout = conn->discoveryTimeout; -@@ -647,7 +649,9 @@ discovery(PPPoEConnection *conn) - sendPADR(conn); - conn->discoveryState = STATE_SENT_PADR; - waitForPADS(conn, timeout); -+#if 0 - timeout *= 2; -+#endif - } while (conn->discoveryState == STATE_SENT_PADR); - - if (!conn->seenMaxPayload) { diff --git a/lede/package/network/services/ppp/patches/207-lcp_mtu_max.patch b/lede/package/network/services/ppp/patches/207-lcp_mtu_max.patch index 522576c627..3ca0534f36 100644 --- a/lede/package/network/services/ppp/patches/207-lcp_mtu_max.patch +++ b/lede/package/network/services/ppp/patches/207-lcp_mtu_max.patch @@ -8,18 +8,18 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/lcp.c +++ b/pppd/lcp.c -@@ -1862,12 +1862,12 @@ lcp_up(fsm *f) +@@ -1888,12 +1888,12 @@ lcp_up(fsm *f) * the interface MTU is set to the lowest of that, the * MTU we want to use, and our link MRU. */ - mtu = ho->neg_mru? ho->mru: PPP_MRU; + mtu = MIN(ho->neg_mru? ho->mru: PPP_MRU, ao->mru); mru = go->neg_mru? MAX(wo->mru, go->mru): PPP_MRU; - #ifdef HAVE_MULTILINK + #ifdef PPP_WITH_MULTILINK if (!(multilink && go->neg_mrru && ho->neg_mrru)) - #endif /* HAVE_MULTILINK */ -- netif_set_mtu(f->unit, MIN(MIN(mtu, mru), ao->mru)); -+ netif_set_mtu(f->unit, MIN(mtu, mru)); + #endif /* PPP_WITH_MULTILINK */ +- ppp_set_mtu(f->unit, MIN(MIN(mtu, mru), ao->mru)); ++ ppp_set_mtu(f->unit, MIN(mtu, mru)); ppp_send_config(f->unit, mtu, (ho->neg_asyncmap? ho->asyncmap: 0xffffffff), ho->neg_pcompression, ho->neg_accompression); diff --git a/lede/package/network/services/ppp/patches/208-fix_status_code.patch b/lede/package/network/services/ppp/patches/208-fix_status_code.patch index 54e6c45e14..2d1e02742e 100644 --- a/lede/package/network/services/ppp/patches/208-fix_status_code.patch +++ b/lede/package/network/services/ppp/patches/208-fix_status_code.patch @@ -12,13 +12,13 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/main.c +++ b/pppd/main.c -@@ -1034,7 +1034,8 @@ get_input(void) +@@ -1150,7 +1150,8 @@ get_input(void) } notice("Modem hangup"); hungup = 1; -- status = EXIT_HANGUP; -+ if (status == EXIT_OK) -+ status = EXIT_HANGUP; +- code = EXIT_HANGUP; ++ if (code == EXIT_OK) ++ code = EXIT_HANGUP; + need_holdoff = 0; lcp_lowerdown(0); /* serial link is no longer available */ link_terminated(0); - return; diff --git a/lede/package/network/services/ppp/patches/300-filter-pcap-includes-lib.patch b/lede/package/network/services/ppp/patches/300-filter-pcap-includes-lib.patch deleted file mode 100644 index 87e340b3f1..0000000000 --- a/lede/package/network/services/ppp/patches/300-filter-pcap-includes-lib.patch +++ /dev/null @@ -1,20 +0,0 @@ -build: Add required CFLAGS for libpcap - -This patch adds some flags to required to properly link libpcap within the -OpenWrt environment. - -Signed-off-by: Jo-Philipp Wich - ---- a/pppd/Makefile.linux -+++ b/pppd/Makefile.linux -@@ -210,8 +210,8 @@ LIBS += -ldl - endif - - ifdef FILTER --LIBS += -lpcap --CFLAGS += -DPPP_FILTER -+LIBS += -lpcap -L$(STAGING_DIR)/usr/lib -+CFLAGS += -DPPP_FILTER -I$(STAGING_DIR)/usr/include - endif - - ifdef HAVE_INET6 diff --git a/lede/package/network/services/ppp/patches/310-precompile_filter.patch b/lede/package/network/services/ppp/patches/310-precompile_filter.patch index ca91d153e9..6a6d276979 100644 --- a/lede/package/network/services/ppp/patches/310-precompile_filter.patch +++ b/lede/package/network/services/ppp/patches/310-precompile_filter.patch @@ -11,62 +11,70 @@ packets which are treated as active. Signed-off-by: Jo-Philipp Wich ---- a/pppd/Makefile.linux -+++ b/pppd/Makefile.linux -@@ -51,6 +51,9 @@ MPPE=y - # and that the kernel driver support PPP packet filtering. - #FILTER=y +--- a/configure.ac ++++ b/configure.ac +@@ -306,6 +306,9 @@ AM_CONDITIONAL(PPP_WITH_PAM, test "x${wi + # With libpcap support, activate pppd on network activity + AX_CHECK_PCAP -+# Support for precompiled filters -+PRECOMPILED_FILTER=y ++# internal statically linked pcap ++AM_CONDITIONAL(PPP_WITH_PRECOMPILED_FILTER, test "x${with_static_pcap}" = "xyes") + - # Uncomment the next line to enable multilink PPP (enabled by default) - # Linux distributions: Please leave multilink ENABLED in your builds - # of pppd! -@@ -214,6 +217,14 @@ LIBS += -lpcap -L$(STAGING_DIR)/usr/l - CFLAGS += -DPPP_FILTER -I$(STAGING_DIR)/usr/include + # + # SunOS provides a version of libpcap that would work, but SunOS has no support for activity filter + AM_CONDITIONAL([PPP_WITH_FILTER], [ test "x${with_pcap}" = "xyes" && test "x${build_sunos}" != "xyes" ]) +@@ -348,6 +351,7 @@ $PACKAGE_NAME version $PACKAGE_VERSION + With libatm..........: ${with_atm:-no} + With libpam..........: ${with_pam:-no} + With libpcap.........: ${with_pcap:-no} ++ With static libpcap..: ${with_static_pcap:-no} + With libsrp..........: ${with_srp:-no} + C Compiler...........: $CC $CFLAGS + Linker...............: $LD $LDFLAGS $LIBS +--- a/pppd/Makefile.am ++++ b/pppd/Makefile.am +@@ -137,6 +137,12 @@ pppd_LDFLAGS += $(PCAP_LDFLAGS) + pppd_LIBS += $(PCAP_LIBS) endif -+ifdef PRECOMPILED_FILTER -+PPPDSRCS += pcap_pcc.c -+HEADERS += pcap_pcc.h -+PPPDOBJS += pcap_pcc.o -+LIBS += $(STAGING_DIR)/usr/lib/libpcap.a -+CFLAGS += -DPPP_FILTER -DPPP_PRECOMPILED_FILTER -I$(STAGING_DIR)/usr/include ++if PPP_WITH_PRECOMPILED_FILTER ++pppd_SOURCES += pcap_pcc.c ++pppd_include_HEADERS += pcap_pcc.h ++pppd_LIBS += $(STAGING_DIR)/usr/lib/libpcap.a +endif + - ifdef HAVE_INET6 - PPPDSRCS += ipv6cp.c eui64.c - HEADERS += ipv6cp.h eui64.h + if PPP_WITH_PLUGINS + pppd_CPPFLAGS += -DPPPD_PLUGIN_DIR='"@PPPD_PLUGIN_DIR@"' + pppd_LIBS += -ldl --- a/pppd/options.c +++ b/pppd/options.c -@@ -56,6 +56,7 @@ +@@ -62,6 +62,7 @@ - #ifdef PPP_FILTER + #ifdef PPP_WITH_FILTER #include +#include /* * There have been 3 or 4 different names for this in libpcap CVS, but * this seems to be what they have settled on... -@@ -168,6 +169,13 @@ static int setlogfile(char **); +@@ -182,6 +183,13 @@ static int setlogfile(char **); static int loadplugin(char **); #endif -+#ifdef PPP_PRECOMPILED_FILTER ++#ifdef PPP_WITH_PRECOMPILED_FILTER +#include "pcap_pcc.h" +static int setprecompiledpassfilter(char **); +static int setprecompiledactivefilter(char **); -+#undef PPP_FILTER ++#undef PPP_WITH_FILTER +#endif + - #ifdef PPP_FILTER + #ifdef PPP_WITH_FILTER static int setpassfilter(char **); static int setactivefilter(char **); -@@ -360,6 +368,14 @@ option_t general_options[] = { +@@ -391,6 +399,14 @@ struct option general_options[] = { "set filter for active pkts", OPT_PRIO }, #endif -+#ifdef PPP_PRECOMPILED_FILTER ++#ifdef PPP_WITH_PRECOMPILED_FILTER + { "precompiled-pass-filter", 1, setprecompiledpassfilter, + "set precompiled filter for packets to pass", OPT_PRIO }, + @@ -74,14 +82,14 @@ Signed-off-by: Jo-Philipp Wich + "set precompiled filter for active pkts", OPT_PRIO }, +#endif + - #ifdef MAXOCTETS { "maxoctets", o_int, &maxoctets, "Set connection traffic limit", -@@ -1468,6 +1484,27 @@ callfile(char **argv) + OPT_PRIO | OPT_LLIMIT | OPT_NOINCR | OPT_ZEROINF }, +@@ -1666,6 +1682,27 @@ callfile(char **argv) return ok; } -+#ifdef PPP_PRECOMPILED_FILTER ++#ifdef PPP_WITH_PRECOMPILED_FILTER +/* + * setprecompiledpassfilter - Set the pass filter for packets using a + * precompiled expression @@ -102,18 +110,19 @@ Signed-off-by: Jo-Philipp Wich +} +#endif + - #ifdef PPP_FILTER + #ifdef PPP_WITH_FILTER /* * setpassfilter - Set the pass filter for packets --- /dev/null +++ b/pppd/pcap_pcc.c -@@ -0,0 +1,74 @@ +@@ -0,0 +1,75 @@ +#include +#include +#include +#include +#include +#include ++#include "options.h" +#include "pppd.h" + +int pcap_pre_compiled (char * fname, struct bpf_program *p) @@ -123,7 +132,7 @@ Signed-off-by: Jo-Philipp Wich + FILE *f = fopen (fname, "r"); + if (!f) + { -+ option_error("error opening precompiled active-filter '%s': %s", ++ ppp_option_error("error opening precompiled active-filter '%s': %s", + fname, strerror (errno)); + return 0; + } @@ -167,18 +176,18 @@ Signed-off-by: Jo-Philipp Wich + } + if (size != index) + { -+ option_error("error in precompiled active-filter," -+ " expected %d expressions, got %dn", -+ size, index); ++ ppp_option_error("error in precompiled active-filter," ++ " expected %d expressions, got %dn", ++ size, index); + ret = 0; + } + fclose(f); + return ret; + +err: -+ option_error("error in precompiled active-filter" -+ " expression line %s:%d (wrong size)\n", -+ fname, line); ++ ppp_option_error("error in precompiled active-filter" ++ " expression line %s:%d (wrong size)\n", ++ fname, line); + fclose (f); + return 0; +} diff --git a/lede/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch b/lede/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch index 0c4d7ea9d6..2070ab7d09 100644 --- a/lede/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch +++ b/lede/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch @@ -8,15 +8,15 @@ Signed-off-by: George Kashperko 2 files changed, 53 insertions(+), 14 deletions(-) --- a/pppd/multilink.c +++ b/pppd/multilink.c -@@ -35,6 +35,7 @@ +@@ -36,6 +36,7 @@ #include #include #include +#include - #include "pppd.h" + #include "pppd-private.h" #include "fsm.h" -@@ -56,7 +57,8 @@ static void iterate_bundle_links(void (* +@@ -58,7 +59,8 @@ static void iterate_bundle_links(void (* static int get_default_epdisc(struct epdisc *); static int parse_num(char *str, const char *key, int *valp); @@ -26,7 +26,7 @@ Signed-off-by: George Kashperko #define set_ip_epdisc(ep, addr) do { \ ep->length = 4; \ -@@ -197,35 +199,38 @@ mp_join_bundle(void) +@@ -211,35 +213,38 @@ mp_join_bundle(void) key.dptr = bundle_id; key.dsize = p - bundle_id; pid = tdb_fetch(pppdb, key); @@ -61,7 +61,7 @@ Signed-off-by: George Kashperko - if (bundle_attach(unit)) { + if (unit >= 0 && bundle_attach(unit)) { set_ifunit(0); - script_setenv("BUNDLE", bundle_id + 7, 0); + ppp_script_setenv("BUNDLE", bundle_id + 7, 0); make_bundle_links(1); unlock_db(); - info("Link attached to %s", ifname); @@ -73,7 +73,7 @@ Signed-off-by: George Kashperko } /* we have to make a new bundle */ -@@ -405,20 +410,39 @@ parse_num(char *str, const char *key, in +@@ -419,20 +424,39 @@ parse_num(char *str, const char *key, in return 0; } @@ -119,7 +119,7 @@ Signed-off-by: George Kashperko && memcmp(vd.dptr, key.dptr, vd.dsize) == 0; --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -706,6 +706,16 @@ void cfg_bundle(int mrru, int mtru, int +@@ -980,6 +980,16 @@ void cfg_bundle(int mrru, int mtru, int add_fd(ppp_dev_fd); } @@ -129,14 +129,14 @@ Signed-off-by: George Kashperko +#ifdef USE_TDB + char tmp[11]; + slprintf(tmp, sizeof(tmp), "%d", ifunit); -+ script_setenv("IFUNIT", tmp, 0); ++ ppp_script_setenv("IFUNIT", tmp, 0); +#endif +} + /* * make_new_bundle - create a new PPP unit (i.e. a bundle) * and connect our channel to it. This should only get called -@@ -724,6 +734,8 @@ void make_new_bundle(int mrru, int mtru, +@@ -998,6 +1008,8 @@ void make_new_bundle(int mrru, int mtru, /* set the mrru and flags */ cfg_bundle(mrru, mtru, rssn, tssn); diff --git a/lede/package/network/services/ppp/patches/330-retain_foreign_default_routes.patch b/lede/package/network/services/ppp/patches/330-retain_foreign_default_routes.patch deleted file mode 100644 index 6ccc4507b2..0000000000 --- a/lede/package/network/services/ppp/patches/330-retain_foreign_default_routes.patch +++ /dev/null @@ -1,22 +0,0 @@ -pppd: Retain foreign default routes on Linux - -On Linux, when pppd attempts to delete its default route it does not fill -the rt_dev field of the struct rtentry used to match the system default route. -As a consequence, pppd happily deletes any default route even if it belongs -to another interface. - -This patch makes pppd fill out the rt_dev field so that only own default -routes are ever matched. - -Signed-off-by: Jo-Philipp Wich - ---- a/pppd/sys-linux.c -+++ b/pppd/sys-linux.c -@@ -1770,6 +1770,7 @@ int cifdefaultroute (int unit, u_int32_t - SIN_ADDR(rt.rt_genmask) = 0L; - } - -+ rt.rt_dev = ifname; - rt.rt_flags = RTF_UP; - if (ioctl(sock_fd, SIOCDELRT, &rt) < 0 && errno != ESRCH) { - if (still_ppp()) { diff --git a/lede/package/network/services/ppp/patches/340-populate_default_gateway.patch b/lede/package/network/services/ppp/patches/340-populate_default_gateway.patch index 0f965c705d..7d20f0449d 100644 --- a/lede/package/network/services/ppp/patches/340-populate_default_gateway.patch +++ b/lede/package/network/services/ppp/patches/340-populate_default_gateway.patch @@ -13,7 +13,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -1720,6 +1720,9 @@ int sifdefaultroute (int unit, u_int32_t +@@ -2247,6 +2247,9 @@ int sifdefaultroute (int unit, u_int32_t memset (&rt, 0, sizeof (rt)); SET_SA_FAMILY (rt.rt_dst, AF_INET); @@ -23,7 +23,7 @@ Signed-off-by: Jo-Philipp Wich rt.rt_dev = ifname; rt.rt_metric = dfl_route_metric + 1; /* +1 for binary compatibility */ -@@ -1728,7 +1731,7 @@ int sifdefaultroute (int unit, u_int32_t +@@ -2255,7 +2258,7 @@ int sifdefaultroute (int unit, u_int32_t SIN_ADDR(rt.rt_genmask) = 0L; } diff --git a/lede/package/network/services/ppp/patches/400-simplify_kernel_checks.patch b/lede/package/network/services/ppp/patches/400-simplify_kernel_checks.patch index 3c72048362..014831a3a4 100644 --- a/lede/package/network/services/ppp/patches/400-simplify_kernel_checks.patch +++ b/lede/package/network/services/ppp/patches/400-simplify_kernel_checks.patch @@ -10,7 +10,14 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -206,7 +206,7 @@ static int driver_is_old = 0; +@@ -220,14 +220,10 @@ static fd_set in_fds; /* set of fds tha + static int max_in_fd; /* highest fd set in in_fds */ + + static int has_proxy_arp = 0; +-static int driver_version = 0; +-static int driver_modification = 0; +-static int driver_patch = 0; +-static int driver_is_old = 0; static int restore_term = 0; /* 1 => we've munged the terminal */ static struct termios inittermios; /* Initial TTY termios */ @@ -19,17 +26,18 @@ Signed-off-by: Jo-Philipp Wich static char loop_name[20]; static unsigned char inbuf[512]; /* buffer for chars read from loopback */ -@@ -225,8 +225,8 @@ static int looped; /* 1 if using loop +@@ -245,9 +241,8 @@ static int dynaddr_set; /* 1 if ip_dyna + static int looped; /* 1 if using loop */ static int link_mtu; /* mtu for the link (not bundle) */ - static struct utsname utsname; /* for the kernel version */ +-static struct utsname utsname; /* for the kernel version */ -static int kernel_version; #define KVERSION(j,n,p) ((j)*1000000 + (n)*1000 + (p)) -+static const int kernel_version = KVERSION(2,6,37); ++static const int kernel_version = KVERSION(4,9,0); #define MAX_IFS 100 -@@ -1455,11 +1455,12 @@ int ccp_fatal_error (int unit) +@@ -1966,11 +1961,12 @@ int ccp_fatal_error (int unit) * * path_to_procfs - find the path to the proc file system mount point */ @@ -44,7 +52,7 @@ Signed-off-by: Jo-Philipp Wich struct mntent *mntent; FILE *fp; -@@ -1481,6 +1482,7 @@ static char *path_to_procfs(const char * +@@ -1992,6 +1988,7 @@ static char *path_to_procfs(const char * fclose (fp); } } @@ -52,35 +60,24 @@ Signed-off-by: Jo-Philipp Wich strlcpy(proc_path + proc_path_len, tail, sizeof(proc_path) - proc_path_len); -@@ -2365,15 +2367,19 @@ int ppp_available(void) - int my_version, my_modification, my_patch; - int osmaj, osmin, ospatch; +@@ -2883,6 +2880,8 @@ ppp_registered(void) + int ppp_check_kernel_support(void) + { ++ return 1; /* OpenWrt support ppp device "/dev/ppp" by default */ +#if 0 - /* get the kernel version now, since we are called before sys_init */ - uname(&utsname); - osmaj = osmin = ospatch = 0; - sscanf(utsname.release, "%d.%d.%d", &osmaj, &osmin, &ospatch); - kernel_version = KVERSION(osmaj, osmin, ospatch); + int s, ok, fd; + struct ifreq ifr; + int size; +@@ -3010,6 +3009,7 @@ int ppp_check_kernel_support(void) + } + close(s); + return ok; +#endif + } - fd = open("/dev/ppp", O_RDWR); - if (fd >= 0) { -+#if 0 - new_style_driver = 1; -+#endif - - /* XXX should get from driver */ - driver_version = 2; -@@ -2433,6 +2439,7 @@ int ppp_available(void) - - if (ok && ((ifr.ifr_hwaddr.sa_family & ~0xFF) != ARPHRD_PPP)) - ok = 0; -+ return ok; - - /* - * This is the PPP device. Validate the version of the driver at this -@@ -3106,6 +3113,7 @@ get_pty(int *master_fdp, int *slave_fdp, + #ifndef HAVE_LOGWTMP +@@ -3571,6 +3571,7 @@ get_pty(int *master_fdp, int *slave_fdp, } #endif /* TIOCGPTN */ @@ -88,7 +85,7 @@ Signed-off-by: Jo-Philipp Wich if (sfd < 0) { /* the old way - scan through the pty name space */ for (i = 0; i < 64; ++i) { -@@ -3124,6 +3132,7 @@ get_pty(int *master_fdp, int *slave_fdp, +@@ -3595,6 +3596,7 @@ get_pty(int *master_fdp, int *slave_fdp, } } } @@ -96,28 +93,40 @@ Signed-off-by: Jo-Philipp Wich if (sfd < 0) return 0; ---- a/pppd/plugins/pppoatm/pppoatm.c -+++ b/pppd/plugins/pppoatm/pppoatm.c -@@ -171,14 +171,6 @@ static void disconnect_pppoatm(void) - - void plugin_init(void) +@@ -3710,6 +3712,7 @@ get_host_seed(void) + int + sys_check_options(void) { --#ifdef linux -- extern int new_style_driver; /* From sys-linux.c */ -- if (!ppp_available() && !new_style_driver) -- fatal("Kernel doesn't support ppp_generic - " -- "needed for PPPoATM"); --#else -- fatal("No PPPoATM support on this OS"); --#endif - add_options(pppoa_options); ++#if 0 + if (demand && driver_is_old) { + ppp_option_error("demand dialling is not supported by kernel driver " + "version %d.%d.%d", driver_version, driver_modification, +@@ -3720,6 +3723,7 @@ sys_check_options(void) + warn("Warning: multilink is not supported by the kernel driver"); + multilink = 0; + } ++#endif + return 1; } +--- a/pppd/plugins/pppoatm/pppoatm.c ++++ b/pppd/plugins/pppoatm/pppoatm.c +@@ -180,10 +180,6 @@ static void disconnect_pppoatm(void) + void plugin_init(void) + { + #ifdef linux +- extern int new_style_driver; /* From sys-linux.c */ +- if (!ppp_check_kernel_support() && !new_style_driver) +- fatal("Kernel doesn't support ppp_generic - " +- "needed for PPPoATM"); + #else + fatal("No PPPoATM support on this OS"); + #endif --- a/pppd/plugins/pppoe/plugin.c +++ b/pppd/plugins/pppoe/plugin.c -@@ -58,9 +58,6 @@ static char const RCSID[] = +@@ -54,9 +54,6 @@ - char pppd_version[] = VERSION; + char pppd_version[] = PPPD_VERSION; -/* From sys-linux.c in pppd -- MUST FIX THIS! */ -extern int new_style_driver; @@ -125,30 +134,27 @@ Signed-off-by: Jo-Philipp Wich char *pppd_pppoe_service = NULL; static char *acName = NULL; static char *existingSession = NULL; -@@ -407,10 +404,6 @@ PPPoEDevnameHook(char *cmd, char **argv, +@@ -418,10 +415,6 @@ PPPoEDevnameHook(char *cmd, char **argv, void plugin_init(void) { -- if (!ppp_available() && !new_style_driver) { +- if (!ppp_check_kernel_support() && !new_style_driver) { - fatal("Linux kernel does not support PPPoE -- are you running 2.4.x?"); - } - - add_options(Options); + ppp_add_options(Options); - info("PPPoE plugin from pppd %s", VERSION); + info("PPPoE plugin from pppd %s", PPPD_VERSION); --- a/pppd/plugins/pppol2tp/pppol2tp.c +++ b/pppd/plugins/pppol2tp/pppol2tp.c -@@ -490,12 +490,7 @@ static void pppol2tp_cleanup(void) - +@@ -501,10 +501,6 @@ static void pppol2tp_cleanup(void) void plugin_init(void) { --#if defined(__linux__) + #if defined(__linux__) - extern int new_style_driver; /* From sys-linux.c */ -- if (!ppp_available() && !new_style_driver) +- if (!ppp_check_kernel_support() && !new_style_driver) - fatal("Kernel doesn't support ppp_generic - " - "needed for PPPoL2TP"); --#else -+#if !defined(__linux__) + #else fatal("No PPPoL2TP support on this OS"); #endif - add_options(pppol2tp_options); diff --git a/lede/package/network/services/ppp/patches/401-no_record_file.patch b/lede/package/network/services/ppp/patches/401-no_record_file.patch index 7844260685..436bfb5f5e 100644 --- a/lede/package/network/services/ppp/patches/401-no_record_file.patch +++ b/lede/package/network/services/ppp/patches/401-no_record_file.patch @@ -5,19 +5,19 @@ information to the permanent storage, therfore remove this option. Signed-off-by: Jo-Philipp Wich ---- a/pppd/pppd.h -+++ b/pppd/pppd.h -@@ -317,7 +317,6 @@ extern int holdoff; /* Dead time before +--- a/pppd/pppd-private.h ++++ b/pppd/pppd-private.h +@@ -189,7 +189,6 @@ extern int holdoff; /* Dead time before extern bool holdoff_specified; /* true if user gave a holdoff value */ extern bool notty; /* Stdin/out is not a tty */ extern char *pty_socket; /* Socket to connect to pty */ -extern char *record_file; /* File to record chars sent/received */ - extern bool sync_serial; /* Device is synchronous serial device */ extern int maxfail; /* Max # of unsuccessful connection attempts */ - extern char linkname[MAXPATHLEN]; /* logical name for link */ + extern char linkname[]; /* logical name for link */ + extern bool tune_kernel; /* May alter kernel settings as necessary */ --- a/pppd/tty.c +++ b/pppd/tty.c -@@ -143,7 +143,7 @@ char *disconnect_script = NULL; /* Scrip +@@ -146,7 +146,7 @@ char *disconnect_script = NULL; /* Scrip char *welcomer = NULL; /* Script to run after phys link estab. */ char *ptycommand = NULL; /* Command to run on other side of pty */ bool notty = 0; /* Stdin/out is not a tty */ @@ -26,7 +26,7 @@ Signed-off-by: Jo-Philipp Wich int max_data_rate; /* max bytes/sec through charshunt */ bool sync_serial = 0; /* Device is synchronous serial device */ char *pty_socket = NULL; /* Socket to connect to pty */ -@@ -199,8 +199,10 @@ option_t tty_options[] = { +@@ -202,8 +202,10 @@ static struct option tty_options[] = { "Send and receive over socket, arg is host:port", OPT_PRIO | OPT_DEVNAM }, diff --git a/lede/package/network/services/ppp/patches/403-no_wtmp.patch b/lede/package/network/services/ppp/patches/403-no_wtmp.patch deleted file mode 100644 index 772620ed72..0000000000 --- a/lede/package/network/services/ppp/patches/403-no_wtmp.patch +++ /dev/null @@ -1,25 +0,0 @@ -pppd: Disable wtmp support - -Many uClibc based environments lack wtmp and utmp support, therfore remove -the code updating the wtmp information. - -Signed-off-by: Jo-Philipp Wich - ---- a/pppd/sys-linux.c -+++ b/pppd/sys-linux.c -@@ -2503,6 +2503,7 @@ int ppp_available(void) - - void logwtmp (const char *line, const char *name, const char *host) - { -+#if 0 - struct utmp ut, *utp; - pid_t mypid = getpid(); - #if __GLIBC__ < 2 -@@ -2568,6 +2569,7 @@ void logwtmp (const char *line, const ch - close (wtmp); - } - #endif -+#endif - } - #endif /* HAVE_LOGWTMP */ - diff --git a/lede/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch b/lede/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch index b9b6f0e593..5738118c5f 100644 --- a/lede/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch +++ b/lede/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch @@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/main.c +++ b/pppd/main.c -@@ -866,14 +866,17 @@ struct protocol_list { +@@ -982,14 +982,17 @@ struct protocol_list { const char *name; } protocol_list[] = { { 0x21, "IP" }, @@ -25,7 +25,7 @@ Signed-off-by: Jo-Philipp Wich { 0x33, "Stream Protocol ST-II" }, { 0x35, "Banyan Vines" }, { 0x39, "AppleTalk EDDP" }, -@@ -887,8 +890,11 @@ struct protocol_list { +@@ -1003,8 +1006,11 @@ struct protocol_list { { 0x49, "Serial Data Transport Protocol (PPP-SDTP)" }, { 0x4b, "SNA over 802.2" }, { 0x4d, "SNA" }, @@ -37,7 +37,7 @@ Signed-off-by: Jo-Philipp Wich { 0x53, "Encryption" }, { 0x55, "Individual Link Encryption" }, { 0x57, "IPv6" }, -@@ -899,12 +905,15 @@ struct protocol_list { +@@ -1015,12 +1021,15 @@ struct protocol_list { { 0x65, "RTP IPHC Compressed non-TCP" }, { 0x67, "RTP IPHC Compressed UDP 8" }, { 0x69, "RTP IPHC Compressed RTP 8" }, @@ -53,7 +53,7 @@ Signed-off-by: Jo-Philipp Wich { 0x0203, "IBM Source Routing BPDU" }, { 0x0205, "DEC LANBridge100 Spanning Tree" }, { 0x0207, "Cisco Discovery Protocol" }, -@@ -916,15 +925,19 @@ struct protocol_list { +@@ -1032,15 +1041,19 @@ struct protocol_list { { 0x0231, "Luxcom" }, { 0x0233, "Sigma Network Systems" }, { 0x0235, "Apple Client Server Protocol" }, @@ -73,7 +73,7 @@ Signed-off-by: Jo-Philipp Wich { 0x4001, "Cray Communications Control Protocol" }, { 0x4003, "CDPD Mobile Network Registration Protocol" }, { 0x4005, "Expand accelerator protocol" }, -@@ -935,8 +948,10 @@ struct protocol_list { +@@ -1051,8 +1064,10 @@ struct protocol_list { { 0x4023, "RefTek Protocol" }, { 0x4025, "Fibre Channel" }, { 0x4027, "EMIT Protocols" }, @@ -84,7 +84,7 @@ Signed-off-by: Jo-Philipp Wich { 0x8023, "OSI Network Layer Control Protocol" }, { 0x8025, "Xerox NS IDP Control Protocol" }, { 0x8027, "DECnet Phase IV Control Protocol" }, -@@ -945,7 +960,9 @@ struct protocol_list { +@@ -1061,7 +1076,9 @@ struct protocol_list { { 0x8031, "Bridging NCP" }, { 0x8033, "Stream Protocol Control Protocol" }, { 0x8035, "Banyan Vines Control Protocol" }, @@ -94,7 +94,7 @@ Signed-off-by: Jo-Philipp Wich { 0x803f, "NETBIOS Framing Control Protocol" }, { 0x8041, "Cisco Systems Control Protocol" }, { 0x8043, "Ascom Timeplex" }, -@@ -954,18 +971,24 @@ struct protocol_list { +@@ -1070,18 +1087,24 @@ struct protocol_list { { 0x8049, "Serial Data Control Protocol (PPP-SDCP)" }, { 0x804b, "SNA over 802.2 Control Protocol" }, { 0x804d, "SNA Control Protocol" }, @@ -119,7 +119,7 @@ Signed-off-by: Jo-Philipp Wich { 0x8207, "Cisco Discovery Protocol Control" }, { 0x8209, "Netcs Twin Routing" }, { 0x820b, "STP - Control Protocol" }, -@@ -974,24 +997,29 @@ struct protocol_list { +@@ -1090,24 +1113,29 @@ struct protocol_list { { 0x8281, "MPLSCP" }, { 0x8285, "IEEE p1284.4 standard - Protocol Control" }, { 0x8287, "ETSI TETRA TNP1 Control Protocol" }, diff --git a/lede/package/network/services/ppp/patches/405-no_multilink_option.patch b/lede/package/network/services/ppp/patches/405-no_multilink_option.patch index a34ec57b0a..654bebd569 100644 --- a/lede/package/network/services/ppp/patches/405-no_multilink_option.patch +++ b/lede/package/network/services/ppp/patches/405-no_multilink_option.patch @@ -9,7 +9,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/options.c +++ b/pppd/options.c -@@ -348,13 +348,14 @@ option_t general_options[] = { +@@ -379,13 +379,14 @@ struct option general_options[] = { "Enable multilink operation", OPT_PRIOSUB | OPT_ALIAS | 1 }, { "nomultilink", o_bool, &multilink, "Disable multilink operation", OPT_PRIOSUB | 0 }, @@ -18,11 +18,11 @@ Signed-off-by: Jo-Philipp Wich { "bundle", o_string, &bundle_name, "Bundle name for multilink", OPT_PRIO }, - #endif /* HAVE_MULTILINK */ + #endif /* PPP_WITH_MULTILINK */ + { "nomp", o_bool, &multilink, + "Disable multilink operation", OPT_PRIOSUB | OPT_ALIAS | 0 }, + - #ifdef PLUGIN + #ifdef PPP_WITH_PLUGINS { "plugin", o_special, (void *)loadplugin, "Load a plug-in module into pppd", OPT_PRIV | OPT_A2LIST }, diff --git a/lede/package/network/services/ppp/patches/500-add-pptp-plugin.patch b/lede/package/network/services/ppp/patches/500-add-pptp-plugin.patch index 96f4bcaf70..38b0c82506 100644 --- a/lede/package/network/services/ppp/patches/500-add-pptp-plugin.patch +++ b/lede/package/network/services/ppp/patches/500-add-pptp-plugin.patch @@ -1,59 +1,43 @@ ---- a/configure -+++ b/configure -@@ -133,7 +133,7 @@ if [ -d "$ksrc" ]; then - mkmkf $ksrc/Makedefs$compiletype Makedefs.com - for dir in pppd pppstats chat pppdump pppd/plugins pppd/plugins/pppoe \ - pppd/plugins/radius pppd/plugins/pppoatm \ -- pppd/plugins/pppol2tp; do -+ pppd/plugins/pppol2tp pppd/plugins/pptp ; do - mkmkf $dir/Makefile.$makext $dir/Makefile - done - if [ -f $ksrc/Makefile.$makext$archvariant ]; then ---- a/pppd/plugins/Makefile.linux -+++ b/pppd/plugins/Makefile.linux -@@ -14,7 +14,7 @@ INSTALL = install - # EAP-TLS - CFLAGS += -DUSE_EAPTLS=1 +--- a/configure.ac ++++ b/configure.ac +@@ -333,6 +333,7 @@ AC_CONFIG_FILES([ + pppd/plugins/pppoatm/Makefile + pppd/plugins/pppol2tp/Makefile + pppd/plugins/radius/Makefile ++ pppd/plugins/pptp/Makefile + pppdump/Makefile + pppstats/Makefile + scripts/Makefile +--- a/pppd/plugins/Makefile.am ++++ b/pppd/plugins/Makefile.am +@@ -17,5 +17,5 @@ winbind_la_LDFLAGS = $(PLUGIN_LDFLAGS) + winbind_la_SOURCES = winbind.c --SUBDIRS := pppoe pppoatm pppol2tp -+SUBDIRS := pppoe pppoatm pppol2tp pptp - # Uncomment the next line to include the radius authentication plugin - SUBDIRS += radius - PLUGINS := minconn.so passprompt.so passwordfd.so winbind.so + if !SUNOS +-SUBDIRS = pppoe pppoatm pppol2tp radius ++SUBDIRS = pppoe pppoatm pppol2tp radius pptp + endif --- /dev/null -+++ b/pppd/plugins/pptp/Makefile.linux -@@ -0,0 +1,31 @@ -+# -+# This program may be distributed according to the terms of the GNU -+# General Public License, version 2 or (at your option) any later version. -+# -+# $Id: Makefile.linux,v 1.9 2012/05/04 21:48:00 dgolle Exp $ -+#*********************************************************************** ++++ b/pppd/plugins/pptp/Makefile.am +@@ -0,0 +1,18 @@ ++pppd_plugin_LTLIBRARIES = pptp.la ++pppd_plugindir = $(PPPD_PLUGIN_DIR) + -+DESTDIR = $(INSTROOT)@DESTDIR@ -+LIBDIR = $(DESTDIR)/lib/pppd/$(PPPDVERSION) -+ -+PPPDVERSION = $(shell awk -F '"' '/VERSION/ { print $$2; }' ../../patchlevel.h) -+ -+INSTALL = install -+ -+COPTS=-O2 -g -+CFLAGS = $(COPTS) -I. -I../.. -I../../../include -fPIC -DPPPD_VERSION=\"$(PPPDVERSION)\" -+all: pptp.so -+ -+%.o: %.c -+ $(CC) $(CFLAGS) -c -o $@ $< -+ -+pptp.so: dirutil.o orckit_quirks.o pptp.o pptp_callmgr.o pptp_ctrl.o pptp_quirks.o util.o vector.o -+ $(CC) -o pptp.so -shared dirutil.o orckit_quirks.o pptp.o pptp_callmgr.o pptp_ctrl.o pptp_quirks.o util.o vector.o -+ -+install: all -+ $(INSTALL) -d -m 755 $(LIBDIR) -+ $(INSTALL) -c -m 4550 pptp.so $(LIBDIR) -+ -+clean: -+ rm -f *.o *.so ++noinst_HEADERS = \ ++ dirutil.h \ ++ orckit_quirks.h \ ++ pptp_callmgr.h \ ++ pptp_ctrl.h \ ++ pptp_msg.h \ ++ pptp_options.h \ ++ pptp_quirks.h \ ++ util.h \ ++ vector.h + ++pptp_la_CPPFLAGS = -I${top_srcdir} -DSYSCONFDIR=\"${sysconfdir}\" -DPLUGIN ++pptp_la_LDFLAGS = -fPIC -module -avoid-version ++pptp_la_SOURCES = dirutil.c orckit_quirks.c pptp.c pptp_callmgr.c pptp_ctrl.c \ ++ pptp_quirks.c util.c vector.c --- /dev/null +++ b/pppd/plugins/pptp/dirutil.c @@ -0,0 +1,68 @@ @@ -334,7 +318,7 @@ +xeb xeb@mail.ru --- /dev/null +++ b/pppd/plugins/pptp/pptp.c -@@ -0,0 +1,323 @@ +@@ -0,0 +1,325 @@ +/*************************************************************************** + * Copyright (C) 2006 by Kozlov D. * + * some cleanup done (C) 2012 by Daniel Golle * @@ -377,6 +361,8 @@ +#include + +#include "pppd.h" ++#include "pppd-private.h" ++#include "options.h" +#include "fsm.h" +#include "lcp.h" +#include "ipcp.h" @@ -385,7 +371,7 @@ + +#include "pptp_callmgr.h" +#include -+#include ++#include +#include + +#include @@ -437,8 +423,8 @@ + check_options: NULL, + connect: &pptp_connect, + disconnect: &pptp_disconnect, -+ establish_ppp: &generic_establish_ppp, -+ disestablish_ppp: &generic_disestablish_ppp, ++ establish_ppp: &ppp_generic_establish, ++ disestablish_ppp: &ppp_generic_disestablish, + close: NULL, + cleanup: NULL +}; @@ -446,7 +432,7 @@ +static int pptp_start_server(void) +{ + pptp_fd=pptp_sock; -+ sprintf(ppp_devnam,"pptp (%s)",pptp_client); ++ sprintf(ppp_devname,"pptp (%s)",pptp_client); + + return pptp_fd; +} @@ -527,7 +513,7 @@ + return -1; + } + -+ sprintf(ppp_devnam,"pptp (%s)",pptp_server); ++ sprintf(ppp_devname,"pptp (%s)",pptp_server); + + return pptp_fd; +} @@ -651,7 +637,7 @@ + +void plugin_init(void) +{ -+ add_options(Options); ++ ppp_add_options(Options); + + info("PPTP plugin version %s", PPTP_VERSION); + diff --git a/lede/package/network/services/ppp/patches/510-pptp_compile_fix.patch b/lede/package/network/services/ppp/patches/510-pptp_compile_fix.patch deleted file mode 100644 index 04bb620e76..0000000000 --- a/lede/package/network/services/ppp/patches/510-pptp_compile_fix.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/pppd/plugins/pptp/pptp.c -+++ b/pppd/plugins/pptp/pptp.c -@@ -48,7 +48,7 @@ - - #include "pptp_callmgr.h" - #include --#include -+#include - #include - - #include diff --git a/lede/package/network/services/ppp/patches/511-pptp_cflags.patch b/lede/package/network/services/ppp/patches/511-pptp_cflags.patch deleted file mode 100644 index 548bf41c1f..0000000000 --- a/lede/package/network/services/ppp/patches/511-pptp_cflags.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/pppd/plugins/pptp/Makefile.linux -+++ b/pppd/plugins/pptp/Makefile.linux -@@ -20,7 +20,7 @@ all: pptp.so - $(CC) $(CFLAGS) -c -o $@ $< - - pptp.so: dirutil.o orckit_quirks.o pptp.o pptp_callmgr.o pptp_ctrl.o pptp_quirks.o util.o vector.o -- $(CC) -o pptp.so -shared dirutil.o orckit_quirks.o pptp.o pptp_callmgr.o pptp_ctrl.o pptp_quirks.o util.o vector.o -+ $(CC) -fPIC -o pptp.so -shared dirutil.o orckit_quirks.o pptp.o pptp_callmgr.o pptp_ctrl.o pptp_quirks.o util.o vector.o - - install: all - $(INSTALL) -d -m 755 $(LIBDIR) diff --git a/lede/package/network/services/ppp/patches/512-syncppp.patch b/lede/package/network/services/ppp/patches/512-syncppp.patch index 39ff52000f..00de134a07 100644 --- a/lede/package/network/services/ppp/patches/512-syncppp.patch +++ b/lede/package/network/services/ppp/patches/512-syncppp.patch @@ -1,15 +1,16 @@ ---- a/pppd/chap-new.c -+++ b/pppd/chap-new.c -@@ -37,6 +37,8 @@ - #include "chap-new.h" +--- a/pppd/chap.c ++++ b/pppd/chap.c +@@ -42,6 +42,9 @@ + #include "chap.h" #include "chap-md5.h" ++#include +#include "syncppp.h" + - #ifdef CHAPMS + #ifdef PPP_WITH_CHAPMS #include "chap_ms.h" #define MDTYPE_ALL (MDTYPE_MICROSOFT_V2 | MDTYPE_MICROSOFT | MDTYPE_MD5) -@@ -523,6 +525,18 @@ chap_respond(struct chap_client_state *cs, int id, +@@ -520,6 +523,18 @@ chap_respond(struct chap_client_state *c p[2] = len >> 8; p[3] = len; @@ -28,40 +29,36 @@ output(0, response, PPP_HDRLEN + len); } ---- a/pppd/Makefile.linux -+++ b/pppd/Makefile.linux -@@ -17,16 +17,16 @@ TARGETS = pppd +--- a/pppd/Makefile.am ++++ b/pppd/Makefile.am +@@ -67,6 +67,7 @@ noinst_HEADERS = \ + peap.h \ + pppd-private.h \ + spinlock.h \ ++ syncppp.h \ + tls.h \ + tdb.h - PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap-new.c md5.c ccp.c \ - ecp.c ipxcp.c auth.c options.c sys-linux.c md4.c chap_ms.c \ -- demand.c utils.c tty.c eap.c chap-md5.c session.c -+ demand.c utils.c tty.c eap.c chap-md5.c session.c syncppp.c +@@ -85,6 +86,7 @@ pppd_SOURCES = \ + main.c \ + options.c \ + session.c \ ++ syncppp.c \ + tty.c \ + upap.c \ + utils.c +@@ -95,7 +97,7 @@ BUILT_SOURCE = \ - HEADERS = ccp.h session.h chap-new.h ecp.h fsm.h ipcp.h \ - ipxcp.h lcp.h magic.h md5.h patchlevel.h pathnames.h pppd.h \ -- upap.h eap.h -+ upap.h eap.h syncppp.h + pppd_CPPFLAGS = -DSYSCONFDIR=\"${sysconfdir}\" -DPPPD_RUNTIME_DIR='"@PPPD_RUNTIME_DIR@"' -DPPPD_LOGFILE_DIR='"@PPPD_LOGFILE_DIR@"' + pppd_LDFLAGS = +-pppd_LIBS = ++pppd_LIBS = -lpthread - MANPAGES = pppd.8 - PPPDOBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap-new.o md5.o ccp.o \ - ecp.o auth.o options.o demand.o utils.o sys-linux.o ipxcp.o tty.o \ -- eap.o chap-md5.o session.o -+ eap.o chap-md5.o session.o syncppp.o - - # - # include dependencies if present -@@ -34,7 +34,7 @@ ifeq (.depend,$(wildcard .depend)) - include .depend - endif - --LIBS = -lrt -+LIBS = -lpthread - - # Uncomment the next line to include support for Microsoft's - # MS-CHAP authentication protocol. Also, edit plugins/radius/Makefile.linux. + if PPP_WITH_SYSTEM_CA_PATH + pppd_CPPFLAGS += -DSYSTEM_CA_PATH='"@SYSTEM_CA_PATH@"' --- a/pppd/options.c +++ b/pppd/options.c -@@ -127,6 +127,7 @@ bool dump_options; /* print out option values */ +@@ -136,6 +136,7 @@ bool show_options; /* print all support bool dryrun; /* print out option values and exit */ char *domain; /* domain name set by domain option */ int child_wait = 5; /* # seconds to wait for children at exit */ @@ -69,7 +66,7 @@ struct userenv *userenv_list; /* user environment variables */ int dfl_route_metric = -1; /* metric of the default route to set over the PPP link */ -@@ -323,6 +324,9 @@ option_t general_options[] = { +@@ -339,6 +340,9 @@ struct option general_options[] = { "Unset user environment variable", OPT_A2PRINTER | OPT_NOPRINT, (void *)user_unsetprint }, @@ -79,16 +76,16 @@ { "defaultroute-metric", o_int, &dfl_route_metric, "Metric to use for the default route (Linux only; -1 for default behavior)", OPT_PRIV|OPT_LLIMIT|OPT_INITONLY, NULL, 0, -1 }, ---- a/pppd/pppd.h -+++ b/pppd/pppd.h -@@ -335,6 +335,7 @@ extern char *bundle_name; /* bundle name for multilink */ - extern bool dump_options; /* print out option values */ +--- a/pppd/pppd-private.h ++++ b/pppd/pppd-private.h +@@ -207,6 +207,7 @@ extern bool dump_options; /* print out o + extern bool show_options; /* show all option names and descriptions */ extern bool dryrun; /* check everything, print options, exit */ extern int child_wait; /* # seconds to wait for children at end */ +extern int npppd; /* synchronize between multiple pppd */ - - #ifdef USE_EAPTLS - extern char *crl_dir; + extern char *current_option; /* the name of the option being parsed */ + extern int privileged_option; /* set iff the current option came from root */ + extern char *option_source; /* string saying where the option came from */ --- /dev/null +++ b/pppd/syncppp.c @@ -0,0 +1,75 @@ @@ -98,14 +95,14 @@ +#include +#include +#include -+#include "pppd.h" ++#include "pppd-private.h" +#include "syncppp.h" + +int syncppp(int nproc) +{ + int flags; + int value; -+ sem_t *block; ++ sem_t *block; + sem_t *count; + struct timespec ts; + @@ -169,21 +166,23 @@ + --- /dev/null +++ b/pppd/syncppp.h -@@ -0,0 +1,3 @@ +@@ -0,0 +1,4 @@ +#define SEM_BLOCK_NAME "block" +#define SEM_COUNT_NAME "count" +#define SYNCPPP_TIMEOUT 5 ++extern int syncppp(int nproc); --- a/pppd/upap.c +++ b/pppd/upap.c -@@ -50,6 +50,7 @@ - #include "pppd.h" +@@ -55,6 +55,8 @@ + #include "options.h" #include "upap.h" ++#include +#include "syncppp.h" static bool hide_password = 1; -@@ -540,6 +541,18 @@ upap_sauthreq(upap_state *u) +@@ -545,6 +547,18 @@ upap_sauthreq(upap_state *u) PUTCHAR(u->us_passwdlen, outp); BCOPY(u->us_passwd, outp, u->us_passwdlen); diff --git a/lede/package/network/services/ppp/patches/600-Revert-pppd-Use-openssl-for-the-DES-instead-of-the-l.patch b/lede/package/network/services/ppp/patches/600-Revert-pppd-Use-openssl-for-the-DES-instead-of-the-l.patch deleted file mode 100644 index a3042af533..0000000000 --- a/lede/package/network/services/ppp/patches/600-Revert-pppd-Use-openssl-for-the-DES-instead-of-the-l.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 831dca008699d485f2c8e91749657ef2d0b06166 Mon Sep 17 00:00:00 2001 -From: Martin Schiller -Date: Thu, 6 Dec 2018 08:43:17 +0100 -Subject: [PATCH] Revert "pppd: Use openssl for the DES instead of the libcrypt - / glibc" - -For musl and glibc2.27 we can keep linking to crypt; however if we -switch to glibc 2.28 we will have to link to one of the SSL libraries. - -This reverts commit 3c7b86229f7bd2600d74db14b1fe5b3896be3875. ---- - pppd/Makefile.linux | 7 +++---- - pppd/pppcrypt.c | 18 +++++++++--------- - 2 files changed, 12 insertions(+), 13 deletions(-) - ---- a/pppd/Makefile.linux -+++ b/pppd/Makefile.linux -@@ -36,10 +36,10 @@ endif - - LIBS = -lpthread - --# Uncomment the next line to include support for Microsoft's -+# Uncomment the next 2 lines 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 -@@ -158,8 +158,7 @@ endif - - ifdef NEEDDES - ifndef USE_CRYPT --CFLAGS += -I$(shell $(CC) --print-sysroot)/usr/include/openssl --NEEDCRYPTOLIB = y -+LIBS += -ldes $(LIBS) - else - CFLAGS += -DUSE_CRYPT=1 - endif ---- a/pppd/pppcrypt.c -+++ b/pppd/pppcrypt.c -@@ -62,7 +62,7 @@ MakeKey(u_char *key, u_char *des_key) - 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 - } - -@@ -147,30 +147,30 @@ DesDecrypt(u_char *cipher, u_char *clear - } - - #else /* USE_CRYPT */ --static DES_key_schedule key_schedule; -+static des_key_schedule key_schedule; - - bool - DesSetkey(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(u_char *clear, u_char *cipher) - { -- 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); - } - - bool - DesDecrypt(u_char *cipher, u_char *clear) - { -- 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); - } - diff --git a/lede/package/network/services/ppp/patches/610-pppd_compile_fix.patch b/lede/package/network/services/ppp/patches/610-pppd_compile_fix.patch deleted file mode 100644 index 4f66e5d71f..0000000000 --- a/lede/package/network/services/ppp/patches/610-pppd_compile_fix.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/pppd/Makefile.linux -+++ b/pppd/Makefile.linux -@@ -49,7 +49,8 @@ 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 -+# libpcap statically linked in OpenWRT, hence disabled here. -+FILTER= - - # Support for precompiled filters - PRECOMPILED_FILTER=y diff --git a/lede/package/network/services/ppp/utils/pfc.c b/lede/package/network/services/ppp/utils/pfc.c index 5476be170a..6bb5368a3f 100644 --- a/lede/package/network/services/ppp/utils/pfc.c +++ b/lede/package/network/services/ppp/utils/pfc.c @@ -1,4 +1,4 @@ -/* +/* * Taken from fli4l 3.0 * Make sure you compile it against the same libpcap version used in OpenWrt */ diff --git a/mihomo/go.mod b/mihomo/go.mod index 2047d0eb11..3c1ab95762 100644 --- a/mihomo/go.mod +++ b/mihomo/go.mod @@ -32,7 +32,7 @@ require ( github.com/metacubex/sing-shadowsocks v0.2.12 github.com/metacubex/sing-shadowsocks2 v0.2.7 github.com/metacubex/sing-shadowtls v0.0.0-20250503063515-5d9f966d17a2 - github.com/metacubex/sing-tun v0.4.9 + github.com/metacubex/sing-tun v0.4.10-0.20251124160354-85cd06f11a84 github.com/metacubex/sing-vmess v0.2.4 github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f github.com/metacubex/smux v0.0.0-20251111013112-03f8d12dafc1 diff --git a/mihomo/go.sum b/mihomo/go.sum index bc29d7fef7..74a5c27619 100644 --- a/mihomo/go.sum +++ b/mihomo/go.sum @@ -129,8 +129,8 @@ github.com/metacubex/sing-shadowsocks2 v0.2.7 h1:hSuuc0YpsfiqYqt1o+fP4m34BQz4e6w github.com/metacubex/sing-shadowsocks2 v0.2.7/go.mod h1:vOEbfKC60txi0ca+yUlqEwOGc3Obl6cnSgx9Gf45KjE= github.com/metacubex/sing-shadowtls v0.0.0-20250503063515-5d9f966d17a2 h1:gXU+MYPm7Wme3/OAY2FFzVq9d9GxPHOqu5AQfg/ddhI= github.com/metacubex/sing-shadowtls v0.0.0-20250503063515-5d9f966d17a2/go.mod h1:mbfboaXauKJNIHJYxQRa+NJs4JU9NZfkA+I33dS2+9E= -github.com/metacubex/sing-tun v0.4.9 h1:jY0Yyt8nnN3yQRN/jTxgqNCmGi1dsFdxdIi7pQUlVVU= -github.com/metacubex/sing-tun v0.4.9/go.mod h1:L/TjQY5JEGy8nvsuYmy/XgMFMCPiF0+AWSFCYfS6r9w= +github.com/metacubex/sing-tun v0.4.10-0.20251124160354-85cd06f11a84 h1:PlVO8aCeAnVUsvO9X077iX9wz23nSnbRjtPRdE0GsY8= +github.com/metacubex/sing-tun v0.4.10-0.20251124160354-85cd06f11a84/go.mod h1:L/TjQY5JEGy8nvsuYmy/XgMFMCPiF0+AWSFCYfS6r9w= github.com/metacubex/sing-vmess v0.2.4 h1:Tx6AGgCiEf400E/xyDuYyafsel6sGbR8oF7RkAaus6I= github.com/metacubex/sing-vmess v0.2.4/go.mod h1:21R5R1u90uUvBQF0owoooEu96/SAYYD56nDrwm6nFaM= github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f h1:Sr/DYKYofKHKc4GF3qkRGNuj6XA6c0eqPgEDN+VAsYU= diff --git a/small/v2ray-geodata/Makefile b/small/v2ray-geodata/Makefile index da25bace1b..6810d14747 100644 --- a/small/v2ray-geodata/Makefile +++ b/small/v2ray-geodata/Makefile @@ -21,22 +21,22 @@ define Download/geoip HASH:=2445b44d9ae3ab9a867c9d1e0e244646c4c378622e14b9afaf3658ecf46a40b9 endef -GEOSITE_VER:=20251123125944 +GEOSITE_VER:=20251124114549 GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER) define Download/geosite URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/ URL_FILE:=dlc.dat FILE:=$(GEOSITE_FILE) - HASH:=83b10b5e81f0c3c423d50af4873993041dbb788bc016478acbf1cdd778ace92a + HASH:=1685841ffa39bf684e17704fa79ace0acd6f70c84739def9bfcd214dba6a27ba endef -GEOSITE_IRAN_VER:=202511170041 +GEOSITE_IRAN_VER:=202511240043 GEOSITE_IRAN_FILE:=iran.dat.$(GEOSITE_IRAN_VER) define Download/geosite-ir URL:=https://github.com/bootmortis/iran-hosted-domains/releases/download/$(GEOSITE_IRAN_VER)/ URL_FILE:=iran.dat FILE:=$(GEOSITE_IRAN_FILE) - HASH:=aa94b6efc99660838f85d700bbfea38d71321eeb1b3cc6cf92ade1db775d9e25 + HASH:=ffea8ddf7d6fd528ad8f7f5e5b9bc365454f5ea16be9353f0864b4baf75ec6c8 endef define Package/v2ray-geodata/template diff --git a/v2rayn/v2rayN/ServiceLib/Helper/DownloaderHelper.cs b/v2rayn/v2rayN/ServiceLib/Helper/DownloaderHelper.cs index 000685a0d8..907d416fa0 100644 --- a/v2rayn/v2rayN/ServiceLib/Helper/DownloaderHelper.cs +++ b/v2rayn/v2rayN/ServiceLib/Helper/DownloaderHelper.cs @@ -71,28 +71,25 @@ public class DownloaderHelper } }; - var totalDatetime = DateTime.Now; - var totalSecond = 0; + var lastUpdateTime = DateTime.Now; var hasValue = false; double maxSpeed = 0; await using var downloader = new Downloader.DownloadService(downloadOpt); - //downloader.DownloadStarted += (sender, value) => - //{ - // if (progress != null) - // { - // progress.Report("Start download data..."); - // } - //}; + downloader.DownloadProgressChanged += (sender, value) => { - var ts = DateTime.Now - totalDatetime; - if (progress != null && ts.Seconds > totalSecond) + if (progress != null && value.BytesPerSecondSpeed > 0) { hasValue = true; - totalSecond = ts.Seconds; if (value.BytesPerSecondSpeed > maxSpeed) { maxSpeed = value.BytesPerSecondSpeed; + } + + var ts = DateTime.Now - lastUpdateTime; + if (ts.TotalMilliseconds >= 1000) + { + lastUpdateTime = DateTime.Now; var speed = (maxSpeed / 1000 / 1000).ToString("#0.0"); progress.Report(speed); } @@ -102,10 +99,19 @@ public class DownloaderHelper { if (progress != null) { - if (!hasValue && value.Error != null) + if (hasValue && maxSpeed > 0) + { + var finalSpeed = (maxSpeed / 1000 / 1000).ToString("#0.0"); + progress.Report(finalSpeed); + } + else if (value.Error != null) { progress.Report(value.Error?.Message); } + else + { + progress.Report("0"); + } } }; //progress.Report("......"); diff --git a/v2rayn/v2rayN/ServiceLib/Services/SpeedtestService.cs b/v2rayn/v2rayN/ServiceLib/Services/SpeedtestService.cs index 00f54427cd..46cba12924 100644 --- a/v2rayn/v2rayN/ServiceLib/Services/SpeedtestService.cs +++ b/v2rayn/v2rayN/ServiceLib/Services/SpeedtestService.cs @@ -323,31 +323,28 @@ public class SpeedtestService(Config config, Func updateF { var responseTime = -1; + if (!IPAddress.TryParse(url, out var ipAddress)) + { + var ipHostInfo = await Dns.GetHostEntryAsync(url); + ipAddress = ipHostInfo.AddressList.First(); + } + + IPEndPoint endPoint = new(ipAddress, port); + using Socket clientSocket = new(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + + var timer = Stopwatch.StartNew(); try { - if (!IPAddress.TryParse(url, out var ipAddress)) - { - var ipHostInfo = await Dns.GetHostEntryAsync(url); - ipAddress = ipHostInfo.AddressList.First(); - } - - IPEndPoint endPoint = new(ipAddress, port); - using Socket clientSocket = new(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); - - var timer = Stopwatch.StartNew(); - var result = clientSocket.BeginConnect(endPoint, null, null); - if (!result.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(5))) - { - throw new TimeoutException("connect timeout (5s): " + url); - } - timer.Stop(); - responseTime = (int)timer.Elapsed.TotalMilliseconds; - - clientSocket.EndConnect(result); + using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); + await clientSocket.ConnectAsync(endPoint, cts.Token).ConfigureAwait(false); + responseTime = (int)timer.ElapsedMilliseconds; } - catch (Exception ex) + catch (OperationCanceledException) { - Logging.SaveLog(_tag, ex); + } + finally + { + timer.Stop(); } return responseTime; } diff --git a/xray-core/go.mod b/xray-core/go.mod index e51632aee6..9165e78cfd 100644 --- a/xray-core/go.mod +++ b/xray-core/go.mod @@ -11,7 +11,7 @@ require ( github.com/miekg/dns v1.1.68 github.com/pelletier/go-toml v1.9.5 github.com/pires/go-proxyproto v0.8.1 - github.com/quic-go/quic-go v0.56.0 + github.com/quic-go/quic-go v0.57.0 github.com/refraction-networking/utls v1.8.1 github.com/sagernet/sing v0.5.1 github.com/sagernet/sing-shadowsocks v0.2.7 @@ -43,7 +43,7 @@ require ( github.com/klauspost/cpuid/v2 v2.0.12 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/quic-go/qpack v0.5.1 // indirect + github.com/quic-go/qpack v0.6.0 // indirect github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect github.com/vishvananda/netns v0.0.5 // indirect golang.org/x/mod v0.29.0 // indirect diff --git a/xray-core/go.sum b/xray-core/go.sum index 77ee8b99d2..a8395f1ed7 100644 --- a/xray-core/go.sum +++ b/xray-core/go.sum @@ -48,10 +48,10 @@ github.com/pires/go-proxyproto v0.8.1 h1:9KEixbdJfhrbtjpz/ZwCdWDD2Xem0NZ38qMYaAS github.com/pires/go-proxyproto v0.8.1/go.mod h1:ZKAAyp3cgy5Y5Mo4n9AlScrkCZwUy0g3Jf+slqQVcuU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI= -github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg= -github.com/quic-go/quic-go v0.56.0 h1:q/TW+OLismmXAehgFLczhCDTYB3bFmua4D9lsNBWxvY= -github.com/quic-go/quic-go v0.56.0/go.mod h1:9gx5KsFQtw2oZ6GZTyh+7YEvOxWCL9WZAepnHxgAo6c= +github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8= +github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII= +github.com/quic-go/quic-go v0.57.0 h1:AsSSrrMs4qI/hLrKlTH/TGQeTMY0ib1pAOX7vA3AdqE= +github.com/quic-go/quic-go v0.57.0/go.mod h1:ly4QBAjHA2VhdnxhojRsCUOeJwKYg+taDlos92xb1+s= github.com/refraction-networking/utls v1.8.1 h1:yNY1kapmQU8JeM1sSw2H2asfTIwWxIkrMJI0pRUOCAo= github.com/refraction-networking/utls v1.8.1/go.mod h1:jkSOEkLqn+S/jtpEHPOsVv/4V4EVnelwbMQl4vCWXAM= github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 h1:f/FNXud6gA3MNr8meMVVGxhp+QBTqY91tM8HjEuMjGg= diff --git a/yt-dlp/yt_dlp/extractor/nhk.py b/yt-dlp/yt_dlp/extractor/nhk.py index eef3ed820c..99186ad414 100644 --- a/yt-dlp/yt_dlp/extractor/nhk.py +++ b/yt-dlp/yt_dlp/extractor/nhk.py @@ -23,96 +23,38 @@ from ..utils import ( class NhkBaseIE(InfoExtractor): - _API_URL_TEMPLATE = 'https://nwapi.nhk.jp/nhkworld/%sod%slist/v7b/%s/%s/%s/all%s.json' + _API_URL_TEMPLATE = 'https://api.nhkworld.jp/showsapi/v1/{lang}/{content_format}_{page_type}/{m_id}{extra_page}' _BASE_URL_REGEX = r'https?://www3\.nhk\.or\.jp/nhkworld/(?P[a-z]{2})/' def _call_api(self, m_id, lang, is_video, is_episode, is_clip): + content_format = 'video' if is_video else 'audio' + content_type = 'clips' if is_clip else 'episodes' + if not is_episode: + extra_page = f'/{content_format}_{content_type}' + page_type = 'programs' + else: + extra_page = '' + page_type = content_type + return self._download_json( - self._API_URL_TEMPLATE % ( - 'v' if is_video else 'r', - 'clip' if is_clip else 'esd', - 'episode' if is_episode else 'program', - m_id, lang, '/all' if is_video else ''), - m_id, query={'apikey': 'EJfK8jdS57GqlupFgAfAAwr573q01y6k'})['data']['episodes'] or [] - - def _get_api_info(self, refresh=True): - if not refresh: - return self.cache.load('nhk', 'api_info') - - self.cache.store('nhk', 'api_info', {}) - movie_player_js = self._download_webpage( - 'https://movie-a.nhk.or.jp/world/player/js/movie-player.js', None, - note='Downloading stream API information') - api_info = { - 'url': self._search_regex( - r'prod:[^;]+\bapiUrl:\s*[\'"]([^\'"]+)[\'"]', movie_player_js, None, 'stream API url'), - 'token': self._search_regex( - r'prod:[^;]+\btoken:\s*[\'"]([^\'"]+)[\'"]', movie_player_js, None, 'stream API token'), - } - self.cache.store('nhk', 'api_info', api_info) - return api_info - - def _extract_stream_info(self, vod_id): - for refresh in (False, True): - api_info = self._get_api_info(refresh) - if not api_info: - continue - - api_url = api_info.pop('url') - meta = traverse_obj( - self._download_json( - api_url, vod_id, 'Downloading stream url info', fatal=False, query={ - **api_info, - 'type': 'json', - 'optional_id': vod_id, - 'active_flg': 1, - }), ('meta', 0)) - stream_url = traverse_obj( - meta, ('movie_url', ('mb_auto', 'auto_sp', 'auto_pc'), {url_or_none}), get_all=False) - - if stream_url: - formats, subtitles = self._extract_m3u8_formats_and_subtitles(stream_url, vod_id) - return { - **traverse_obj(meta, { - 'duration': ('duration', {int_or_none}), - 'timestamp': ('publication_date', {unified_timestamp}), - 'release_timestamp': ('insert_date', {unified_timestamp}), - 'modified_timestamp': ('update_date', {unified_timestamp}), - }), - 'formats': formats, - 'subtitles': subtitles, - } - raise ExtractorError('Unable to extract stream url') + self._API_URL_TEMPLATE.format( + lang=lang, content_format=content_format, page_type=page_type, + m_id=m_id, extra_page=extra_page), + join_nonempty(m_id, lang)) def _extract_episode_info(self, url, episode=None): fetch_episode = episode is None lang, m_type, episode_id = NhkVodIE._match_valid_url(url).group('lang', 'type', 'id') is_video = m_type != 'audio' - if is_video: - episode_id = episode_id[:4] + '-' + episode_id[4:] - if fetch_episode: episode = self._call_api( - episode_id, lang, is_video, True, episode_id[:4] == '9999')[0] + episode_id, lang, is_video, is_episode=True, is_clip=episode_id[:4] == '9999') - def get_clean_field(key): - return clean_html(episode.get(key + '_clean') or episode.get(key)) + video_id = join_nonempty('id', 'lang', from_dict=episode) - title = get_clean_field('sub_title') - series = get_clean_field('title') - - thumbnails = [] - for s, w, h in [('', 640, 360), ('_l', 1280, 720)]: - img_path = episode.get('image' + s) - if not img_path: - continue - thumbnails.append({ - 'id': f'{h}p', - 'height': h, - 'width': w, - 'url': 'https://www3.nhk.or.jp' + img_path, - }) + title = episode.get('title') + series = traverse_obj(episode, (('video_program', 'audio_program'), any, 'title')) episode_name = title if series and title: @@ -125,37 +67,52 @@ class NhkBaseIE(InfoExtractor): episode_name = None info = { - 'id': episode_id + '-' + lang, + 'id': video_id, 'title': title, - 'description': get_clean_field('description'), - 'thumbnails': thumbnails, 'series': series, 'episode': episode_name, + **traverse_obj(episode, { + 'description': ('description', {str}), + 'release_timestamp': ('first_broadcasted_at', {unified_timestamp}), + 'categories': ('categories', ..., 'name', {str}), + 'tags': ('tags', ..., 'name', {str}), + 'thumbnails': ('images', lambda _, v: v['url'], { + 'url': ('url', {urljoin(url)}), + 'width': ('width', {int_or_none}), + 'height': ('height', {int_or_none}), + }), + 'webpage_url': ('url', {urljoin(url)}), + }), + 'extractor_key': NhkVodIE.ie_key(), + 'extractor': NhkVodIE.IE_NAME, } - if is_video: - vod_id = episode['vod_id'] - info.update({ - **self._extract_stream_info(vod_id), - 'id': vod_id, - }) - + # XXX: We are assuming that 'video' and 'audio' are mutually exclusive + stream_info = traverse_obj(episode, (('video', 'audio'), {dict}, any)) or {} + if not stream_info.get('url'): + self.raise_no_formats('Stream not found; it has most likely expired', expected=True) else: - if fetch_episode: + stream_url = stream_info['url'] + if is_video: + formats, subtitles = self._extract_m3u8_formats_and_subtitles(stream_url, video_id) + info.update({ + 'formats': formats, + 'subtitles': subtitles, + **traverse_obj(stream_info, ({ + 'duration': ('duration', {int_or_none}), + 'timestamp': ('published_at', {unified_timestamp}), + })), + }) + else: # From https://www3.nhk.or.jp/nhkworld/common/player/radio/inline/rod.html - audio_path = remove_end(episode['audio']['audio'], '.m4a') + audio_path = remove_end(stream_url, '.m4a') info['formats'] = self._extract_m3u8_formats( f'{urljoin("https://vod-stream.nhk.jp", audio_path)}/index.m3u8', episode_id, 'm4a', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False) for f in info['formats']: f['language'] = lang - else: - info.update({ - '_type': 'url_transparent', - 'ie_key': NhkVodIE.ie_key(), - 'url': url, - }) + return info @@ -168,29 +125,29 @@ class NhkVodIE(NhkBaseIE): # Content available only for a limited period of time. Visit # https://www3.nhk.or.jp/nhkworld/en/ondemand/ for working samples. _TESTS = [{ - 'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/video/2049126/', + 'url': 'https://www3.nhk.or.jp/nhkworld/en/shows/2049165/', 'info_dict': { - 'id': 'nw_vod_v_en_2049_126_20230413233000_01_1681398302', + 'id': '2049165-en', 'ext': 'mp4', - 'title': 'Japan Railway Journal - The Tohoku Shinkansen: Full Speed Ahead', - 'description': 'md5:49f7c5b206e03868a2fdf0d0814b92f6', + 'title': 'Japan Railway Journal - Choshi Electric Railway: Fighting to Get Back on Track', + 'description': 'md5:ab57df2fca7f04245148c2e787bb203d', 'thumbnail': r're:https://.+/.+\.jpg', - 'episode': 'The Tohoku Shinkansen: Full Speed Ahead', + 'episode': 'Choshi Electric Railway: Fighting to Get Back on Track', 'series': 'Japan Railway Journal', - 'modified_timestamp': 1707217907, - 'timestamp': 1681428600, - 'release_timestamp': 1693883728, - 'duration': 1679, - 'upload_date': '20230413', - 'modified_date': '20240206', - 'release_date': '20230905', + 'duration': 1680, + 'categories': ['Biz & Tech'], + 'tags': ['Akita', 'Chiba', 'Trains', 'Transcript', 'All (Japan Navigator)'], + 'timestamp': 1759055880, + 'upload_date': '20250928', + 'release_timestamp': 1758810600, + 'release_date': '20250925', }, }, { # video clip 'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/video/9999011/', 'md5': '153c3016dfd252ba09726588149cf0e7', 'info_dict': { - 'id': 'lpZXIwaDE6_Z-976CPsFdxyICyWUzlT5', + 'id': '9999011-en', 'ext': 'mp4', 'title': 'Dining with the Chef - Chef Saito\'s Family recipe: MENCHI-KATSU', 'description': 'md5:5aee4a9f9d81c26281862382103b0ea5', @@ -198,24 +155,23 @@ class NhkVodIE(NhkBaseIE): 'series': 'Dining with the Chef', 'episode': 'Chef Saito\'s Family recipe: MENCHI-KATSU', 'duration': 148, - 'upload_date': '20190816', - 'release_date': '20230902', - 'release_timestamp': 1693619292, - 'modified_timestamp': 1707217907, - 'modified_date': '20240206', - 'timestamp': 1565997540, + 'categories': ['Food'], + 'tags': ['Washoku'], + 'timestamp': 1548212400, + 'upload_date': '20190123', }, }, { # radio - 'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/audio/livinginjapan-20231001-1/', + 'url': 'https://www3.nhk.or.jp/nhkworld/en/shows/audio/livinginjapan-20240901-1/', 'info_dict': { - 'id': 'livinginjapan-20231001-1-en', + 'id': 'livinginjapan-20240901-1-en', 'ext': 'm4a', - 'title': 'Living in Japan - Tips for Travelers to Japan / Ramen Vending Machines', + 'title': 'Living in Japan - Weekend Hiking / Self-protection from crime', 'series': 'Living in Japan', - 'description': 'md5:0a0e2077d8f07a03071e990a6f51bfab', + 'description': 'md5:4d0e14ab73bdbfedb60a53b093954ed6', 'thumbnail': r're:https://.+/.+\.jpg', - 'episode': 'Tips for Travelers to Japan / Ramen Vending Machines', + 'episode': 'Weekend Hiking / Self-protection from crime', + 'categories': ['Interactive'], }, }, { 'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/video/2015173/', @@ -256,96 +212,51 @@ class NhkVodIE(NhkBaseIE): }, 'skip': 'expires 2023-10-15', }, { - # a one-off (single-episode series). title from the api is just '

' - 'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/video/3004952/', + # a one-off (single-episode series). title from the api is just null + 'url': 'https://www3.nhk.or.jp/nhkworld/en/shows/3026036/', 'info_dict': { - 'id': 'nw_vod_v_en_3004_952_20230723091000_01_1690074552', + 'id': '3026036-en', 'ext': 'mp4', - 'title': 'Barakan Discovers - AMAMI OSHIMA: Isson\'s Treasure Isla', - 'description': 'md5:5db620c46a0698451cc59add8816b797', - 'thumbnail': r're:https://.+/.+\.jpg', - 'release_date': '20230905', - 'timestamp': 1690103400, - 'duration': 2939, - 'release_timestamp': 1693898699, - 'upload_date': '20230723', - 'modified_timestamp': 1707217907, - 'modified_date': '20240206', - 'episode': 'AMAMI OSHIMA: Isson\'s Treasure Isla', - 'series': 'Barakan Discovers', + 'title': 'STATELESS: The Japanese Left Behind in the Philippines', + 'description': 'md5:9a2fd51cdfa9f52baae28569e0053786', + 'duration': 2955, + 'thumbnail': 'https://www3.nhk.or.jp/nhkworld/en/shows/3026036/images/wide_l_QPtWpt4lzVhm3NzPAMIIF35MCg4CdNwcikPaTS5Q.jpg', + 'categories': ['Documentary', 'Culture & Lifestyle'], + 'tags': ['Transcript', 'Documentary 360', 'The Pursuit of PEACE'], + 'timestamp': 1758931800, + 'upload_date': '20250927', + 'release_timestamp': 1758931800, + 'release_date': '20250927', }, }, { # /ondemand/video/ url with alphabetical character in 5th position of id 'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/video/9999a07/', 'info_dict': { - 'id': 'nw_c_en_9999-a07', + 'id': '9999a07-en', 'ext': 'mp4', 'episode': 'Mini-Dramas on SDGs: Ep 1 Close the Gender Gap [Director\'s Cut]', 'series': 'Mini-Dramas on SDGs', - 'modified_date': '20240206', 'title': 'Mini-Dramas on SDGs - Mini-Dramas on SDGs: Ep 1 Close the Gender Gap [Director\'s Cut]', 'description': 'md5:3f9dcb4db22fceb675d90448a040d3f6', - 'timestamp': 1621962360, - 'duration': 189, - 'release_date': '20230903', - 'modified_timestamp': 1707217907, + 'timestamp': 1621911600, + 'duration': 190, 'upload_date': '20210525', 'thumbnail': r're:https://.+/.+\.jpg', - 'release_timestamp': 1693713487, + 'categories': ['Current Affairs', 'Entertainment'], }, }, { 'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/video/9999d17/', 'info_dict': { - 'id': 'nw_c_en_9999-d17', + 'id': '9999d17-en', 'ext': 'mp4', 'title': 'Flowers of snow blossom - The 72 Pentads of Yamato', 'description': 'Today’s focus: Snow', - 'release_timestamp': 1693792402, - 'release_date': '20230904', - 'upload_date': '20220128', - 'timestamp': 1643370960, 'thumbnail': r're:https://.+/.+\.jpg', 'duration': 136, - 'series': '', - 'modified_date': '20240206', - 'modified_timestamp': 1707217907, - }, - }, { - # new /shows/ url format - 'url': 'https://www3.nhk.or.jp/nhkworld/en/shows/2032307/', - 'info_dict': { - 'id': 'nw_vod_v_en_2032_307_20240321113000_01_1710990282', - 'ext': 'mp4', - 'title': 'Japanology Plus - 20th Anniversary Special Part 1', - 'description': 'md5:817d41fc8e54339ad2a916161ea24faf', - 'episode': '20th Anniversary Special Part 1', - 'series': 'Japanology Plus', - 'thumbnail': r're:https://.+/.+\.jpg', - 'duration': 1680, - 'timestamp': 1711020600, - 'upload_date': '20240321', - 'release_timestamp': 1711022683, - 'release_date': '20240321', - 'modified_timestamp': 1711031012, - 'modified_date': '20240321', - }, - }, { - 'url': 'https://www3.nhk.or.jp/nhkworld/en/shows/3020025/', - 'info_dict': { - 'id': 'nw_vod_v_en_3020_025_20230325144000_01_1679723944', - 'ext': 'mp4', - 'title': '100 Ideas to Save the World - Working Styles Evolve', - 'description': 'md5:9e6c7778eaaf4f7b4af83569649f84d9', - 'episode': 'Working Styles Evolve', - 'series': '100 Ideas to Save the World', - 'thumbnail': r're:https://.+/.+\.jpg', - 'duration': 899, - 'upload_date': '20230325', - 'timestamp': 1679755200, - 'release_date': '20230905', - 'release_timestamp': 1693880540, - 'modified_date': '20240206', - 'modified_timestamp': 1707217907, + 'categories': ['Culture & Lifestyle', 'Science & Nature'], + 'tags': ['Nara', 'Temples & Shrines', 'Winter', 'Snow'], + 'timestamp': 1643339040, + 'upload_date': '20220128', }, }, { # new /shows/audio/ url format @@ -373,6 +284,7 @@ class NhkVodProgramIE(NhkBaseIE): 'id': 'sumo', 'title': 'GRAND SUMO Highlights', 'description': 'md5:fc20d02dc6ce85e4b72e0273aa52fdbf', + 'series': 'GRAND SUMO Highlights', }, 'playlist_mincount': 1, }, { @@ -381,6 +293,7 @@ class NhkVodProgramIE(NhkBaseIE): 'id': 'japanrailway', 'title': 'Japan Railway Journal', 'description': 'md5:ea39d93af7d05835baadf10d1aae0e3f', + 'series': 'Japan Railway Journal', }, 'playlist_mincount': 12, }, { @@ -390,6 +303,7 @@ class NhkVodProgramIE(NhkBaseIE): 'id': 'japanrailway', 'title': 'Japan Railway Journal', 'description': 'md5:ea39d93af7d05835baadf10d1aae0e3f', + 'series': 'Japan Railway Journal', }, 'playlist_mincount': 12, }, { @@ -399,17 +313,9 @@ class NhkVodProgramIE(NhkBaseIE): 'id': 'livinginjapan', 'title': 'Living in Japan', 'description': 'md5:665bb36ec2a12c5a7f598ee713fc2b54', + 'series': 'Living in Japan', }, - 'playlist_mincount': 12, - }, { - # /tv/ program url - 'url': 'https://www3.nhk.or.jp/nhkworld/en/tv/designtalksplus/', - 'info_dict': { - 'id': 'designtalksplus', - 'title': 'DESIGN TALKS plus', - 'description': 'md5:47b3b3a9f10d4ac7b33b53b70a7d2837', - }, - 'playlist_mincount': 20, + 'playlist_mincount': 11, }, { 'url': 'https://www3.nhk.or.jp/nhkworld/en/shows/10yearshayaomiyazaki/', 'only_matching': True, @@ -430,9 +336,8 @@ class NhkVodProgramIE(NhkBaseIE): program_id, lang, m_type != 'audio', False, episode_type == 'clip') def entries(): - for episode in episodes: - if episode_path := episode.get('url'): - yield self._extract_episode_info(urljoin(url, episode_path), episode) + for episode in traverse_obj(episodes, ('items', lambda _, v: v['url'])): + yield self._extract_episode_info(urljoin(url, episode['url']), episode) html = self._download_webpage(url, program_id) program_title = self._extract_meta_from_class_elements([ @@ -446,7 +351,7 @@ class NhkVodProgramIE(NhkBaseIE): 'tAudioProgramMain__info', # /shows/audio/programs/ 'p-program-description'], html) # /tv/ - return self.playlist_result(entries(), program_id, program_title, program_description) + return self.playlist_result(entries(), program_id, program_title, program_description, series=program_title) class NhkForSchoolBangumiIE(InfoExtractor): diff --git a/yt-dlp/yt_dlp/utils/_jsruntime.py b/yt-dlp/yt_dlp/utils/_jsruntime.py index bd8fd1f880..94db52bf19 100644 --- a/yt-dlp/yt_dlp/utils/_jsruntime.py +++ b/yt-dlp/yt_dlp/utils/_jsruntime.py @@ -1,21 +1,61 @@ from __future__ import annotations + import abc import dataclasses import functools import os.path +import sys from ._utils import _get_exe_version_output, detect_exe_version, int_or_none -# NOT public API -def runtime_version_tuple(v): +def _runtime_version_tuple(v): # NB: will return (0,) if `v` is an invalid version string return tuple(int_or_none(x, default=0) for x in v.split('.')) +_FALLBACK_PATHEXT = ('.COM', '.EXE', '.BAT', '.CMD') + + +def _find_exe(basename: str) -> str: + if os.name != 'nt': + return basename + + paths: list[str] = [] + + # binary dir + if getattr(sys, 'frozen', False): + paths.append(os.path.dirname(sys.executable)) + # cwd + paths.append(os.getcwd()) + # PATH items + if path := os.environ.get('PATH'): + paths.extend(filter(None, path.split(os.path.pathsep))) + + pathext = os.environ.get('PATHEXT') + if pathext is None: + exts = _FALLBACK_PATHEXT + else: + exts = tuple(ext for ext in pathext.split(os.pathsep) if ext) + + visited = [] + for path in map(os.path.realpath, paths): + normed = os.path.normcase(path) + if normed in visited: + continue + visited.append(normed) + + for ext in exts: + binary = os.path.join(path, f'{basename}{ext}') + if os.access(binary, os.F_OK | os.X_OK) and not os.path.isdir(binary): + return binary + + return basename + + def _determine_runtime_path(path, basename): if not path: - return basename + return _find_exe(basename) if os.path.isdir(path): return os.path.join(path, basename) return path @@ -52,7 +92,7 @@ class DenoJsRuntime(JsRuntime): if not out: return None version = detect_exe_version(out, r'^deno (\S+)', 'unknown') - vt = runtime_version_tuple(version) + vt = _runtime_version_tuple(version) return JsRuntimeInfo( name='deno', path=path, version=version, version_tuple=vt, supported=vt >= self.MIN_SUPPORTED_VERSION) @@ -67,7 +107,7 @@ class BunJsRuntime(JsRuntime): if not out: return None version = detect_exe_version(out, r'^(\S+)', 'unknown') - vt = runtime_version_tuple(version) + vt = _runtime_version_tuple(version) return JsRuntimeInfo( name='bun', path=path, version=version, version_tuple=vt, supported=vt >= self.MIN_SUPPORTED_VERSION) @@ -82,7 +122,7 @@ class NodeJsRuntime(JsRuntime): if not out: return None version = detect_exe_version(out, r'^v(\S+)', 'unknown') - vt = runtime_version_tuple(version) + vt = _runtime_version_tuple(version) return JsRuntimeInfo( name='node', path=path, version=version, version_tuple=vt, supported=vt >= self.MIN_SUPPORTED_VERSION) @@ -100,7 +140,7 @@ class QuickJsRuntime(JsRuntime): is_ng = 'QuickJS-ng' in out version = detect_exe_version(out, r'^QuickJS(?:-ng)?\s+version\s+(\S+)', 'unknown') - vt = runtime_version_tuple(version.replace('-', '.')) + vt = _runtime_version_tuple(version.replace('-', '.')) if is_ng: return JsRuntimeInfo( name='quickjs-ng', path=path, version=version, version_tuple=vt, diff --git a/yt-dlp/yt_dlp/utils/_utils.py b/yt-dlp/yt_dlp/utils/_utils.py index c6ae21f6c7..65cd2373ce 100644 --- a/yt-dlp/yt_dlp/utils/_utils.py +++ b/yt-dlp/yt_dlp/utils/_utils.py @@ -876,13 +876,19 @@ class Popen(subprocess.Popen): kwargs.setdefault('encoding', 'utf-8') kwargs.setdefault('errors', 'replace') - if shell and os.name == 'nt' and kwargs.get('executable') is None: - if not isinstance(args, str): - args = shell_quote(args, shell=True) - shell = False - # Set variable for `cmd.exe` newline escaping (see `utils.shell_quote`) - env['='] = '"^\n\n"' - args = f'{self.__comspec()} /Q /S /D /V:OFF /E:ON /C "{args}"' + if os.name == 'nt' and kwargs.get('executable') is None: + # Must apply shell escaping if we are trying to run a batch file + # These conditions should be very specific to limit impact + if not shell and isinstance(args, list) and args and args[0].lower().endswith(('.bat', '.cmd')): + shell = True + + if shell: + if not isinstance(args, str): + args = shell_quote(args, shell=True) + shell = False + # Set variable for `cmd.exe` newline escaping (see `utils.shell_quote`) + env['='] = '"^\n\n"' + args = f'{self.__comspec()} /Q /S /D /V:OFF /E:ON /C "{args}"' super().__init__(args, *remaining, env=env, shell=shell, **kwargs, startupinfo=self._startupinfo)