Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
commit
c7f1ca5117
@ -1,8 +1,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_VERSION:=2024.07
|
||||
PKG_HASH:=f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f
|
||||
PKG_VERSION:=2024.10
|
||||
PKG_HASH:=b28daf4ac17e43156363078bf510297584137f6df50fced9b12df34f61a92fb0
|
||||
PKG_BUILD_DEPENDS:=!(TARGET_ramips||TARGET_mediatek_mt7623):arm-trusted-firmware-tools/host
|
||||
|
||||
UBOOT_USE_INTREE_DTC:=1
|
||||
@ -922,7 +922,8 @@ UBOOT_TARGETS := \
|
||||
|
||||
UBOOT_CUSTOMIZE_CONFIG := \
|
||||
--disable TOOLS_KWBIMAGE \
|
||||
--disable TOOLS_LIBCRYPTO
|
||||
--disable TOOLS_LIBCRYPTO \
|
||||
--disable TOOLS_MKEFICAPSULE
|
||||
|
||||
ifdef CONFIG_TARGET_mediatek
|
||||
UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE:.fip=.bin)
|
||||
|
@ -38,7 +38,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
--- a/drivers/mtd/Kconfig
|
||||
+++ b/drivers/mtd/Kconfig
|
||||
@@ -238,6 +238,8 @@ config SYS_MAX_FLASH_BANKS_DETECT
|
||||
@@ -246,6 +246,8 @@ config SYS_MAX_FLASH_BANKS_DETECT
|
||||
to reduce the effective number of flash bank, between 0 and
|
||||
CONFIG_SYS_MAX_FLASH_BANKS
|
||||
|
||||
@ -49,7 +49,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
config SYS_NAND_MAX_OOBFREE
|
||||
--- a/drivers/mtd/Makefile
|
||||
+++ b/drivers/mtd/Makefile
|
||||
@@ -39,3 +39,5 @@ obj-$(CONFIG_$(SPL_TPL_)SPI_FLASH_SUPPOR
|
||||
@@ -40,3 +40,5 @@ obj-$(CONFIG_$(SPL_TPL_)SPI_FLASH_SUPPOR
|
||||
obj-$(CONFIG_SPL_UBI) += ubispl/
|
||||
|
||||
endif
|
||||
@ -1313,7 +1313,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <config.h>
|
||||
+#include <dm.h>
|
||||
+#include <malloc.h>
|
||||
+#include <mapmem.h>
|
||||
@ -1896,7 +1896,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+#ifndef _MTK_SNAND_OS_H_
|
||||
+#define _MTK_SNAND_OS_H_
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <config.h>
|
||||
+#include <cpu_func.h>
|
||||
+#include <errno.h>
|
||||
+#include <div64.h>
|
||||
|
@ -47,7 +47,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <config.h>
|
||||
+#include <dm.h>
|
||||
+#include <dm/uclass.h>
|
||||
+#include <malloc.h>
|
||||
|
@ -370,7 +370,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+};
|
||||
--- a/include/env_internal.h
|
||||
+++ b/include/env_internal.h
|
||||
@@ -108,6 +108,7 @@ enum env_location {
|
||||
@@ -107,6 +107,7 @@ enum env_location {
|
||||
ENVL_FAT,
|
||||
ENVL_FLASH,
|
||||
ENVL_MMC,
|
||||
|
@ -15,7 +15,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
--- a/cmd/mtdparts.c
|
||||
+++ b/cmd/mtdparts.c
|
||||
@@ -1057,6 +1057,9 @@ int mtd_id_parse(const char *id, const c
|
||||
@@ -1054,6 +1054,9 @@ int mtd_id_parse(const char *id, const c
|
||||
} else if (strncmp(p, "spi-nand", 8) == 0) {
|
||||
*dev_type = MTD_DEV_TYPE_SPINAND;
|
||||
p += 8;
|
||||
@ -27,7 +27,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
return 1;
|
||||
--- a/include/jffs2/load_kernel.h
|
||||
+++ b/include/jffs2/load_kernel.h
|
||||
@@ -16,11 +16,13 @@
|
||||
@@ -17,11 +17,13 @@
|
||||
#define MTD_DEV_TYPE_NAND 0x0002
|
||||
#define MTD_DEV_TYPE_ONENAND 0x0004
|
||||
#define MTD_DEV_TYPE_SPINAND 0x0008
|
||||
|
@ -31,7 +31,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
--- a/drivers/mtd/Kconfig
|
||||
+++ b/drivers/mtd/Kconfig
|
||||
@@ -274,6 +274,8 @@ source "drivers/mtd/ubi/Kconfig"
|
||||
@@ -282,6 +282,8 @@ source "drivers/mtd/ubi/Kconfig"
|
||||
|
||||
source "drivers/mtd/nvmxip/Kconfig"
|
||||
|
||||
@ -42,7 +42,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
endmenu
|
||||
--- a/drivers/mtd/Makefile
|
||||
+++ b/drivers/mtd/Makefile
|
||||
@@ -41,3 +41,4 @@ obj-$(CONFIG_SPL_UBI) += ubispl/
|
||||
@@ -42,3 +42,4 @@ obj-$(CONFIG_SPL_UBI) += ubispl/
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_MTK_SPI_NAND) += mtk-snand/
|
||||
|
@ -13,7 +13,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
--- a/common/board_r.c
|
||||
+++ b/common/board_r.c
|
||||
@@ -373,6 +373,20 @@ static int initr_nand(void)
|
||||
@@ -372,6 +372,20 @@ static int initr_nand(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -34,7 +34,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
#if defined(CONFIG_CMD_ONENAND)
|
||||
/* go init the NAND */
|
||||
static int initr_onenand(void)
|
||||
@@ -664,6 +678,9 @@ static init_fnc_t init_sequence_r[] = {
|
||||
@@ -663,6 +677,9 @@ static init_fnc_t init_sequence_r[] = {
|
||||
#ifdef CONFIG_CMD_ONENAND
|
||||
initr_onenand,
|
||||
#endif
|
||||
|
@ -15,7 +15,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
--- a/cmd/Kconfig
|
||||
+++ b/cmd/Kconfig
|
||||
@@ -1450,6 +1450,12 @@ config CMD_NAND_TORTURE
|
||||
@@ -1465,6 +1465,12 @@ config CMD_NAND_TORTURE
|
||||
|
||||
endif # CMD_NAND
|
||||
|
||||
|
@ -20,7 +20,7 @@ Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
|
||||
|
||||
--- a/cmd/mtd.c
|
||||
+++ b/cmd/mtd.c
|
||||
@@ -722,6 +722,42 @@ out_put_mtd:
|
||||
@@ -721,6 +721,42 @@ out_put_mtd:
|
||||
return CMD_RET_SUCCESS;
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
|
||||
#ifdef CONFIG_AUTO_COMPLETE
|
||||
static int mtd_name_complete(int argc, char *const argv[], char last_char,
|
||||
int maxv, char *cmdv[])
|
||||
@@ -769,6 +805,7 @@ U_BOOT_LONGHELP(mtd,
|
||||
@@ -768,6 +804,7 @@ U_BOOT_LONGHELP(mtd,
|
||||
"\n"
|
||||
"Specific functions:\n"
|
||||
"mtd bad <name>\n"
|
||||
@ -71,7 +71,7 @@ Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
|
||||
#if CONFIG_IS_ENABLED(CMD_MTD_OTP)
|
||||
"mtd otpread <name> [u|f] <off> <size>\n"
|
||||
"mtd otpwrite <name> <off> <hex string>\n"
|
||||
@@ -809,4 +846,6 @@ U_BOOT_CMD_WITH_SUBCMDS(mtd, "MTD utils"
|
||||
@@ -808,4 +845,6 @@ U_BOOT_CMD_WITH_SUBCMDS(mtd, "MTD utils"
|
||||
U_BOOT_SUBCMD_MKENT_COMPLETE(erase, 4, 0, do_mtd_erase,
|
||||
mtd_name_complete),
|
||||
U_BOOT_SUBCMD_MKENT_COMPLETE(bad, 2, 1, do_mtd_bad,
|
||||
|
@ -240,7 +240,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+};
|
||||
--- a/include/env_internal.h
|
||||
+++ b/include/env_internal.h
|
||||
@@ -110,6 +110,7 @@ enum env_location {
|
||||
@@ -109,6 +109,7 @@ enum env_location {
|
||||
ENVL_MMC,
|
||||
ENVL_MTD,
|
||||
ENVL_NAND,
|
||||
|
@ -26,7 +26,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
--- a/cmd/Kconfig
|
||||
+++ b/cmd/Kconfig
|
||||
@@ -1450,6 +1450,14 @@ config CMD_NAND_TORTURE
|
||||
@@ -1465,6 +1465,14 @@ config CMD_NAND_TORTURE
|
||||
|
||||
endif # CMD_NAND
|
||||
|
||||
|
@ -13,7 +13,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
--- a/drivers/mtd/spi/spi-nor-core.c
|
||||
+++ b/drivers/mtd/spi/spi-nor-core.c
|
||||
@@ -2908,6 +2908,100 @@ static int spi_nor_init_params(struct sp
|
||||
@@ -2958,6 +2958,100 @@ static int spi_nor_init_params(struct sp
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
static int spi_nor_hwcaps2cmd(u32 hwcaps, const int table[][2], size_t size)
|
||||
{
|
||||
size_t i;
|
||||
@@ -4027,6 +4121,7 @@ int spi_nor_scan(struct spi_nor *nor)
|
||||
@@ -4077,6 +4171,7 @@ int spi_nor_scan(struct spi_nor *nor)
|
||||
nor->write = spi_nor_write_data;
|
||||
nor->read_reg = spi_nor_read_reg;
|
||||
nor->write_reg = spi_nor_write_reg;
|
||||
|
@ -14,7 +14,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
--- a/cmd/bootmenu.c
|
||||
+++ b/cmd/bootmenu.c
|
||||
@@ -89,6 +89,7 @@ static char *bootmenu_choice_entry(void
|
||||
@@ -88,6 +88,7 @@ static char *bootmenu_choice_entry(void
|
||||
struct bootmenu_data *menu = data;
|
||||
struct bootmenu_entry *iter;
|
||||
enum bootmenu_key key = BKEY_NONE;
|
||||
@ -22,7 +22,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
int i;
|
||||
|
||||
cli_ch_init(cch);
|
||||
@@ -96,10 +97,10 @@ static char *bootmenu_choice_entry(void
|
||||
@@ -95,10 +96,10 @@ static char *bootmenu_choice_entry(void
|
||||
while (1) {
|
||||
if (menu->delay >= 0) {
|
||||
/* Autoboot was not stopped */
|
||||
@ -35,7 +35,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
@@ -113,6 +114,12 @@ static char *bootmenu_choice_entry(void
|
||||
@@ -112,6 +113,12 @@ static char *bootmenu_choice_entry(void
|
||||
++menu->active;
|
||||
/* no menu key selected, regenerate menu */
|
||||
return NULL;
|
||||
@ -48,7 +48,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
case BKEY_SELECT:
|
||||
iter = menu->first;
|
||||
for (i = 0; i < menu->active; ++i)
|
||||
@@ -170,6 +177,9 @@ static int prepare_bootmenu_entry(struct
|
||||
@@ -169,6 +176,9 @@ static int prepare_bootmenu_entry(struct
|
||||
unsigned short int i = *index;
|
||||
struct bootmenu_entry *entry = NULL;
|
||||
struct bootmenu_entry *iter = *current;
|
||||
@ -58,7 +58,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
while ((option = bootmenu_getoption(i))) {
|
||||
|
||||
@@ -184,11 +194,24 @@ static int prepare_bootmenu_entry(struct
|
||||
@@ -183,11 +193,24 @@ static int prepare_bootmenu_entry(struct
|
||||
if (!entry)
|
||||
return -ENOMEM;
|
||||
|
||||
@ -84,7 +84,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
entry->command = strdup(sep + 1);
|
||||
if (!entry->command) {
|
||||
@@ -334,6 +357,7 @@ static struct bootmenu_data *bootmenu_cr
|
||||
@@ -333,6 +356,7 @@ static struct bootmenu_data *bootmenu_cr
|
||||
menu->delay = delay;
|
||||
menu->active = 0;
|
||||
menu->first = NULL;
|
||||
@ -92,7 +92,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
default_str = env_get("bootmenu_default");
|
||||
if (default_str)
|
||||
@@ -369,9 +393,9 @@ static struct bootmenu_data *bootmenu_cr
|
||||
@@ -368,9 +392,9 @@ static struct bootmenu_data *bootmenu_cr
|
||||
|
||||
/* Add Quit entry if exiting bootmenu is disabled */
|
||||
if (!IS_ENABLED(CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE))
|
||||
@ -106,7 +106,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
free(entry);
|
||||
--- a/common/menu.c
|
||||
+++ b/common/menu.c
|
||||
@@ -49,6 +49,33 @@ struct menu {
|
||||
@@ -48,6 +48,33 @@ struct menu {
|
||||
int item_cnt;
|
||||
};
|
||||
|
||||
@ -140,7 +140,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
/*
|
||||
* An iterator function for menu items. callback will be called for each item
|
||||
* in m, with m, a pointer to the item, and extra being passed to callback. If
|
||||
@@ -428,7 +455,7 @@ int menu_destroy(struct menu *m)
|
||||
@@ -426,7 +453,7 @@ int menu_destroy(struct menu *m)
|
||||
}
|
||||
|
||||
enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu,
|
||||
@ -149,7 +149,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
{
|
||||
enum bootmenu_key key = BKEY_NONE;
|
||||
int i, c;
|
||||
@@ -463,6 +490,19 @@ enum bootmenu_key bootmenu_autoboot_loop
|
||||
@@ -461,6 +488,19 @@ enum bootmenu_key bootmenu_autoboot_loop
|
||||
break;
|
||||
default:
|
||||
key = BKEY_NONE;
|
||||
@ -169,7 +169,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -483,7 +523,8 @@ enum bootmenu_key bootmenu_autoboot_loop
|
||||
@@ -481,7 +521,8 @@ enum bootmenu_key bootmenu_autoboot_loop
|
||||
return key;
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
{
|
||||
enum bootmenu_key key;
|
||||
|
||||
@@ -515,6 +556,20 @@ enum bootmenu_key bootmenu_conv_key(int
|
||||
@@ -513,6 +554,20 @@ enum bootmenu_key bootmenu_conv_key(int
|
||||
case ' ':
|
||||
key = BKEY_SPACE;
|
||||
break;
|
||||
@ -200,7 +200,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
default:
|
||||
key = BKEY_NONE;
|
||||
break;
|
||||
@@ -524,11 +579,16 @@ enum bootmenu_key bootmenu_conv_key(int
|
||||
@@ -522,11 +577,16 @@ enum bootmenu_key bootmenu_conv_key(int
|
||||
}
|
||||
|
||||
enum bootmenu_key bootmenu_loop(struct bootmenu_data *menu,
|
||||
@ -218,7 +218,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
c = cli_ch_process(cch, 0);
|
||||
if (!c) {
|
||||
while (!c && !tstc()) {
|
||||
@@ -542,7 +602,7 @@ enum bootmenu_key bootmenu_loop(struct b
|
||||
@@ -540,7 +600,7 @@ enum bootmenu_key bootmenu_loop(struct b
|
||||
}
|
||||
}
|
||||
|
||||
@ -301,7 +301,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
switch (key) {
|
||||
case BKEY_UP:
|
||||
@@ -1839,7 +1839,7 @@ char *eficonfig_choice_change_boot_order
|
||||
@@ -1881,7 +1881,7 @@ char *eficonfig_choice_change_boot_order
|
||||
|
||||
cli_ch_init(cch);
|
||||
while (1) {
|
||||
@ -312,7 +312,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
case BKEY_PLUS:
|
||||
--- a/boot/bootflow_menu.c
|
||||
+++ b/boot/bootflow_menu.c
|
||||
@@ -234,7 +234,7 @@ int bootflow_menu_run(struct bootstd_pri
|
||||
@@ -240,7 +240,7 @@ int bootflow_menu_run(struct bootstd_pri
|
||||
|
||||
key = 0;
|
||||
if (ichar) {
|
||||
|
@ -14,7 +14,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
--- a/common/spl/spl_nand.c
|
||||
+++ b/common/spl/spl_nand.c
|
||||
@@ -19,7 +19,11 @@
|
||||
@@ -18,7 +18,11 @@
|
||||
|
||||
uint32_t __weak spl_nand_get_uboot_raw_page(void)
|
||||
{
|
||||
|
@ -89,7 +89,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
reg = <0x11014000 0x1000>;
|
||||
--- a/arch/arm/mach-mediatek/Kconfig
|
||||
+++ b/arch/arm/mach-mediatek/Kconfig
|
||||
@@ -147,9 +147,11 @@ config SYS_CONFIG_NAME
|
||||
@@ -148,9 +148,11 @@ config SYS_CONFIG_NAME
|
||||
|
||||
config MTK_BROM_HEADER_INFO
|
||||
string
|
||||
|
@ -18,7 +18,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
--- a/arch/arm/dts/Makefile
|
||||
+++ b/arch/arm/dts/Makefile
|
||||
@@ -1225,6 +1225,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
|
||||
@@ -1190,6 +1190,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
|
||||
mt7623n-bananapi-bpi-r2.dtb \
|
||||
mt7629-rfb.dtb \
|
||||
mt7981-rfb.dtb \
|
||||
|
@ -13,7 +13,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
--- a/drivers/mtd/spi/spi-nor-core.c
|
||||
+++ b/drivers/mtd/spi/spi-nor-core.c
|
||||
@@ -698,6 +698,7 @@ static int set_4byte(struct spi_nor *nor
|
||||
@@ -697,6 +697,7 @@ static int set_4byte(struct spi_nor *nor
|
||||
case SNOR_MFR_ISSI:
|
||||
case SNOR_MFR_MACRONIX:
|
||||
case SNOR_MFR_WINBOND:
|
||||
@ -23,7 +23,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
--- a/drivers/mtd/spi/spi-nor-ids.c
|
||||
+++ b/drivers/mtd/spi/spi-nor-ids.c
|
||||
@@ -84,7 +84,8 @@ const struct flash_info spi_nor_ids[] =
|
||||
@@ -83,7 +83,8 @@ const struct flash_info spi_nor_ids[] =
|
||||
{ INFO("en25q32b", 0x1c3016, 0, 64 * 1024, 64, 0) },
|
||||
{ INFO("en25q64", 0x1c3017, 0, 64 * 1024, 128, SECT_4K) },
|
||||
{ INFO("en25q128b", 0x1c3018, 0, 64 * 1024, 256, 0) },
|
||||
@ -33,7 +33,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
{ INFO("en25s64", 0x1c3817, 0, 64 * 1024, 128, SECT_4K) },
|
||||
#endif
|
||||
#ifdef CONFIG_SPI_FLASH_GIGADEVICE /* GIGADEVICE */
|
||||
@@ -150,6 +151,11 @@ const struct flash_info spi_nor_ids[] =
|
||||
@@ -149,6 +150,11 @@ const struct flash_info spi_nor_ids[] =
|
||||
{INFO("gd55x02g", 0xc8481C, 0, 64 * 1024, 4096, SECT_4K |
|
||||
SPI_NOR_OCTAL_READ | SPI_NOR_4B_OPCODES)},
|
||||
{
|
||||
@ -45,7 +45,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
INFO("gd25lq128", 0xc86018, 0, 64 * 1024, 256,
|
||||
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
|
||||
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
|
||||
@@ -489,6 +495,16 @@ const struct flash_info spi_nor_ids[] =
|
||||
@@ -490,6 +496,16 @@ const struct flash_info spi_nor_ids[] =
|
||||
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
|
||||
},
|
||||
{
|
||||
@ -62,7 +62,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
INFO("w25q128jw", 0xef8018, 0, 64 * 1024, 256,
|
||||
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
|
||||
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
|
||||
@@ -548,6 +564,11 @@ const struct flash_info spi_nor_ids[] =
|
||||
@@ -549,6 +565,11 @@ const struct flash_info spi_nor_ids[] =
|
||||
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
|
||||
},
|
||||
{ INFO("w25q256", 0xef4019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
|
||||
|
@ -31,7 +31,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
obj-$(CONFIG_MTD_SPI_NAND) += spinand.o
|
||||
--- a/drivers/mtd/nand/spi/core.c
|
||||
+++ b/drivers/mtd/nand/spi/core.c
|
||||
@@ -822,6 +822,7 @@ static const struct nand_ops spinand_ops
|
||||
@@ -826,6 +826,7 @@ static const struct nand_ops spinand_ops
|
||||
};
|
||||
|
||||
static const struct spinand_manufacturer *spinand_manufacturers[] = {
|
||||
|
@ -15,7 +15,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
--- a/drivers/mmc/Kconfig
|
||||
+++ b/drivers/mmc/Kconfig
|
||||
@@ -855,6 +855,14 @@ config MMC_MTK
|
||||
@@ -864,6 +864,14 @@ config MMC_MTK
|
||||
This is needed if support for any SD/SDIO/MMC devices is required.
|
||||
If unsure, say N.
|
||||
|
||||
@ -42,7 +42,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+endif
|
||||
--- a/drivers/mmc/mtk-sd.c
|
||||
+++ b/drivers/mmc/mtk-sd.c
|
||||
@@ -779,18 +779,24 @@ static int msdc_ops_send_cmd(struct udev
|
||||
@@ -783,18 +783,24 @@ static int msdc_ops_send_cmd(struct udev
|
||||
if (cmd_ret &&
|
||||
!(cmd_ret == -EIO &&
|
||||
(cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK ||
|
||||
|
@ -14,7 +14,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
--- a/cmd/ubi.c
|
||||
+++ b/cmd/ubi.c
|
||||
@@ -213,8 +213,8 @@ bad:
|
||||
@@ -212,8 +212,8 @@ bad:
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -25,16 +25,16 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
{
|
||||
struct ubi_mkvol_req req;
|
||||
int err;
|
||||
@@ -247,7 +247,7 @@ static int ubi_create_vol(char *volume,
|
||||
@@ -246,7 +246,7 @@ static int ubi_create_vol(char *volume,
|
||||
return ubi_create_volume(ubi, &req);
|
||||
}
|
||||
|
||||
-static struct ubi_volume *ubi_find_volume(char *volume)
|
||||
+struct ubi_volume *ubi_find_volume(char *volume)
|
||||
{
|
||||
struct ubi_volume *vol = NULL;
|
||||
struct ubi_volume *vol;
|
||||
int i;
|
||||
@@ -262,7 +262,7 @@ static struct ubi_volume *ubi_find_volum
|
||||
@@ -261,7 +261,7 @@ static struct ubi_volume *ubi_find_volum
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -47,8 +47,8 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+++ b/include/ubi_uboot.h
|
||||
@@ -50,6 +50,10 @@ extern void ubi_exit(void);
|
||||
extern int ubi_part(char *part_name, const char *vid_header_offset);
|
||||
extern int ubi_volume_write(char *volume, void *buf, size_t size);
|
||||
extern int ubi_volume_read(char *volume, char *buf, size_t size);
|
||||
extern int ubi_volume_write(char *volume, void *buf, loff_t offset, size_t size);
|
||||
extern int ubi_volume_read(char *volume, char *buf, loff_t offset, size_t size);
|
||||
+extern int ubi_create_vol(char *volume, int64_t size, int dynamic, int vol_id,
|
||||
+ bool skipcheck);
|
||||
+extern struct ubi_volume *ubi_find_volume(char *volume);
|
||||
|
@ -12,7 +12,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
--- a/cmd/ubi.c
|
||||
+++ b/cmd/ubi.c
|
||||
@@ -226,7 +226,11 @@ int ubi_create_vol(char *volume, int64_t
|
||||
@@ -225,7 +225,11 @@ int ubi_create_vol(char *volume, int64_t
|
||||
|
||||
req.vol_id = vol_id;
|
||||
req.alignment = 1;
|
||||
|
@ -29,7 +29,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
depends on ENV_IS_IN_UBI
|
||||
--- a/env/ubi.c
|
||||
+++ b/env/ubi.c
|
||||
@@ -106,6 +106,18 @@ static int env_ubi_save(void)
|
||||
@@ -105,6 +105,18 @@ static int env_ubi_save(void)
|
||||
#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */
|
||||
#endif /* CONFIG_CMD_SAVEENV */
|
||||
|
||||
@ -48,7 +48,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
|
||||
static int env_ubi_load(void)
|
||||
{
|
||||
@@ -135,6 +147,11 @@ static int env_ubi_load(void)
|
||||
@@ -134,6 +146,10 @@ static int env_ubi_load(void)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@ -56,17 +56,16 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ env_ubi_volume_create(CONFIG_ENV_UBI_VOLUME);
|
||||
+ env_ubi_volume_create(CONFIG_ENV_UBI_VOLUME_REDUND);
|
||||
+ }
|
||||
+
|
||||
read1_fail = ubi_volume_read(CONFIG_ENV_UBI_VOLUME, (void *)tmp_env1,
|
||||
read1_fail = ubi_volume_read(CONFIG_ENV_UBI_VOLUME, (void *)tmp_env1, 0,
|
||||
CONFIG_ENV_SIZE);
|
||||
if (read1_fail)
|
||||
@@ -172,6 +189,9 @@ static int env_ubi_load(void)
|
||||
@@ -171,6 +187,9 @@ static int env_ubi_load(void)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
+ if (IS_ENABLED(CONFIG_ENV_UBI_VOLUME_CREATE))
|
||||
+ env_ubi_volume_create(CONFIG_ENV_UBI_VOLUME);
|
||||
+
|
||||
if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME, buf, CONFIG_ENV_SIZE)) {
|
||||
if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME, buf, 0, CONFIG_ENV_SIZE)) {
|
||||
printf("\n** Unable to read env from %s:%s **\n",
|
||||
CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
|
||||
|
@ -12,7 +12,7 @@ Subject: [PATCH] board: mediatek: wire-up NMBM support
|
||||
|
||||
--- a/board/mediatek/mt7622/mt7622_rfb.c
|
||||
+++ b/board/mediatek/mt7622/mt7622_rfb.c
|
||||
@@ -10,6 +10,11 @@
|
||||
@@ -9,6 +9,11 @@
|
||||
#include <init.h>
|
||||
#include <asm/global_data.h>
|
||||
|
||||
@ -24,7 +24,7 @@ Subject: [PATCH] board: mediatek: wire-up NMBM support
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int board_init(void)
|
||||
@@ -23,3 +28,36 @@ int board_late_init(void)
|
||||
@@ -22,3 +27,36 @@ int board_late_init(void)
|
||||
env_relocate();
|
||||
return 0;
|
||||
}
|
||||
@ -64,7 +64,7 @@ Subject: [PATCH] board: mediatek: wire-up NMBM support
|
||||
--- a/board/mediatek/mt7629/mt7629_rfb.c
|
||||
+++ b/board/mediatek/mt7629/mt7629_rfb.c
|
||||
@@ -6,6 +6,11 @@
|
||||
#include <common.h>
|
||||
#include <config.h>
|
||||
#include <asm/global_data.h>
|
||||
|
||||
+#include <mtd.h>
|
||||
@ -114,11 +114,10 @@ Subject: [PATCH] board: mediatek: wire-up NMBM support
|
||||
+}
|
||||
--- a/board/mediatek/mt7981/mt7981_rfb.c
|
||||
+++ b/board/mediatek/mt7981/mt7981_rfb.c
|
||||
@@ -4,7 +4,58 @@
|
||||
@@ -4,7 +4,57 @@
|
||||
* Author: Sam Shih <sam.shih@mediatek.com>
|
||||
*/
|
||||
|
||||
+#include <common.h>
|
||||
+#include <config.h>
|
||||
+#include <env.h>
|
||||
+#include <init.h>
|
||||
@ -175,11 +174,10 @@ Subject: [PATCH] board: mediatek: wire-up NMBM support
|
||||
+}
|
||||
--- a/board/mediatek/mt7986/mt7986_rfb.c
|
||||
+++ b/board/mediatek/mt7986/mt7986_rfb.c
|
||||
@@ -4,7 +4,60 @@
|
||||
@@ -4,7 +4,59 @@
|
||||
* Author: Sam Shih <sam.shih@mediatek.com>
|
||||
*/
|
||||
|
||||
+#include <common.h>
|
||||
+#include <config.h>
|
||||
+#include <env.h>
|
||||
+#include <init.h>
|
||||
|
@ -58,7 +58,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -77,6 +77,37 @@ config PHY_ADIN
|
||||
@@ -83,6 +83,37 @@ config PHY_ADIN
|
||||
help
|
||||
Add support for configuring RGMII on Analog Devices ADIN PHYs.
|
||||
|
||||
@ -122,7 +122,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+
|
||||
+/* INCLUDE FILE DECLARATIONS
|
||||
+ */
|
||||
+#include <common.h>
|
||||
+#include <config.h>
|
||||
+#include <phy.h>
|
||||
+#include <errno.h>
|
||||
+#include <version.h>
|
||||
@ -1028,7 +1028,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+
|
||||
+/* INCLUDE FILE DECLARATIONS
|
||||
+*/
|
||||
+#include <common.h>
|
||||
+#include <config.h>
|
||||
+#include <eth_phy.h>
|
||||
+#include <phy.h>
|
||||
+#include <errno.h>
|
||||
@ -1421,7 +1421,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ }
|
||||
+
|
||||
+#ifdef CONFIG_PHY_AIROHA_FW_IN_UBI
|
||||
+ ret = ubi_volume_read("en8811h-fw", firmware_buf, EN8811H_MD32_DM_SIZE + EN8811H_MD32_DSP_SIZE);
|
||||
+ ret = ubi_volume_read("en8811h-fw", firmware_buf, 0, EN8811H_MD32_DM_SIZE + EN8811H_MD32_DSP_SIZE);
|
||||
+ if (ret) {
|
||||
+ printf("[Airoha] read firmware from UBI failed.\n");
|
||||
+ free(firmware_buf);
|
||||
@ -1909,7 +1909,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+
|
||||
--- a/drivers/net/eth-phy-uclass.c
|
||||
+++ b/drivers/net/eth-phy-uclass.c
|
||||
@@ -155,7 +155,7 @@ static int eth_phy_of_to_plat(struct ude
|
||||
@@ -154,7 +154,7 @@ static int eth_phy_of_to_plat(struct ude
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/cmd/bootm.c
|
||||
+++ b/cmd/bootm.c
|
||||
@@ -262,6 +262,67 @@ U_BOOT_CMD(
|
||||
@@ -260,6 +260,67 @@ U_BOOT_CMD(
|
||||
/* iminfo - print header info for a requested image */
|
||||
/*******************************************************************/
|
||||
#if defined(CONFIG_CMD_IMI)
|
||||
@ -70,7 +70,7 @@
|
||||
{
|
||||
--- a/boot/image-fit.c
|
||||
+++ b/boot/image-fit.c
|
||||
@@ -2051,6 +2051,47 @@ static const char *fit_get_image_type_pr
|
||||
@@ -2046,6 +2046,47 @@ static const char *fit_get_image_type_pr
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@
|
||||
int arch, int ph_type, int bootstage_id,
|
||||
--- a/include/image.h
|
||||
+++ b/include/image.h
|
||||
@@ -1123,6 +1123,7 @@ int fit_parse_subimage(const char *spec,
|
||||
@@ -1124,6 +1124,7 @@ int fit_parse_subimage(const char *spec,
|
||||
ulong *addr, const char **image_name);
|
||||
|
||||
int fit_get_subimage_count(const void *fit, int images_noffset);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/cmd/bootmenu.c
|
||||
+++ b/cmd/bootmenu.c
|
||||
@@ -452,7 +452,11 @@ static void menu_display_statusline(stru
|
||||
@@ -451,7 +451,11 @@ static void menu_display_statusline(stru
|
||||
printf(ANSI_CURSOR_POSITION, 1, 1);
|
||||
puts(ANSI_CLEAR_LINE);
|
||||
printf(ANSI_CURSOR_POSITION, 2, 3);
|
||||
@ -13,7 +13,7 @@
|
||||
puts(ANSI_CLEAR_LINE_TO_END);
|
||||
printf(ANSI_CURSOR_POSITION, 3, 1);
|
||||
puts(ANSI_CLEAR_LINE);
|
||||
@@ -537,6 +541,7 @@ static enum bootmenu_ret bootmenu_show(i
|
||||
@@ -536,6 +540,7 @@ static enum bootmenu_ret bootmenu_show(i
|
||||
return BOOTMENU_RET_FAIL;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/cmd/Kconfig
|
||||
+++ b/cmd/Kconfig
|
||||
@@ -676,6 +676,12 @@ config CMD_ENV_EXISTS
|
||||
@@ -683,6 +683,12 @@ config CMD_ENV_EXISTS
|
||||
Check if a variable is defined in the environment for use in
|
||||
shell scripting.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/drivers/mmc/mmc_write.c
|
||||
+++ b/drivers/mmc/mmc_write.c
|
||||
@@ -80,7 +80,7 @@ ulong mmc_berase(struct blk_desc *block_
|
||||
@@ -79,7 +79,7 @@ ulong mmc_berase(struct blk_desc *block_
|
||||
u32 start_rem, blkcnt_rem, erase_args = 0;
|
||||
struct mmc *mmc = find_mmc_device(dev_num);
|
||||
lbaint_t blk = 0, blk_r = 0;
|
||||
|
@ -16,7 +16,7 @@ Reviewed-by: Tom Rini <trini@konsulko.com>
|
||||
|
||||
--- a/boot/image-fdt.c
|
||||
+++ b/boot/image-fdt.c
|
||||
@@ -618,6 +618,12 @@ int image_setup_libfdt(struct bootm_head
|
||||
@@ -617,6 +617,12 @@ int image_setup_libfdt(struct bootm_head
|
||||
images->fit_uname_cfg,
|
||||
strlen(images->fit_uname_cfg) + 1, 1);
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
+++ b/board/mediatek/mt7623/mt7623_rfb.c
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <config.h>
|
||||
#include <mmc.h>
|
||||
+#include <part.h>
|
||||
#include <asm/global_data.h>
|
||||
|
@ -1,8 +1,8 @@
|
||||
--- a/board/mediatek/mt7622/mt7622_rfb.c
|
||||
+++ b/board/mediatek/mt7622/mt7622_rfb.c
|
||||
@@ -6,9 +6,16 @@
|
||||
@@ -5,9 +5,16 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <config.h>
|
||||
+#include <dm.h>
|
||||
+#include <button.h>
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
#include <mtd.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
@@ -24,7 +31,22 @@ int board_init(void)
|
||||
@@ -23,7 +30,22 @@ int board_init(void)
|
||||
|
||||
int board_late_init(void)
|
||||
{
|
||||
@ -43,7 +43,7 @@
|
||||
}
|
||||
--- a/arch/arm/mach-mediatek/Kconfig
|
||||
+++ b/arch/arm/mach-mediatek/Kconfig
|
||||
@@ -154,4 +154,11 @@ config MTK_BROM_HEADER_INFO
|
||||
@@ -155,4 +155,11 @@ config MTK_BROM_HEADER_INFO
|
||||
|
||||
source "board/mediatek/mt7629/Kconfig"
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
@@ -4,9 +4,18 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <config.h>
|
||||
+#include <dm.h>
|
||||
+#include <button.h>
|
||||
+#include <env.h>
|
||||
|
@ -1,8 +1,8 @@
|
||||
--- a/board/mediatek/mt7986/mt7986_rfb.c
|
||||
+++ b/board/mediatek/mt7986/mt7986_rfb.c
|
||||
@@ -6,9 +6,16 @@
|
||||
@@ -5,9 +5,16 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <config.h>
|
||||
+#include <dm.h>
|
||||
+#include <button.h>
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
#include <mtd.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
@@ -24,7 +31,22 @@ int board_init(void)
|
||||
@@ -23,7 +30,22 @@ int board_init(void)
|
||||
|
||||
int board_late_init(void)
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
--- a/board/mediatek/mt7981/mt7981_rfb.c
|
||||
+++ b/board/mediatek/mt7981/mt7981_rfb.c
|
||||
@@ -6,9 +6,16 @@
|
||||
@@ -5,9 +5,16 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <config.h>
|
||||
+#include <dm.h>
|
||||
+#include <button.h>
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
#include <mtd.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
@@ -24,7 +31,22 @@ int board_init(void)
|
||||
@@ -23,7 +30,22 @@ int board_init(void)
|
||||
|
||||
int board_late_init(void)
|
||||
{
|
||||
|
@ -1,10 +1,9 @@
|
||||
--- a/board/mediatek/mt7988/mt7988_rfb.c
|
||||
+++ b/board/mediatek/mt7988/mt7988_rfb.c
|
||||
@@ -4,7 +4,43 @@
|
||||
@@ -4,7 +4,42 @@
|
||||
* Author: Sam Shih <sam.shih@mediatek.com>
|
||||
*/
|
||||
|
||||
+#include <common.h>
|
||||
+#include <config.h>
|
||||
+#include <dm.h>
|
||||
+#include <button.h>
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/board/mediatek/mt7988/mt7988_rfb.c
|
||||
+++ b/board/mediatek/mt7988/mt7988_rfb.c
|
||||
@@ -11,7 +11,9 @@
|
||||
@@ -10,7 +10,9 @@
|
||||
#include <env.h>
|
||||
#include <init.h>
|
||||
#include <asm/global_data.h>
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
#ifndef CONFIG_RESET_BUTTON_LABEL
|
||||
#define CONFIG_RESET_BUTTON_LABEL "reset"
|
||||
@@ -44,3 +46,54 @@ int board_late_init(void)
|
||||
@@ -43,3 +45,54 @@ int board_late_init(void)
|
||||
env_relocate();
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/board/mediatek/mt7986/mt7986_rfb.c
|
||||
+++ b/board/mediatek/mt7986/mt7986_rfb.c
|
||||
@@ -11,7 +11,9 @@
|
||||
@@ -10,7 +10,9 @@
|
||||
#include <env.h>
|
||||
#include <init.h>
|
||||
#include <asm/global_data.h>
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
#ifndef CONFIG_RESET_BUTTON_LABEL
|
||||
#define CONFIG_RESET_BUTTON_LABEL "reset"
|
||||
@@ -83,3 +85,54 @@ int board_nmbm_init(void)
|
||||
@@ -82,3 +84,54 @@ int board_nmbm_init(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/board/mediatek/mt7622/mt7622_rfb.c
|
||||
+++ b/board/mediatek/mt7622/mt7622_rfb.c
|
||||
@@ -11,7 +11,9 @@
|
||||
@@ -10,7 +10,9 @@
|
||||
#include <env.h>
|
||||
#include <init.h>
|
||||
#include <asm/global_data.h>
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
#ifndef CONFIG_RESET_BUTTON_LABEL
|
||||
#define CONFIG_RESET_BUTTON_LABEL "reset"
|
||||
@@ -22,10 +24,43 @@
|
||||
@@ -21,10 +23,43 @@
|
||||
#include <nmbm/nmbm.h>
|
||||
#include <nmbm/nmbm-mtd.h>
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -83,3 +118,84 @@ int board_nmbm_init(void)
|
||||
@@ -82,3 +117,84 @@ int board_nmbm_init(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/board/mediatek/mt7981/mt7981_rfb.c
|
||||
+++ b/board/mediatek/mt7981/mt7981_rfb.c
|
||||
@@ -11,7 +11,9 @@
|
||||
@@ -10,7 +10,9 @@
|
||||
#include <env.h>
|
||||
#include <init.h>
|
||||
#include <asm/global_data.h>
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
#ifndef CONFIG_RESET_BUTTON_LABEL
|
||||
#define CONFIG_RESET_BUTTON_LABEL "reset"
|
||||
@@ -81,3 +83,54 @@ int board_nmbm_init(void)
|
||||
@@ -80,3 +82,54 @@ int board_nmbm_init(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -81,9 +81,9 @@
|
||||
+CONFIG_OF_SYSTEM_SETUP=y
|
||||
--- a/configs/mt7981_rfb_defconfig
|
||||
+++ b/configs/mt7981_rfb_defconfig
|
||||
@@ -134,3 +134,4 @@ CONFIG_DM_SPI=y
|
||||
CONFIG_MTK_SPIM=y
|
||||
@@ -135,3 +135,4 @@ CONFIG_MTK_SPIM=y
|
||||
CONFIG_HEXDUMP=y
|
||||
# CONFIG_EFI_LOADER is not set
|
||||
CONFIG_LMB_MAX_REGIONS=64
|
||||
+CONFIG_OF_SYSTEM_SETUP=y
|
||||
--- a/configs/mt7981_sd_rfb_defconfig
|
||||
|
@ -332,7 +332,7 @@
|
||||
+};
|
||||
--- a/arch/arm/dts/Makefile
|
||||
+++ b/arch/arm/dts/Makefile
|
||||
@@ -1222,6 +1222,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
|
||||
@@ -1187,6 +1187,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
|
||||
mt7622-rfb.dtb \
|
||||
mt7623a-unielec-u7623-02-emmc.dtb \
|
||||
mt7622-bananapi-bpi-r64.dtb \
|
||||
|
@ -739,7 +739,7 @@
|
||||
+};
|
||||
--- a/arch/arm/dts/Makefile
|
||||
+++ b/arch/arm/dts/Makefile
|
||||
@@ -1223,6 +1223,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
|
||||
@@ -1188,6 +1188,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
|
||||
mt7623a-unielec-u7623-02-emmc.dtb \
|
||||
mt7622-bananapi-bpi-r64.dtb \
|
||||
mt7622-linksys-e8450-ubi.dtb \
|
||||
@ -917,7 +917,7 @@
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
@@ -397,6 +398,20 @@ static int initr_onenand(void)
|
||||
@@ -396,6 +397,20 @@ static int initr_onenand(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -938,7 +938,7 @@
|
||||
#ifdef CONFIG_MMC
|
||||
static int initr_mmc(void)
|
||||
{
|
||||
@@ -681,6 +696,9 @@ static init_fnc_t init_sequence_r[] = {
|
||||
@@ -680,6 +695,9 @@ static init_fnc_t init_sequence_r[] = {
|
||||
#ifdef CONFIG_NMBM_MTD
|
||||
initr_nmbm,
|
||||
#endif
|
||||
|
@ -149,7 +149,7 @@
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7986a_bpi-r3-mini-snand_defconfig
|
||||
@@ -0,0 +1,139 @@
|
||||
@@ -0,0 +1,140 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
@ -256,6 +256,7 @@
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_AIROHA=y
|
||||
+CONFIG_PHY_AIROHA_EN8811H=y
|
||||
+CONFIG_PHY_AIROHA_FW_IN_UBI=y
|
||||
+CONFIG_PHY_ETHERNET_ID=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_DM_MDIO=y
|
||||
|
@ -15,7 +15,7 @@ Subject: [PATCH] add xiaomi redmi ax6s
|
||||
|
||||
--- a/arch/arm/dts/Makefile
|
||||
+++ b/arch/arm/dts/Makefile
|
||||
@@ -1225,6 +1225,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
|
||||
@@ -1190,6 +1190,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
|
||||
mt7622-linksys-e8450-ubi.dtb \
|
||||
mt7622-ubnt-unifi-6-lr.dtb \
|
||||
mt7622-ubnt-unifi-6-lr-v3.dtb \
|
||||
|
@ -1,6 +1,3 @@
|
||||
diff --git a/arch/arm/dts/mt7981-glinet-gl-x3000.dts b/arch/arm/dts/mt7981-glinet-gl-x3000.dts
|
||||
new file mode 100644
|
||||
index 0000000..911a702
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7981-glinet-gl-x3000.dts
|
||||
@@ -0,0 +1,144 @@
|
||||
@ -148,9 +145,6 @@ index 0000000..911a702
|
||||
+&uart0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
diff --git a/configs/mt7981_glinet_gl-x3000_defconfig b/configs/mt7981_glinet_gl-x3000_defconfig
|
||||
new file mode 100644
|
||||
index 0000000..96ad96f
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7981_glinet_gl-x3000_defconfig
|
||||
@@ -0,0 +1,100 @@
|
||||
@ -254,9 +248,6 @@ index 0000000..96ad96f
|
||||
+# CONFIG_EFI_LOADER is not set
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
+# CONFIG_TOOLS_LIBCRYPTO is not set
|
||||
diff --git a/glinet_gl-x3000_env b/glinet_gl-x3000_env
|
||||
new file mode 100644
|
||||
index 0000000..e624e41
|
||||
--- /dev/null
|
||||
+++ b/glinet_gl-x3000_env
|
||||
@@ -0,0 +1,26 @@
|
||||
|
@ -8,12 +8,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=gdb
|
||||
PKG_VERSION:=14.1
|
||||
PKG_VERSION:=15.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@GNU/gdb
|
||||
PKG_HASH:=d66df51276143451fcbff464cc8723d68f1e9df45a6a2d5635a54e71643edb80
|
||||
PKG_HASH:=83350ccd35b5b5a0cba6b334c41294ea968158c573940904f00b92f76345314d
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
@ -1,16 +0,0 @@
|
||||
See http://sourceware.org/bugzilla/show_bug.cgi?id=14523
|
||||
|
||||
--- a/gdbsupport/signals.cc
|
||||
+++ b/gdbsupport/signals.cc
|
||||
@@ -348,6 +348,11 @@ gdb_signal_from_host (int hostsig)
|
||||
else if (64 <= hostsig && hostsig <= 127)
|
||||
return (enum gdb_signal)
|
||||
(hostsig - 64 + (int) GDB_SIGNAL_REALTIME_64);
|
||||
+ else if (hostsig == 128)
|
||||
+ /* Some platforms, such as Linux MIPS, have NSIG == 128, in which case
|
||||
+ signal 128 is the highest realtime signal. There is no constant for
|
||||
+ that though. */
|
||||
+ return GDB_SIGNAL_UNKNOWN;
|
||||
else
|
||||
error (_("GDB bug: target.c (gdb_signal_from_host): "
|
||||
"unrecognized real-time signal"));
|
@ -1,6 +1,6 @@
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1400,13 +1400,13 @@ if test -z "$LD"; then
|
||||
@@ -1401,13 +1401,13 @@ if test -z "$LD"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([
|
||||
#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
|
||||
@@ -1836,7 +1836,7 @@ AC_ARG_WITH(stage1-ldflags,
|
||||
@@ -1837,7 +1837,7 @@ AC_ARG_WITH(stage1-ldflags,
|
||||
# trust that they are doing what they want.
|
||||
if test "$with_static_standard_libraries" = yes -a "$stage1_libs" = "" \
|
||||
-a "$have_static_libs" = yes; then
|
||||
@ -26,18 +26,18 @@
|
||||
fi])
|
||||
AC_SUBST(stage1_ldflags)
|
||||
|
||||
@@ -1865,7 +1865,7 @@ AC_ARG_WITH(boot-ldflags,
|
||||
@@ -1866,7 +1866,7 @@ AC_ARG_WITH(boot-ldflags,
|
||||
# statically. But if the user explicitly specified the libraries to
|
||||
# use, trust that they are doing what they want.
|
||||
if test "$poststage1_libs" = ""; then
|
||||
- poststage1_ldflags="-static-libstdc++ -static-libgcc"
|
||||
+ poststage1_ldflags="-static-libstdc++"
|
||||
fi])
|
||||
AC_SUBST(poststage1_ldflags)
|
||||
|
||||
case $target in
|
||||
*-darwin2* | *-darwin1[[56789]]*)
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -5413,14 +5413,14 @@ if test -z "$LD"; then
|
||||
@@ -5414,14 +5414,14 @@ if test -z "$LD"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
@@ -8464,7 +8464,7 @@ else
|
||||
@@ -8465,7 +8465,7 @@ else
|
||||
# trust that they are doing what they want.
|
||||
if test "$with_static_standard_libraries" = yes -a "$stage1_libs" = "" \
|
||||
-a "$have_static_libs" = yes; then
|
||||
@ -65,7 +65,7 @@
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -8500,7 +8500,7 @@ else
|
||||
@@ -8501,7 +8501,7 @@ else
|
||||
# statically. But if the user explicitly specified the libraries to
|
||||
# use, trust that they are doing what they want.
|
||||
if test "$poststage1_libs" = ""; then
|
||||
|
@ -27,7 +27,7 @@ gdb/ChangeLog:
|
||||
|
||||
--- a/gdbsupport/signals-state-save-restore.cc
|
||||
+++ b/gdbsupport/signals-state-save-restore.cc
|
||||
@@ -38,7 +38,7 @@ save_original_signals_state (bool quiet)
|
||||
@@ -37,7 +37,7 @@ save_original_signals_state (bool quiet)
|
||||
int i;
|
||||
int res;
|
||||
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 63df98fa78c8a6e12b40ebdc5c155838d2bf8b5f Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Thu, 29 Nov 2018 18:00:23 -0800
|
||||
Subject: [PATCH 11/11] gdbserver ctrl-c handling
|
||||
|
||||
This problem was created by the upstream commit 78708b7c8c
|
||||
After applying the commit, it will send SIGINT to the process
|
||||
group(-signal_pid).
|
||||
But if we use gdbserver send SIGINT, and the attached process is not a
|
||||
process
|
||||
group leader, then the "kill (-signal_pid, SIGINT)" returns error and
|
||||
fails to
|
||||
interrupt the attached process.
|
||||
|
||||
Upstream-Status: Submitted
|
||||
[https://sourceware.org/bugzilla/show_bug.cgi?id=18945]
|
||||
|
||||
Author: Josh Gao
|
||||
Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
gdbserver/linux-low.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/gdbserver/linux-low.cc
|
||||
+++ b/gdbserver/linux-low.cc
|
||||
@@ -5481,7 +5481,7 @@ linux_process_target::request_interrupt
|
||||
{
|
||||
/* Send a SIGINT to the process group. This acts just like the user
|
||||
typed a ^C on the controlling terminal. */
|
||||
- int res = ::kill (-signal_pid, SIGINT);
|
||||
+ int res = ::kill (signal_pid, SIGINT);
|
||||
if (res == -1)
|
||||
warning (_("Sending SIGINT to process group of pid %ld failed: %s"),
|
||||
signal_pid, safe_strerror (errno));
|
@ -19,7 +19,7 @@ Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
|
||||
|
||||
--- a/gdb/mips-linux-nat.c
|
||||
+++ b/gdb/mips-linux-nat.c
|
||||
@@ -31,7 +31,7 @@
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "gdb_proc_service.h"
|
||||
#include "gregset.h"
|
||||
|
||||
|
@ -18,7 +18,7 @@ Upstream-Status: Pending
|
||||
|
||||
--- a/gdb/mips-linux-nat.c
|
||||
+++ b/gdb/mips-linux-nat.c
|
||||
@@ -42,6 +42,11 @@
|
||||
@@ -41,6 +41,11 @@
|
||||
#define PTRACE_GET_THREAD_AREA 25
|
||||
#endif
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wireless-regdb
|
||||
PKG_VERSION:=2024.07.04
|
||||
PKG_VERSION:=2024.10.07
|
||||
PKG_RELEASE:=1
|
||||
PKG_LICENSE:=ISC
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@KERNEL/software/network/wireless-regdb/
|
||||
PKG_HASH:=9832a14e1be24abff7be30dee3c9a1afb5fdfcf475a0d91aafef039f8d85f5eb
|
||||
PKG_HASH:=f76f2bd79a653e9f9dd50548d99d03a4a4eb157da056dfd5892f403ec28fb3d5
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
|
@ -560,6 +560,7 @@ define KernelPackage/dsa-mv88e6xxx
|
||||
TITLE:=Marvell MV88E6XXX DSA Switch
|
||||
DEPENDS:=+kmod-dsa +kmod-ptp +kmod-phy-marvell +kmod-dsa-tag-dsa
|
||||
KCONFIG:=CONFIG_NET_DSA_MV88E6XXX \
|
||||
CONFIG_NET_DSA_MV88E6XXX_LEDS=y \
|
||||
CONFIG_NET_DSA_MV88E6XXX_PTP=y
|
||||
FILES:=$(LINUX_DIR)/drivers/net/dsa/mv88e6xxx/mv88e6xxx.ko
|
||||
AUTOLOAD:=$(call AutoLoad,41,mv88e6xxx,1)
|
||||
|
@ -9,28 +9,38 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=ppp
|
||||
PKG_RELEASE:=9
|
||||
PKG_VERSION:=2.5.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
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:=58b415e17bdcac81bb9594a1b2ba65ec90598817850d22e98c1690e8ed0cd3d8
|
||||
PKG_SOURCE_URL:=https://github.com/ppp-project/ppp
|
||||
PKG_SOURCE_DATE:=2024-09-18
|
||||
PKG_SOURCE_VERSION:=d5aeec65752d4a9b3bb46771d0b221c4a4a6539e
|
||||
PKG_MIRROR_HASH:=b98125933d8160ff3476b053414e787e65a94948c0ecee53f6261cd403ff4b03
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_LICENSE:=BSD-4-Clause
|
||||
PKG_CPE_ID:=cpe:/a:samba:ppp
|
||||
|
||||
PKG_RELEASE_VERSION:=2.4.9
|
||||
PKG_VERSION:=$(PKG_RELEASE_VERSION)_git$(subst -,,$(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_VARS += \
|
||||
enable_eaptls=no \
|
||||
enable_microsoft_extensions=yes \
|
||||
enable_peap=no
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
with_openssl=no \
|
||||
with_pam=no \
|
||||
with_pcap=no \
|
||||
with_srp=no \
|
||||
with_static_pcap=yes
|
||||
|
||||
define Package/ppp/Default
|
||||
SECTION:=net
|
||||
@ -174,51 +184,23 @@ 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
|
||||
|
||||
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_VARS += \
|
||||
enable_multilink=yes
|
||||
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/
|
||||
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/
|
||||
@ -233,21 +215,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
|
||||
@ -258,43 +240,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))
|
||||
|
@ -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 <jo@mein.io>
|
||||
|
||||
--- 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
|
@ -0,0 +1,45 @@
|
||||
From: Shiji Yang <yangshiji66@outlook.com>
|
||||
Date: Fri, 4 Oct 2024 12:19:42 +0000
|
||||
Subject: [PATCH] pppd/crypto: fix build without openssl
|
||||
|
||||
Compile openssl relevant code only when PPP_WITH_OPENSSL is defined.
|
||||
|
||||
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
|
||||
---
|
||||
pppd/crypto.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/pppd/crypto.c
|
||||
+++ b/pppd/crypto.c
|
||||
@@ -199,6 +199,7 @@ int PPP_crypto_init()
|
||||
{
|
||||
int retval = 0;
|
||||
|
||||
+#ifdef PPP_WITH_OPENSSL
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
g_crypto_ctx.legacy = OSSL_PROVIDER_load(NULL, "legacy");
|
||||
if (g_crypto_ctx.legacy == NULL)
|
||||
@@ -214,6 +215,7 @@ int PPP_crypto_init()
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
retval = 1;
|
||||
|
||||
@@ -224,6 +226,7 @@ done:
|
||||
|
||||
int PPP_crypto_deinit()
|
||||
{
|
||||
+#ifdef PPP_WITH_OPENSSL
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
if (g_crypto_ctx.legacy) {
|
||||
OSSL_PROVIDER_unload(g_crypto_ctx.legacy);
|
||||
@@ -239,6 +242,7 @@ int PPP_crypto_deinit()
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
ERR_free_strings();
|
||||
#endif
|
||||
+#endif
|
||||
return 1;
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
From: Shiji Yang <yangshiji66@outlook.com>
|
||||
Date: Fri, 4 Oct 2024 14:02:14 +0000
|
||||
Subject: [PATCH] pppd: make pid directory before create the pid file
|
||||
|
||||
If multilink feature is not enabled, the '/var/run/pppd' directory
|
||||
won't be created before adding pid file.
|
||||
|
||||
Fixes error message:
|
||||
'Failed to create pid file /var/run/pppd/pppoe-wan.pid: No such file or directory'
|
||||
|
||||
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
|
||||
---
|
||||
pppd/main.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/pppd/main.c
|
||||
+++ b/pppd/main.c
|
||||
@@ -921,6 +921,9 @@ create_pidfile(int pid)
|
||||
{
|
||||
FILE *pidfile;
|
||||
|
||||
+#ifndef PPP_WITH_TDB
|
||||
+ mkdir_recursive(PPP_PATH_VARRUN);
|
||||
+#endif
|
||||
slprintf(pidfilename, sizeof(pidfilename), "%s/%s.pid",
|
||||
PPP_PATH_VARRUN, ifname);
|
||||
if ((pidfile = fopen(pidfilename, "w")) != NULL) {
|
@ -0,0 +1,42 @@
|
||||
From: Tan Zien <nabsdh9@gmail.com>
|
||||
Date: Tue, 1 Oct 2024 10:38:45 +0800
|
||||
Subject: [PATCH] pppd/crypto: fix gcc 14 build
|
||||
|
||||
fix this:
|
||||
|
||||
crypto.c: In function 'PPP_crypto_error':
|
||||
crypto.c:178:11: error: implicit declaration of function 'vsnprintf' [-Wimplicit-function-declaration]
|
||||
178 | off = vsnprintf(buf, len, fmt, args);
|
||||
| ^~~~~~~~~
|
||||
crypto.c:41:1: note: include '<stdio.h>' or provide a declaration of 'vsnprintf'
|
||||
40 | #include "crypto-priv.h"
|
||||
+++ |+#include <stdio.h>
|
||||
41 |
|
||||
crypto.c:178:26: warning: 'vsnprintf' argument 2 type is 'int' where 'long unsigned int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
|
||||
178 | off = vsnprintf(buf, len, fmt, args);
|
||||
| ^~~
|
||||
<built-in>: note: built-in 'vsnprintf' declared here
|
||||
|
||||
Signed-off-by: Tan Zien <nabsdh9@gmail.com>
|
||||
---
|
||||
pppd/crypto.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/pppd/crypto.c
|
||||
+++ b/pppd/crypto.c
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
+#include <stdio.h>
|
||||
|
||||
#include "pppd.h"
|
||||
#include "crypto.h"
|
||||
@@ -247,7 +248,6 @@ int PPP_crypto_deinit()
|
||||
}
|
||||
|
||||
#ifdef UNIT_TEST
|
||||
-#include <stdio.h>
|
||||
|
||||
int debug;
|
||||
int error_count;
|
@ -1,6 +1,6 @@
|
||||
--- a/pppd/demand.c
|
||||
+++ b/pppd/demand.c
|
||||
@@ -36,6 +36,8 @@
|
||||
@@ -40,6 +40,8 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <netdb.h>
|
||||
@ -9,16 +9,16 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -43,6 +45,8 @@
|
||||
@@ -47,6 +49,8 @@
|
||||
#include <sys/resource.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
+#include <netinet/in.h>
|
||||
+#include <arpa/inet.h>
|
||||
#ifdef PPP_FILTER
|
||||
#ifdef PPP_WITH_FILTER
|
||||
#include <pcap-bpf.h>
|
||||
#endif
|
||||
@@ -218,6 +222,14 @@ loop_chars(unsigned char *p, int n)
|
||||
@@ -223,6 +227,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
|
||||
@@ -299,16 +311,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
|
||||
@@ -368,7 +368,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? */
|
||||
|
||||
|
@ -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 <jo@mein.io>
|
||||
|
||||
--- 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 */
|
@ -1,11 +0,0 @@
|
||||
--- a/pppd/sha1.c
|
||||
+++ b/pppd/sha1.c
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <netinet/in.h> /* htonl() */
|
||||
-#include <net/ppp_defs.h>
|
||||
+#include "pppd.h"
|
||||
#include "sha1.h"
|
||||
|
||||
static void
|
@ -1,54 +0,0 @@
|
||||
From 98ec18f098e5ef68e3a8cc6954fcaf5a7fb8b7be Mon Sep 17 00:00:00 2001
|
||||
From: pali <7141871+pali@users.noreply.github.com>
|
||||
Date: Mon, 15 Feb 2021 07:54:01 +0100
|
||||
Subject: [PATCH] pppd: Fix compilation with older glibc or kernel headers
|
||||
(#248)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
glibc versions prior to 2.24 do not define SOL_NETLINK and linux kernel
|
||||
versions prior to 4.3 do not define NETLINK_CAP_ACK. So add fallback
|
||||
definitions for these macros into pppd/sys-linux.c file.
|
||||
|
||||
Also extend description why we call SOL_NETLINK/NETLINK_CAP_ACK option.
|
||||
|
||||
Signed-off-by: Pali Rohár <pali@kernel.org>
|
||||
---
|
||||
pppd/sys-linux.c | 18 +++++++++++++++++-
|
||||
1 file changed, 17 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/pppd/sys-linux.c
|
||||
+++ b/pppd/sys-linux.c
|
||||
@@ -125,6 +125,14 @@
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/if_addr.h>
|
||||
+/* glibc versions prior to 2.24 do not define SOL_NETLINK */
|
||||
+#ifndef SOL_NETLINK
|
||||
+#define SOL_NETLINK 270
|
||||
+#endif
|
||||
+/* linux kernel versions prior to 4.3 do not define/support NETLINK_CAP_ACK */
|
||||
+#ifndef NETLINK_CAP_ACK
|
||||
+#define NETLINK_CAP_ACK 10
|
||||
+#endif
|
||||
#endif
|
||||
|
||||
#include "pppd.h"
|
||||
@@ -2843,7 +2851,15 @@ static int append_peer_ipv6_address(unsi
|
||||
if (fd < 0)
|
||||
return 0;
|
||||
|
||||
- /* do not ask for error message content */
|
||||
+ /*
|
||||
+ * Tell kernel to not send to us payload of acknowledgment error message.
|
||||
+ * NETLINK_CAP_ACK option is supported since Linux kernel version 4.3 and
|
||||
+ * older kernel versions always send full payload in acknowledgment netlink
|
||||
+ * message. We ignore payload of this message as we need only error code,
|
||||
+ * to check if our set remote peer address request succeeded or failed.
|
||||
+ * So ignore return value from the following setsockopt() call as setting
|
||||
+ * option NETLINK_CAP_ACK means for us just a kernel hint / optimization.
|
||||
+ */
|
||||
one = 1;
|
||||
setsockopt(fd, SOL_NETLINK, NETLINK_CAP_ACK, &one, sizeof(one));
|
||||
|
@ -1,518 +0,0 @@
|
||||
From 81ad945630120cc1c27c8bb00503be42b76ff202 Mon Sep 17 00:00:00 2001
|
||||
From: Jaco Kroon <jaco@uls.co.za>
|
||||
Date: Thu, 13 Jan 2022 08:38:04 +0200
|
||||
Subject: [PATCH] Expand byte count statistics to 64 bits (#298)
|
||||
|
||||
* Add Gigawords to radius packets where applicable.
|
||||
|
||||
IMPORTANT NOTE: The ioctl() only supports 32-bit counters. In order t
|
||||
obtain 64-bit counters, these are now pulled in from sysfs (it's assumed
|
||||
to be mounted on /sys which I'm assuming is standard).
|
||||
|
||||
It is unknown whether sysfs will be available everywhere, as such, keep
|
||||
the ioctl() method in place, but attempt to detect wrap-overs.
|
||||
|
||||
If the sysfs mechanism fails, fail back to the ioctl().
|
||||
|
||||
Given maximum data rates, the intervals between calling this needs to be
|
||||
such that no more than 4GB (2^32) bytes are sent or received in any
|
||||
given interval. Mostly important for radius plugin where data
|
||||
accounting may be in effect.
|
||||
|
||||
Towards this, a timer interval on 25 seconds is set to force a ioctl()
|
||||
poll irrespective of the rate of stats update calls. This may be
|
||||
important for especially radius that needs to provide interim-update
|
||||
intervals, if the interim updates is too long and the counters could
|
||||
wrap-over twice in a single interval. At 25 seconds we should detect
|
||||
all wraps up to an effective data rate of 1.37Gbps, which for my
|
||||
purposes is adequate.
|
||||
|
||||
Possible downsides, 4 files are opened, read and closed every time
|
||||
statistics is requested. This results in 12 system calls every single
|
||||
time statistics is required, compared to 1 for the ioctl. Efficiency is
|
||||
unknown, but as a rule of thumb fewer system calls are better, this is
|
||||
however not a critical path in my opinion, so should not be a problem.
|
||||
If required I can run a few benchmarks using gettimeofday() to measure
|
||||
actual impact.
|
||||
|
||||
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
|
||||
|
||||
* Use netlink if possible to obtain 64-bit stats.
|
||||
|
||||
This uses two system calls per round.
|
||||
|
||||
This should be preferred where available. It seems the RTM_GETSTATS was
|
||||
only added from 2016 some point (4.7.0 as per pali), which is in my
|
||||
opinion old, but given experience with certain embedded systems does
|
||||
need to be supported.
|
||||
|
||||
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
|
||||
|
||||
Co-authored-by: Jaco Kroon <jaco@iewc.co.za>
|
||||
---
|
||||
pppd/main.c | 5 +-
|
||||
pppd/plugins/radius/etc/dictionary | 2 +
|
||||
pppd/plugins/radius/radius.c | 28 ++-
|
||||
pppd/plugins/radius/radiusclient.h | 2 +
|
||||
pppd/pppd.h | 9 +-
|
||||
pppd/sys-linux.c | 281 ++++++++++++++++++++++++++++-
|
||||
6 files changed, 313 insertions(+), 14 deletions(-)
|
||||
|
||||
--- a/pppd/main.c
|
||||
+++ b/pppd/main.c
|
||||
@@ -87,6 +87,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
+#include <inttypes.h>
|
||||
|
||||
#include "pppd.h"
|
||||
#include "magic.h"
|
||||
@@ -1230,9 +1231,9 @@ update_link_stats(int u)
|
||||
|
||||
slprintf(numbuf, sizeof(numbuf), "%u", link_connect_time);
|
||||
script_setenv("CONNECT_TIME", numbuf, 0);
|
||||
- slprintf(numbuf, sizeof(numbuf), "%u", link_stats.bytes_out);
|
||||
+ snprintf(numbuf, sizeof(numbuf), "%" PRIu64, link_stats.bytes_out);
|
||||
script_setenv("BYTES_SENT", numbuf, 0);
|
||||
- slprintf(numbuf, sizeof(numbuf), "%u", link_stats.bytes_in);
|
||||
+ snprintf(numbuf, sizeof(numbuf), "%" PRIu64, link_stats.bytes_in);
|
||||
script_setenv("BYTES_RCVD", numbuf, 0);
|
||||
}
|
||||
|
||||
--- a/pppd/plugins/radius/etc/dictionary
|
||||
+++ b/pppd/plugins/radius/etc/dictionary
|
||||
@@ -82,6 +82,8 @@ ATTRIBUTE Acct-Session-Time 46 integer
|
||||
ATTRIBUTE Acct-Input-Packets 47 integer
|
||||
ATTRIBUTE Acct-Output-Packets 48 integer
|
||||
ATTRIBUTE Acct-Terminate-Cause 49 integer
|
||||
+ATTRIBUTE Acct-Input-Gigawords 52 integer
|
||||
+ATTRIBUTE Acct-Output-Gigawords 53 integer
|
||||
ATTRIBUTE Chap-Challenge 60 string
|
||||
ATTRIBUTE NAS-Port-Type 61 integer
|
||||
ATTRIBUTE Port-Limit 62 integer
|
||||
--- a/pppd/plugins/radius/radius.c
|
||||
+++ b/pppd/plugins/radius/radius.c
|
||||
@@ -1020,12 +1020,22 @@ radius_acct_stop(void)
|
||||
av_type = link_connect_time;
|
||||
rc_avpair_add(&send, PW_ACCT_SESSION_TIME, &av_type, 0, VENDOR_NONE);
|
||||
|
||||
- av_type = link_stats.bytes_out;
|
||||
+ av_type = link_stats.bytes_out & 0xFFFFFFFF;
|
||||
rc_avpair_add(&send, PW_ACCT_OUTPUT_OCTETS, &av_type, 0, VENDOR_NONE);
|
||||
|
||||
- av_type = link_stats.bytes_in;
|
||||
+ if (link_stats.bytes_out > 0xFFFFFFFF) {
|
||||
+ av_type = link_stats.bytes_out >> 32;
|
||||
+ rc_avpair_add(&send, PW_ACCT_OUTPUT_GIGAWORDS, &av_type, 0, VENDOR_NONE);
|
||||
+ }
|
||||
+
|
||||
+ av_type = link_stats.bytes_in & 0xFFFFFFFF;
|
||||
rc_avpair_add(&send, PW_ACCT_INPUT_OCTETS, &av_type, 0, VENDOR_NONE);
|
||||
|
||||
+ if (link_stats.bytes_in > 0xFFFFFFFF) {
|
||||
+ av_type = link_stats.bytes_in >> 32;
|
||||
+ rc_avpair_add(&send, PW_ACCT_INPUT_GIGAWORDS, &av_type, 0, VENDOR_NONE);
|
||||
+ }
|
||||
+
|
||||
av_type = link_stats.pkts_out;
|
||||
rc_avpair_add(&send, PW_ACCT_OUTPUT_PACKETS, &av_type, 0, VENDOR_NONE);
|
||||
|
||||
@@ -1172,12 +1182,22 @@ radius_acct_interim(void *ignored)
|
||||
av_type = link_connect_time;
|
||||
rc_avpair_add(&send, PW_ACCT_SESSION_TIME, &av_type, 0, VENDOR_NONE);
|
||||
|
||||
- av_type = link_stats.bytes_out;
|
||||
+ av_type = link_stats.bytes_out & 0xFFFFFFFF;
|
||||
rc_avpair_add(&send, PW_ACCT_OUTPUT_OCTETS, &av_type, 0, VENDOR_NONE);
|
||||
|
||||
- av_type = link_stats.bytes_in;
|
||||
+ if (link_stats.bytes_out > 0xFFFFFFFF) {
|
||||
+ av_type = link_stats.bytes_out >> 32;
|
||||
+ rc_avpair_add(&send, PW_ACCT_OUTPUT_GIGAWORDS, &av_type, 0, VENDOR_NONE);
|
||||
+ }
|
||||
+
|
||||
+ av_type = link_stats.bytes_in & 0xFFFFFFFF;
|
||||
rc_avpair_add(&send, PW_ACCT_INPUT_OCTETS, &av_type, 0, VENDOR_NONE);
|
||||
|
||||
+ if (link_stats.bytes_in > 0xFFFFFFFF) {
|
||||
+ av_type = link_stats.bytes_in >> 32;
|
||||
+ rc_avpair_add(&send, PW_ACCT_INPUT_GIGAWORDS, &av_type, 0, VENDOR_NONE);
|
||||
+ }
|
||||
+
|
||||
av_type = link_stats.pkts_out;
|
||||
rc_avpair_add(&send, PW_ACCT_OUTPUT_PACKETS, &av_type, 0, VENDOR_NONE);
|
||||
|
||||
--- a/pppd/plugins/radius/radiusclient.h
|
||||
+++ b/pppd/plugins/radius/radiusclient.h
|
||||
@@ -184,6 +184,8 @@ typedef struct pw_auth_hdr
|
||||
#define PW_ACCT_LINK_COUNT 51 /* integer */
|
||||
|
||||
/* From RFC 2869 */
|
||||
+#define PW_ACCT_INPUT_GIGAWORDS 52 /* integer */
|
||||
+#define PW_ACCT_OUTPUT_GIGAWORDS 53 /* integer */
|
||||
#define PW_ACCT_INTERIM_INTERVAL 85 /* integer */
|
||||
|
||||
/* Merit Experimental Extensions */
|
||||
--- a/pppd/pppd.h
|
||||
+++ b/pppd/pppd.h
|
||||
@@ -53,6 +53,7 @@
|
||||
#include <stdlib.h> /* for encrypt */
|
||||
#include <unistd.h> /* for setkey */
|
||||
#include <stdarg.h>
|
||||
+#include <stdint.h>
|
||||
#include <limits.h> /* for NGROUPS_MAX */
|
||||
#include <sys/param.h> /* for MAXPATHLEN and BSD4_4, if defined */
|
||||
#include <sys/types.h> /* for u_int32_t, if defined */
|
||||
@@ -173,8 +174,8 @@ struct permitted_ip {
|
||||
* pppd needs.
|
||||
*/
|
||||
struct pppd_stats {
|
||||
- unsigned int bytes_in;
|
||||
- unsigned int bytes_out;
|
||||
+ uint64_t bytes_in;
|
||||
+ uint64_t bytes_out;
|
||||
unsigned int pkts_in;
|
||||
unsigned int pkts_out;
|
||||
};
|
||||
@@ -347,7 +348,7 @@ extern char *max_tls_version;
|
||||
extern unsigned int maxoctets; /* Maximum octetes per session (in bytes) */
|
||||
extern int maxoctets_dir; /* Direction :
|
||||
0 - in+out (default)
|
||||
- 1 - in
|
||||
+ 1 - in
|
||||
2 - out
|
||||
3 - max(in,out) */
|
||||
extern int maxoctets_timeout; /* Timeout for check of octets limit */
|
||||
@@ -356,7 +357,7 @@ extern int maxoctets_timeout; /*
|
||||
#define PPP_OCTETS_DIRECTION_OUT 2
|
||||
#define PPP_OCTETS_DIRECTION_MAXOVERAL 3
|
||||
/* same as previos, but little different on RADIUS side */
|
||||
-#define PPP_OCTETS_DIRECTION_MAXSESSION 4
|
||||
+#define PPP_OCTETS_DIRECTION_MAXSESSION 4
|
||||
#endif
|
||||
|
||||
#ifdef PPP_FILTER
|
||||
--- a/pppd/sys-linux.c
|
||||
+++ b/pppd/sys-linux.c
|
||||
@@ -79,6 +79,7 @@
|
||||
#include <sys/sysmacros.h>
|
||||
|
||||
#include <errno.h>
|
||||
+#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
@@ -92,6 +93,7 @@
|
||||
#include <ctype.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
+#include <limits.h>
|
||||
|
||||
/* This is in netdevice.h. However, this compile will fail miserably if
|
||||
you attempt to include netdevice.h because it has so many references
|
||||
@@ -121,9 +123,19 @@
|
||||
#include <linux/ppp_defs.h>
|
||||
#include <linux/if_ppp.h>
|
||||
|
||||
-#ifdef INET6
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
+#include <linux/if_link.h>
|
||||
+/* Attempt at retaining compile-support with older than 4.7 kernels, or kernels
|
||||
+ * where RTM_NEWSTATS isn't defined for whatever reason.
|
||||
+ */
|
||||
+#ifndef RTM_NEWSTATS
|
||||
+#define RTM_NEWSTATS 92
|
||||
+#define RTM_GETSTATS 94
|
||||
+#define IFLA_STATS_LINK_64 1
|
||||
+#endif
|
||||
+
|
||||
+#ifdef INET6
|
||||
#include <linux/if_addr.h>
|
||||
/* glibc versions prior to 2.24 do not define SOL_NETLINK */
|
||||
#ifndef SOL_NETLINK
|
||||
@@ -1407,11 +1419,17 @@ get_idle_time(int u, struct ppp_idle *ip
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
- * get_ppp_stats - return statistics for the link.
|
||||
+ * get_ppp_stats_iocl - return statistics for the link, using the ioctl() method,
|
||||
+ * this only supports 32-bit counters, so need to count the wraps.
|
||||
*/
|
||||
-int
|
||||
-get_ppp_stats(int u, struct pppd_stats *stats)
|
||||
+static int
|
||||
+get_ppp_stats_ioctl(int u, struct pppd_stats *stats)
|
||||
{
|
||||
+ static u_int32_t previbytes = 0;
|
||||
+ static u_int32_t prevobytes = 0;
|
||||
+ static u_int32_t iwraps = 0;
|
||||
+ static u_int32_t owraps = 0;
|
||||
+
|
||||
struct ifpppstatsreq req;
|
||||
|
||||
memset (&req, 0, sizeof (req));
|
||||
@@ -1426,7 +1444,262 @@ get_ppp_stats(int u, struct pppd_stats *
|
||||
stats->bytes_out = req.stats.p.ppp_obytes;
|
||||
stats->pkts_in = req.stats.p.ppp_ipackets;
|
||||
stats->pkts_out = req.stats.p.ppp_opackets;
|
||||
+
|
||||
+ if (stats->bytes_in < previbytes)
|
||||
+ ++iwraps;
|
||||
+ if (stats->bytes_out < prevobytes)
|
||||
+ ++owraps;
|
||||
+
|
||||
+ previbytes = stats->bytes_in;
|
||||
+ prevobytes = stats->bytes_out;
|
||||
+
|
||||
+ stats->bytes_in += (uint64_t)iwraps << 32;
|
||||
+ stats->bytes_out += (uint64_t)owraps << 32;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+/********************************************************************
|
||||
+ * get_ppp_stats_rtnetlink - return statistics for the link, using rtnetlink
|
||||
+ * This provides native 64-bit counters.
|
||||
+ */
|
||||
+static int
|
||||
+get_ppp_stats_rtnetlink(int u, struct pppd_stats *stats)
|
||||
+{
|
||||
+ static int rtnl_fd = -1;
|
||||
+
|
||||
+ struct sockaddr_nl nladdr;
|
||||
+ struct {
|
||||
+ struct nlmsghdr nlh;
|
||||
+ struct if_stats_msg ifsm;
|
||||
+ } nlreq;
|
||||
+ struct nlresp {
|
||||
+ struct nlmsghdr nlh;
|
||||
+ union {
|
||||
+ struct {
|
||||
+ struct nlmsgerr nlerr;
|
||||
+ char __end_err[0];
|
||||
+ };
|
||||
+ struct {
|
||||
+ struct rtmsg rth;
|
||||
+ struct {
|
||||
+ /* We only case about these first fields from rtnl_link_stats64 */
|
||||
+ uint64_t rx_packets;
|
||||
+ uint64_t tx_packets;
|
||||
+ uint64_t rx_bytes;
|
||||
+ uint64_t tx_bytes;
|
||||
+ } stats;
|
||||
+ char __end_stats[0];
|
||||
+ };
|
||||
+ };
|
||||
+ } nlresp;
|
||||
+ ssize_t nlresplen;
|
||||
+ struct iovec iov;
|
||||
+ struct msghdr msg;
|
||||
+
|
||||
+ memset(&nladdr, 0, sizeof(nladdr));
|
||||
+ nladdr.nl_family = AF_NETLINK;
|
||||
+
|
||||
+ if (rtnl_fd < 0) {
|
||||
+ rtnl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
|
||||
+ if (rtnl_fd < 0) {
|
||||
+ error("get_ppp_stats_rtnetlink: error creating NETLINK socket: %m (line %d)", __LINE__);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (bind(rtnl_fd, (struct sockaddr *)&nladdr, sizeof(nladdr)) < 0) {
|
||||
+ error("get_ppp_stats_rtnetlink: bind(AF_NETLINK): %m (line %d)", __LINE__);
|
||||
+ goto err;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ memset(&nlreq, 0, sizeof(nlreq));
|
||||
+ nlreq.nlh.nlmsg_len = sizeof(nlreq);
|
||||
+ nlreq.nlh.nlmsg_type = RTM_GETSTATS;
|
||||
+ nlreq.nlh.nlmsg_flags = NLM_F_REQUEST;
|
||||
+
|
||||
+ nlreq.ifsm.ifindex = if_nametoindex(ifname);
|
||||
+ nlreq.ifsm.filter_mask = IFLA_STATS_LINK_64;
|
||||
+
|
||||
+ memset(&iov, 0, sizeof(iov));
|
||||
+ iov.iov_base = &nlreq;
|
||||
+ iov.iov_len = sizeof(nlreq);
|
||||
+
|
||||
+ memset(&msg, 0, sizeof(msg));
|
||||
+ msg.msg_name = &nladdr;
|
||||
+ msg.msg_namelen = sizeof(nladdr);
|
||||
+ msg.msg_iov = &iov;
|
||||
+ msg.msg_iovlen = 1;
|
||||
+
|
||||
+ if (sendmsg(rtnl_fd, &msg, 0) < 0) {
|
||||
+ error("get_ppp_stats_rtnetlink: sendmsg(RTM_GETSTATS): %m (line %d)", __LINE__);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ /* We just need to repoint to IOV ... everything else stays the same */
|
||||
+ iov.iov_base = &nlresp;
|
||||
+ iov.iov_len = sizeof(nlresp);
|
||||
+
|
||||
+ nlresplen = recvmsg(rtnl_fd, &msg, 0);
|
||||
+
|
||||
+ if (nlresplen < 0) {
|
||||
+ error("get_ppp_stats_rtnetlink: recvmsg(RTM_GETSTATS): %m (line %d)", __LINE__);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ if (nlresplen < sizeof(nlresp.nlh)) {
|
||||
+ error("get_ppp_stats_rtnetlink: Netlink response message was incomplete (line %d)", __LINE__);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ if (nlresp.nlh.nlmsg_type == NLMSG_ERROR) {
|
||||
+ if (nlresplen < offsetof(struct nlresp, __end_err)) {
|
||||
+ if (kernel_version >= KVERSION(4,7,0))
|
||||
+ error("get_ppp_stats_rtnetlink: Netlink responded with error: %s (line %d)", strerror(-nlresp.nlerr.error), __LINE__);
|
||||
+ } else {
|
||||
+ error("get_ppp_stats_rtnetlink: Netlink responded with an error message, but the nlmsgerr structure is incomplete (line %d).",
|
||||
+ __LINE__);
|
||||
+ }
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ if (nlresp.nlh.nlmsg_type != RTM_NEWSTATS) {
|
||||
+ error("get_ppp_stats_rtnetlink: Expected RTM_NEWSTATS response, found something else (mlmsg_type %d, line %d)",
|
||||
+ nlresp.nlh.nlmsg_type, __LINE__);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ if (nlresplen < offsetof(struct nlresp, __end_stats)) {
|
||||
+ error("get_ppp_stats_rtnetlink: Obtained an insufficiently sized rtnl_link_stats64 struct from the kernel (line %d).", __LINE__);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ stats->bytes_in = nlresp.stats.rx_bytes;
|
||||
+ stats->bytes_out = nlresp.stats.tx_bytes;
|
||||
+ stats->pkts_in = nlresp.stats.rx_packets;
|
||||
+ stats->pkts_out = nlresp.stats.tx_packets;
|
||||
+
|
||||
return 1;
|
||||
+err:
|
||||
+ close(rtnl_fd);
|
||||
+ rtnl_fd = -1;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/********************************************************************
|
||||
+ * get_ppp_stats_sysfs - return statistics for the link, using the files in sysfs,
|
||||
+ * this provides native 64-bit counters.
|
||||
+ */
|
||||
+static int
|
||||
+get_ppp_stats_sysfs(int u, struct pppd_stats *stats)
|
||||
+{
|
||||
+ char fname[PATH_MAX+1];
|
||||
+ char buf[21], *err; /* 2^64 < 10^20 */
|
||||
+ int blen, fd, rlen;
|
||||
+ unsigned long long val;
|
||||
+
|
||||
+ struct {
|
||||
+ const char* fname;
|
||||
+ void* ptr;
|
||||
+ unsigned size;
|
||||
+ } slist[] = {
|
||||
+#define statfield(fn, field) { .fname = #fn, .ptr = &stats->field, .size = sizeof(stats->field) }
|
||||
+ statfield(rx_bytes, bytes_in),
|
||||
+ statfield(tx_bytes, bytes_out),
|
||||
+ statfield(rx_packets, pkts_in),
|
||||
+ statfield(tx_packets, pkts_out),
|
||||
+#undef statfield
|
||||
+ };
|
||||
+
|
||||
+ blen = snprintf(fname, sizeof(fname), "/sys/class/net/%s/statistics/", ifname);
|
||||
+ if (blen >= sizeof(fname))
|
||||
+ return 0; /* ifname max 15, so this should be impossible */
|
||||
+
|
||||
+ for (int i = 0; i < sizeof(slist) / sizeof(*slist); ++i) {
|
||||
+ if (snprintf(fname + blen, sizeof(fname) - blen, "%s", slist[i].fname) >= sizeof(fname) - blen) {
|
||||
+ fname[blen] = 0;
|
||||
+ error("sysfs stats: filename %s/%s overflowed PATH_MAX", fname, slist[i].fname);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ fd = open(fname, O_RDONLY);
|
||||
+ if (fd < 0) {
|
||||
+ error("%s: %m", fname);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ rlen = read(fd, buf, sizeof(buf) - 1);
|
||||
+ close(fd);
|
||||
+ if (rlen < 0) {
|
||||
+ error("%s: %m", fname);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ /* trim trailing \n if present */
|
||||
+ while (rlen > 0 && buf[rlen-1] == '\n')
|
||||
+ rlen--;
|
||||
+ buf[rlen] = 0;
|
||||
+
|
||||
+ errno = 0;
|
||||
+ val = strtoull(buf, &err, 10);
|
||||
+ if (*buf < '0' || *buf > '9' || errno != 0 || *err) {
|
||||
+ error("string to number conversion error converting %s (from %s) for remaining string %s%s%s",
|
||||
+ buf, fname, err, errno ? ": " : "", errno ? strerror(errno) : "");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ switch (slist[i].size) {
|
||||
+#define stattype(type) case sizeof(type): *(type*)slist[i].ptr = (type)val; break
|
||||
+ stattype(uint64_t);
|
||||
+ stattype(uint32_t);
|
||||
+ stattype(uint16_t);
|
||||
+ stattype(uint8_t);
|
||||
+#undef stattype
|
||||
+ default:
|
||||
+ error("Don't know how to store stats for %s of size %u", slist[i].fname, slist[i].size);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+/********************************************************************
|
||||
+ * Periodic timer function to be used to keep stats up to date in case of ioctl
|
||||
+ * polling.
|
||||
+ *
|
||||
+ * Given the 25s interval this should be fine up to data rates of 1.37Gbps.
|
||||
+ * If you do change the timer, remember to also bring the get_ppp_stats (which
|
||||
+ * sets up the initial trigger) as well.
|
||||
+ */
|
||||
+static void
|
||||
+ppp_stats_poller(void* u)
|
||||
+{
|
||||
+ struct pppd_stats dummy;
|
||||
+ get_ppp_stats_ioctl((long)u, &dummy);
|
||||
+ TIMEOUT(ppp_stats_poller, u, 25);
|
||||
+}
|
||||
+
|
||||
+/********************************************************************
|
||||
+ * get_ppp_stats - return statistics for the link.
|
||||
+ */
|
||||
+int get_ppp_stats(int u, struct pppd_stats *stats)
|
||||
+{
|
||||
+ static int (*func)(int, struct pppd_stats*) = NULL;
|
||||
+
|
||||
+ if (!func) {
|
||||
+ if (get_ppp_stats_rtnetlink(u, stats)) {
|
||||
+ func = get_ppp_stats_rtnetlink;
|
||||
+ return 1;
|
||||
+ }
|
||||
+ if (get_ppp_stats_sysfs(u, stats)) {
|
||||
+ func = get_ppp_stats_sysfs;
|
||||
+ return 1;
|
||||
+ }
|
||||
+ warn("statistics falling back to ioctl which only supports 32-bit counters");
|
||||
+ func = get_ppp_stats_ioctl;
|
||||
+ TIMEOUT(ppp_stats_poller, (void*)(long)u, 25);
|
||||
+ }
|
||||
+
|
||||
+ return func(u, stats);
|
||||
}
|
||||
|
||||
/********************************************************************
|
@ -1,299 +0,0 @@
|
||||
From 4a54e34cf5629f9fed61f0b7d69ee3ba4d874bc6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
|
||||
Date: Sat, 9 Jul 2022 13:40:24 +0200
|
||||
Subject: [PATCH] pppd: Add support for registering ppp interface via Linux
|
||||
rtnetlink API
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
pppd currently creates ppp network interface via PPPIOCNEWUNIT ioctl API.
|
||||
This API creates a new ppp network interface named "ppp<unit_id>". If user
|
||||
supply option "ifname" with custom network name then pppd calls SIOCSIFNAME
|
||||
ioctl to rename "ppp<unit_id>" to custom name immediately after successful
|
||||
PPPIOCNEWUNIT ioctl call. If custom name is already registered then
|
||||
SIOCSIFNAME ioctl fails and pppd close current channel (which destroy also
|
||||
network interface).
|
||||
|
||||
This has side effect that in the first few miliseconds interface has
|
||||
different name as what user supplied.
|
||||
|
||||
Tools like systemd, udev or NetworkManager are trying to query
|
||||
interface attributes based on interface name immediately when new
|
||||
network interface is created.
|
||||
|
||||
But if interface is renamed immediately after creation then these tools
|
||||
fails. For example when running pppd with option "ifname ppp-wan" following
|
||||
error is reported by systemd / udev into dmesg log:
|
||||
|
||||
[ 35.718732] PPP generic driver version 2.4.2
|
||||
[ 35.793914] NET: Registered protocol family 24
|
||||
[ 35.889924] systemd-udevd[1852]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
|
||||
[ 35.901450] ppp-wan: renamed from ppp0
|
||||
[ 35.930332] systemd-udevd[1852]: link_config: could not get ethtool features for ppp0
|
||||
[ 35.939473] systemd-udevd[1852]: Could not set offload features of ppp0: No such device
|
||||
|
||||
There is an easy way to fix this issue: Use new rtnetlink API.
|
||||
|
||||
Via rtnetlink API it is possible to create ppp network interface with
|
||||
custom ifname atomically. Just it is not possible to specify custom ppp
|
||||
unit id.
|
||||
|
||||
So use new rtnetlink API when user requested custom ifname without custom
|
||||
ppp unit id. This will avoid system issues with interface renaming as ppp
|
||||
interface is directly registered with specified final name.
|
||||
|
||||
This has also advantage that if requested interface name already exists
|
||||
then pppd fail during registering of networking interface and not during
|
||||
renaming network interface which happens after successful registration.
|
||||
|
||||
If user supply custom ppp unit id then it is required to use old ioctl API
|
||||
as currently it is the only API which allows specifying ppp unit id.
|
||||
|
||||
When user does not specify custom ifname stay also with old ioctl API.
|
||||
There is currently a bug in kernel which cause that when empty interface is
|
||||
specified in rtnetlink message for creating ppp interface then kernel
|
||||
creates ppp interface but with pseudo-random name, not derived from ppp
|
||||
unit id. And therefore it is not possible to retrieve what is the name of
|
||||
newly created network interface. So when user does not specify interface
|
||||
name via "ifname" option (which means that want from kernel to choose some
|
||||
"free" interface name) it is needed to use old ioctl API which do it
|
||||
correctly for now.
|
||||
|
||||
Signed-off-by: Pali Rohár <pali@kernel.org>
|
||||
---
|
||||
pppd/sys-linux.c | 194 ++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 192 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/pppd/sys-linux.c
|
||||
+++ b/pppd/sys-linux.c
|
||||
@@ -126,6 +126,11 @@
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/if_link.h>
|
||||
+
|
||||
+#ifdef INET6
|
||||
+#include <linux/if_addr.h>
|
||||
+#endif
|
||||
+
|
||||
/* Attempt at retaining compile-support with older than 4.7 kernels, or kernels
|
||||
* where RTM_NEWSTATS isn't defined for whatever reason.
|
||||
*/
|
||||
@@ -135,16 +140,20 @@
|
||||
#define IFLA_STATS_LINK_64 1
|
||||
#endif
|
||||
|
||||
-#ifdef INET6
|
||||
-#include <linux/if_addr.h>
|
||||
/* glibc versions prior to 2.24 do not define SOL_NETLINK */
|
||||
#ifndef SOL_NETLINK
|
||||
#define SOL_NETLINK 270
|
||||
#endif
|
||||
+
|
||||
/* linux kernel versions prior to 4.3 do not define/support NETLINK_CAP_ACK */
|
||||
#ifndef NETLINK_CAP_ACK
|
||||
#define NETLINK_CAP_ACK 10
|
||||
#endif
|
||||
+
|
||||
+/* linux kernel versions prior to 4.7 do not define/support IFLA_PPP_DEV_FD */
|
||||
+#ifndef IFLA_PPP_MAX
|
||||
+/* IFLA_PPP_DEV_FD is declared as enum when IFLA_PPP_MAX is defined */
|
||||
+#define IFLA_PPP_DEV_FD 1
|
||||
#endif
|
||||
|
||||
#include "pppd.h"
|
||||
@@ -657,6 +666,160 @@ void generic_disestablish_ppp(int dev_fd
|
||||
}
|
||||
|
||||
/*
|
||||
+ * make_ppp_unit_rtnetlink - register a new ppp network interface for ppp_dev_fd
|
||||
+ * with specified req_ifname via rtnetlink. Interface name req_ifname must not
|
||||
+ * be empty. Custom ppp unit id req_unit is ignored and kernel choose some free.
|
||||
+ */
|
||||
+static int make_ppp_unit_rtnetlink(void)
|
||||
+{
|
||||
+ struct {
|
||||
+ struct nlmsghdr nlh;
|
||||
+ struct ifinfomsg ifm;
|
||||
+ struct {
|
||||
+ struct rtattr rta;
|
||||
+ char ifname[IFNAMSIZ];
|
||||
+ } ifn;
|
||||
+ struct {
|
||||
+ struct rtattr rta;
|
||||
+ struct {
|
||||
+ struct rtattr rta;
|
||||
+ char ifkind[sizeof("ppp")];
|
||||
+ } ifik;
|
||||
+ struct {
|
||||
+ struct rtattr rta;
|
||||
+ struct {
|
||||
+ struct rtattr rta;
|
||||
+ union {
|
||||
+ int ppp_dev_fd;
|
||||
+ } ppp;
|
||||
+ } ifdata[1];
|
||||
+ } ifid;
|
||||
+ } ifli;
|
||||
+ } nlreq;
|
||||
+ struct {
|
||||
+ struct nlmsghdr nlh;
|
||||
+ struct nlmsgerr nlerr;
|
||||
+ } nlresp;
|
||||
+ struct sockaddr_nl nladdr;
|
||||
+ struct iovec iov;
|
||||
+ struct msghdr msg;
|
||||
+ ssize_t nlresplen;
|
||||
+ int one;
|
||||
+ int fd;
|
||||
+
|
||||
+ fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
|
||||
+ if (fd < 0) {
|
||||
+ error("make_ppp_unit_rtnetlink: socket(NETLINK_ROUTE): %m (line %d)", __LINE__);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* Tell kernel to not send to us payload of acknowledgment error message. */
|
||||
+ one = 1;
|
||||
+ setsockopt(fd, SOL_NETLINK, NETLINK_CAP_ACK, &one, sizeof(one));
|
||||
+
|
||||
+ memset(&nladdr, 0, sizeof(nladdr));
|
||||
+ nladdr.nl_family = AF_NETLINK;
|
||||
+
|
||||
+ if (bind(fd, (struct sockaddr *)&nladdr, sizeof(nladdr)) < 0) {
|
||||
+ error("make_ppp_unit_rtnetlink: bind(AF_NETLINK): %m (line %d)", __LINE__);
|
||||
+ close(fd);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ memset(&nlreq, 0, sizeof(nlreq));
|
||||
+ nlreq.nlh.nlmsg_len = sizeof(nlreq);
|
||||
+ nlreq.nlh.nlmsg_type = RTM_NEWLINK;
|
||||
+ nlreq.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_EXCL | NLM_F_CREATE;
|
||||
+ nlreq.ifm.ifi_family = AF_UNSPEC;
|
||||
+ nlreq.ifm.ifi_type = ARPHRD_NETROM;
|
||||
+ nlreq.ifn.rta.rta_len = sizeof(nlreq.ifn);
|
||||
+ nlreq.ifn.rta.rta_type = IFLA_IFNAME;
|
||||
+ strlcpy(nlreq.ifn.ifname, req_ifname, sizeof(nlreq.ifn.ifname));
|
||||
+ nlreq.ifli.rta.rta_len = sizeof(nlreq.ifli);
|
||||
+ nlreq.ifli.rta.rta_type = IFLA_LINKINFO;
|
||||
+ nlreq.ifli.ifik.rta.rta_len = sizeof(nlreq.ifli.ifik);
|
||||
+ nlreq.ifli.ifik.rta.rta_type = IFLA_INFO_KIND;
|
||||
+ strcpy(nlreq.ifli.ifik.ifkind, "ppp");
|
||||
+ nlreq.ifli.ifid.rta.rta_len = sizeof(nlreq.ifli.ifid);
|
||||
+ nlreq.ifli.ifid.rta.rta_type = IFLA_INFO_DATA;
|
||||
+ nlreq.ifli.ifid.ifdata[0].rta.rta_len = sizeof(nlreq.ifli.ifid.ifdata[0]);
|
||||
+ nlreq.ifli.ifid.ifdata[0].rta.rta_type = IFLA_PPP_DEV_FD;
|
||||
+ nlreq.ifli.ifid.ifdata[0].ppp.ppp_dev_fd = ppp_dev_fd;
|
||||
+
|
||||
+ memset(&nladdr, 0, sizeof(nladdr));
|
||||
+ nladdr.nl_family = AF_NETLINK;
|
||||
+
|
||||
+ memset(&iov, 0, sizeof(iov));
|
||||
+ iov.iov_base = &nlreq;
|
||||
+ iov.iov_len = sizeof(nlreq);
|
||||
+
|
||||
+ memset(&msg, 0, sizeof(msg));
|
||||
+ msg.msg_name = &nladdr;
|
||||
+ msg.msg_namelen = sizeof(nladdr);
|
||||
+ msg.msg_iov = &iov;
|
||||
+ msg.msg_iovlen = 1;
|
||||
+
|
||||
+ if (sendmsg(fd, &msg, 0) < 0) {
|
||||
+ error("make_ppp_unit_rtnetlink: sendmsg(RTM_NEWLINK/NLM_F_CREATE): %m (line %d)", __LINE__);
|
||||
+ close(fd);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ memset(&iov, 0, sizeof(iov));
|
||||
+ iov.iov_base = &nlresp;
|
||||
+ iov.iov_len = sizeof(nlresp);
|
||||
+
|
||||
+ memset(&msg, 0, sizeof(msg));
|
||||
+ msg.msg_name = &nladdr;
|
||||
+ msg.msg_namelen = sizeof(nladdr);
|
||||
+ msg.msg_iov = &iov;
|
||||
+ msg.msg_iovlen = 1;
|
||||
+
|
||||
+ nlresplen = recvmsg(fd, &msg, 0);
|
||||
+
|
||||
+ if (nlresplen < 0) {
|
||||
+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): %m (line %d)", __LINE__);
|
||||
+ close(fd);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ close(fd);
|
||||
+
|
||||
+ if (nladdr.nl_family != AF_NETLINK) {
|
||||
+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not a netlink packet (line %d)", __LINE__);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if ((size_t)nlresplen < sizeof(nlresp) || nlresp.nlh.nlmsg_len < sizeof(nlresp)) {
|
||||
+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Acknowledgment netlink packet too short (line %d)", __LINE__);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* acknowledgment packet for NLM_F_ACK is NLMSG_ERROR */
|
||||
+ if (nlresp.nlh.nlmsg_type != NLMSG_ERROR) {
|
||||
+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not an acknowledgment netlink packet (line %d)", __LINE__);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* error == 0 indicates success, negative value is errno code */
|
||||
+ if (nlresp.nlerr.error != 0) {
|
||||
+ /*
|
||||
+ * Linux kernel versions prior to 4.7 do not support creating ppp
|
||||
+ * interfaces via rtnetlink API and therefore error response is
|
||||
+ * expected. On older kernel versions do not show this error message.
|
||||
+ * When error is different than EEXIST then pppd tries to fallback to
|
||||
+ * the old ioctl method.
|
||||
+ */
|
||||
+ errno = (nlresp.nlerr.error < 0) ? -nlresp.nlerr.error : EINVAL;
|
||||
+ if (kernel_version >= KVERSION(4,7,0))
|
||||
+ error("Couldn't create ppp interface %s: %m", req_ifname);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* make_ppp_unit - make a new ppp unit for ppp_dev_fd.
|
||||
* Assumes new_style_driver.
|
||||
*/
|
||||
@@ -676,6 +839,33 @@ static int make_ppp_unit(void)
|
||||
|| fcntl(ppp_dev_fd, F_SETFL, flags | O_NONBLOCK) == -1)
|
||||
warn("Couldn't set /dev/ppp to nonblock: %m");
|
||||
|
||||
+ /*
|
||||
+ * Via rtnetlink it is possible to create ppp network interface with
|
||||
+ * custom ifname atomically. But it is not possible to specify custom
|
||||
+ * ppp unit id.
|
||||
+ *
|
||||
+ * Tools like systemd, udev or NetworkManager are trying to query
|
||||
+ * interface attributes based on interface name immediately when new
|
||||
+ * network interface is created. And therefore immediate interface
|
||||
+ * renaming is causing issues.
|
||||
+ *
|
||||
+ * So use rtnetlink API only when user requested custom ifname. It will
|
||||
+ * avoid system issues with interface renaming.
|
||||
+ */
|
||||
+ if (req_unit == -1 && req_ifname[0] != '\0' && kernel_version >= KVERSION(2,1,16)) {
|
||||
+ if (make_ppp_unit_rtnetlink()) {
|
||||
+ if (ioctl(ppp_dev_fd, PPPIOCGUNIT, &ifunit))
|
||||
+ fatal("Couldn't retrieve PPP unit id: %m");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ /*
|
||||
+ * If interface with requested name already exist return error
|
||||
+ * otherwise fallback to old ioctl method.
|
||||
+ */
|
||||
+ if (errno == EEXIST)
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
ifunit = req_unit;
|
||||
x = ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit);
|
||||
if (x < 0 && req_unit >= 0 && errno == EEXIST) {
|
@ -1,59 +0,0 @@
|
||||
From 44609bfc974bdafc0316d069aabf5e2903efa805 Mon Sep 17 00:00:00 2001
|
||||
From: pali <7141871+pali@users.noreply.github.com>
|
||||
Date: Tue, 9 Aug 2022 11:20:15 +0200
|
||||
Subject: [PATCH] pppd: Workaround for generating ppp unit id on Linux (#355)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Linux kernel has nasty bug / feature. If PPPIOCNEWUNIT is called with
|
||||
negative ppp unit id (which is default option when command line argument
|
||||
"unit" is not specified; and tells kernel to choose some free ppp unit id)
|
||||
and the lowest unused/free ppp unit id is present in some existing network
|
||||
interface name prefixed by "ppp" string then this PPPIOCNEWUNIT ioctl
|
||||
fails. In this case kernel is basically unable to create a new ppp
|
||||
interface via PPPIOCNEWUNIT ioctl when user does not specify some unused
|
||||
and non-conflicted unit id.
|
||||
|
||||
Linux kernel should be fixed to choose usable ppp unit id when was
|
||||
requested via PPPIOCNEWUNIT parameter -1.
|
||||
|
||||
Until this happens, add a workaround for pppd to help choosing some random
|
||||
ppp unit id when kernel returns this error.
|
||||
|
||||
Simple test case (run on system when there is no ppp interface):
|
||||
|
||||
sudo ./pppd ifname ppp1 nodefaultroute noauth nolock local nodetach pty "./pppd nodefaultroute noauth nolock local nodetach notty"
|
||||
|
||||
Second pppd process without this patch prints into syslog following error:
|
||||
|
||||
pppd 2.4.10-dev started by pali, uid 0
|
||||
Couldn't create new ppp unit: File exists
|
||||
Exit.
|
||||
|
||||
With this patch it falls back to random ppp unit id and succeeds:
|
||||
|
||||
pppd 2.4.10-dev started by pali, uid 0
|
||||
Using interface ppp1361
|
||||
Connect: ppp1361 <--> /dev/pts/14
|
||||
...
|
||||
|
||||
Signed-off-by: Pali Rohár <pali@kernel.org>
|
||||
---
|
||||
pppd/sys-linux.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/pppd/sys-linux.c
|
||||
+++ b/pppd/sys-linux.c
|
||||
@@ -873,6 +873,11 @@ static int make_ppp_unit(void)
|
||||
ifunit = -1;
|
||||
x = ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit);
|
||||
}
|
||||
+ if (x < 0 && errno == EEXIST) {
|
||||
+ srand(time(NULL) * getpid());
|
||||
+ ifunit = rand() % 10000;
|
||||
+ x = ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit);
|
||||
+ }
|
||||
if (x < 0)
|
||||
error("Couldn't create new ppp unit: %m");
|
||||
|
@ -1,218 +0,0 @@
|
||||
From 089687fbcc6524809ae9f4b2f8145fe3c2a91147 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
|
||||
Date: Sat, 7 Aug 2021 19:48:01 +0200
|
||||
Subject: [PATCH] pppd: Retry registering interface when on rtnetlink -EBUSY
|
||||
error
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Due to workaround in kernel module ppp_generic.ko in function
|
||||
ppp_nl_newlink(), kernel may return -EBUSY error to prevent possible
|
||||
mutex deadlock. In this case userspace needs to retry its request.
|
||||
|
||||
Proper way would be to fix kernel module to order requests and mutex
|
||||
locking, so prevent deadlock in kernel and so never return this error to
|
||||
userspace. Until it happens we need retry code in userspace.
|
||||
|
||||
Signed-off-by: Pali Rohár <pali@kernel.org>
|
||||
[ backport to ppp 2.4.9 ]
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
---
|
||||
pppd/sys-linux.c | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/pppd/sys-linux.c
|
||||
+++ b/pppd/sys-linux.c
|
||||
@@ -707,99 +707,101 @@ static int make_ppp_unit_rtnetlink(void)
|
||||
int one;
|
||||
int fd;
|
||||
|
||||
- fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
|
||||
- if (fd < 0) {
|
||||
- error("make_ppp_unit_rtnetlink: socket(NETLINK_ROUTE): %m (line %d)", __LINE__);
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- /* Tell kernel to not send to us payload of acknowledgment error message. */
|
||||
- one = 1;
|
||||
- setsockopt(fd, SOL_NETLINK, NETLINK_CAP_ACK, &one, sizeof(one));
|
||||
+ do {
|
||||
+ fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
|
||||
+ if (fd < 0) {
|
||||
+ error("make_ppp_unit_rtnetlink: socket(NETLINK_ROUTE): %m (line %d)", __LINE__);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* Tell kernel to not send to us payload of acknowledgment error message. */
|
||||
+ one = 1;
|
||||
+ setsockopt(fd, SOL_NETLINK, NETLINK_CAP_ACK, &one, sizeof(one));
|
||||
+
|
||||
+ memset(&nladdr, 0, sizeof(nladdr));
|
||||
+ nladdr.nl_family = AF_NETLINK;
|
||||
+
|
||||
+ if (bind(fd, (struct sockaddr *)&nladdr, sizeof(nladdr)) < 0) {
|
||||
+ error("make_ppp_unit_rtnetlink: bind(AF_NETLINK): %m (line %d)", __LINE__);
|
||||
+ close(fd);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ memset(&nlreq, 0, sizeof(nlreq));
|
||||
+ nlreq.nlh.nlmsg_len = sizeof(nlreq);
|
||||
+ nlreq.nlh.nlmsg_type = RTM_NEWLINK;
|
||||
+ nlreq.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_EXCL | NLM_F_CREATE;
|
||||
+ nlreq.ifm.ifi_family = AF_UNSPEC;
|
||||
+ nlreq.ifm.ifi_type = ARPHRD_NETROM;
|
||||
+ nlreq.ifn.rta.rta_len = sizeof(nlreq.ifn);
|
||||
+ nlreq.ifn.rta.rta_type = IFLA_IFNAME;
|
||||
+ strlcpy(nlreq.ifn.ifname, req_ifname, sizeof(nlreq.ifn.ifname));
|
||||
+ nlreq.ifli.rta.rta_len = sizeof(nlreq.ifli);
|
||||
+ nlreq.ifli.rta.rta_type = IFLA_LINKINFO;
|
||||
+ nlreq.ifli.ifik.rta.rta_len = sizeof(nlreq.ifli.ifik);
|
||||
+ nlreq.ifli.ifik.rta.rta_type = IFLA_INFO_KIND;
|
||||
+ strcpy(nlreq.ifli.ifik.ifkind, "ppp");
|
||||
+ nlreq.ifli.ifid.rta.rta_len = sizeof(nlreq.ifli.ifid);
|
||||
+ nlreq.ifli.ifid.rta.rta_type = IFLA_INFO_DATA;
|
||||
+ nlreq.ifli.ifid.ifdata[0].rta.rta_len = sizeof(nlreq.ifli.ifid.ifdata[0]);
|
||||
+ nlreq.ifli.ifid.ifdata[0].rta.rta_type = IFLA_PPP_DEV_FD;
|
||||
+ nlreq.ifli.ifid.ifdata[0].ppp.ppp_dev_fd = ppp_dev_fd;
|
||||
+
|
||||
+ memset(&nladdr, 0, sizeof(nladdr));
|
||||
+ nladdr.nl_family = AF_NETLINK;
|
||||
+
|
||||
+ memset(&iov, 0, sizeof(iov));
|
||||
+ iov.iov_base = &nlreq;
|
||||
+ iov.iov_len = sizeof(nlreq);
|
||||
+
|
||||
+ memset(&msg, 0, sizeof(msg));
|
||||
+ msg.msg_name = &nladdr;
|
||||
+ msg.msg_namelen = sizeof(nladdr);
|
||||
+ msg.msg_iov = &iov;
|
||||
+ msg.msg_iovlen = 1;
|
||||
+
|
||||
+ if (sendmsg(fd, &msg, 0) < 0) {
|
||||
+ error("make_ppp_unit_rtnetlink: sendmsg(RTM_NEWLINK/NLM_F_CREATE): %m (line %d)", __LINE__);
|
||||
+ close(fd);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ memset(&iov, 0, sizeof(iov));
|
||||
+ iov.iov_base = &nlresp;
|
||||
+ iov.iov_len = sizeof(nlresp);
|
||||
+
|
||||
+ memset(&msg, 0, sizeof(msg));
|
||||
+ msg.msg_name = &nladdr;
|
||||
+ msg.msg_namelen = sizeof(nladdr);
|
||||
+ msg.msg_iov = &iov;
|
||||
+ msg.msg_iovlen = 1;
|
||||
+
|
||||
+ nlresplen = recvmsg(fd, &msg, 0);
|
||||
+
|
||||
+ if (nlresplen < 0) {
|
||||
+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): %m (line %d)", __LINE__);
|
||||
+ close(fd);
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
- memset(&nladdr, 0, sizeof(nladdr));
|
||||
- nladdr.nl_family = AF_NETLINK;
|
||||
-
|
||||
- if (bind(fd, (struct sockaddr *)&nladdr, sizeof(nladdr)) < 0) {
|
||||
- error("make_ppp_unit_rtnetlink: bind(AF_NETLINK): %m (line %d)", __LINE__);
|
||||
close(fd);
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- memset(&nlreq, 0, sizeof(nlreq));
|
||||
- nlreq.nlh.nlmsg_len = sizeof(nlreq);
|
||||
- nlreq.nlh.nlmsg_type = RTM_NEWLINK;
|
||||
- nlreq.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_EXCL | NLM_F_CREATE;
|
||||
- nlreq.ifm.ifi_family = AF_UNSPEC;
|
||||
- nlreq.ifm.ifi_type = ARPHRD_NETROM;
|
||||
- nlreq.ifn.rta.rta_len = sizeof(nlreq.ifn);
|
||||
- nlreq.ifn.rta.rta_type = IFLA_IFNAME;
|
||||
- strlcpy(nlreq.ifn.ifname, req_ifname, sizeof(nlreq.ifn.ifname));
|
||||
- nlreq.ifli.rta.rta_len = sizeof(nlreq.ifli);
|
||||
- nlreq.ifli.rta.rta_type = IFLA_LINKINFO;
|
||||
- nlreq.ifli.ifik.rta.rta_len = sizeof(nlreq.ifli.ifik);
|
||||
- nlreq.ifli.ifik.rta.rta_type = IFLA_INFO_KIND;
|
||||
- strcpy(nlreq.ifli.ifik.ifkind, "ppp");
|
||||
- nlreq.ifli.ifid.rta.rta_len = sizeof(nlreq.ifli.ifid);
|
||||
- nlreq.ifli.ifid.rta.rta_type = IFLA_INFO_DATA;
|
||||
- nlreq.ifli.ifid.ifdata[0].rta.rta_len = sizeof(nlreq.ifli.ifid.ifdata[0]);
|
||||
- nlreq.ifli.ifid.ifdata[0].rta.rta_type = IFLA_PPP_DEV_FD;
|
||||
- nlreq.ifli.ifid.ifdata[0].ppp.ppp_dev_fd = ppp_dev_fd;
|
||||
-
|
||||
- memset(&nladdr, 0, sizeof(nladdr));
|
||||
- nladdr.nl_family = AF_NETLINK;
|
||||
-
|
||||
- memset(&iov, 0, sizeof(iov));
|
||||
- iov.iov_base = &nlreq;
|
||||
- iov.iov_len = sizeof(nlreq);
|
||||
-
|
||||
- memset(&msg, 0, sizeof(msg));
|
||||
- msg.msg_name = &nladdr;
|
||||
- msg.msg_namelen = sizeof(nladdr);
|
||||
- msg.msg_iov = &iov;
|
||||
- msg.msg_iovlen = 1;
|
||||
-
|
||||
- if (sendmsg(fd, &msg, 0) < 0) {
|
||||
- error("make_ppp_unit_rtnetlink: sendmsg(RTM_NEWLINK/NLM_F_CREATE): %m (line %d)", __LINE__);
|
||||
- close(fd);
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- memset(&iov, 0, sizeof(iov));
|
||||
- iov.iov_base = &nlresp;
|
||||
- iov.iov_len = sizeof(nlresp);
|
||||
-
|
||||
- memset(&msg, 0, sizeof(msg));
|
||||
- msg.msg_name = &nladdr;
|
||||
- msg.msg_namelen = sizeof(nladdr);
|
||||
- msg.msg_iov = &iov;
|
||||
- msg.msg_iovlen = 1;
|
||||
-
|
||||
- nlresplen = recvmsg(fd, &msg, 0);
|
||||
-
|
||||
- if (nlresplen < 0) {
|
||||
- error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): %m (line %d)", __LINE__);
|
||||
- close(fd);
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- close(fd);
|
||||
|
||||
- if (nladdr.nl_family != AF_NETLINK) {
|
||||
- error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not a netlink packet (line %d)", __LINE__);
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- if ((size_t)nlresplen < sizeof(nlresp) || nlresp.nlh.nlmsg_len < sizeof(nlresp)) {
|
||||
- error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Acknowledgment netlink packet too short (line %d)", __LINE__);
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- /* acknowledgment packet for NLM_F_ACK is NLMSG_ERROR */
|
||||
- if (nlresp.nlh.nlmsg_type != NLMSG_ERROR) {
|
||||
- error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not an acknowledgment netlink packet (line %d)", __LINE__);
|
||||
- return 0;
|
||||
- }
|
||||
+ if (nladdr.nl_family != AF_NETLINK) {
|
||||
+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not a netlink packet (line %d)", __LINE__);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if ((size_t)nlresplen < sizeof(nlresp) || nlresp.nlh.nlmsg_len < sizeof(nlresp)) {
|
||||
+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Acknowledgment netlink packet too short (line %d)", __LINE__);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* acknowledgment packet for NLM_F_ACK is NLMSG_ERROR */
|
||||
+ if (nlresp.nlh.nlmsg_type != NLMSG_ERROR) {
|
||||
+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not an acknowledgment netlink packet (line %d)", __LINE__);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ } while (nlresp.nlerr.error == -EBUSY);
|
||||
|
||||
/* error == 0 indicates success, negative value is errno code */
|
||||
if (nlresp.nlerr.error != 0) {
|
@ -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 <jo@mein.io>
|
||||
|
||||
--- 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 <crypt.h>' | $(CC) -E - >/dev/null 2>&1 && echo yes),yes)
|
||||
+#ifeq ($(shell echo '\#include <crypt.h>' | $(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
|
File diff suppressed because it is too large
Load Diff
@ -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 <jo@mein.io>
|
||||
|
||||
--- 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)
|
@ -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)
|
||||
@@ -381,31 +381,37 @@ static int test_config(char *filename)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -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 <jo@mein.io>
|
||||
|
||||
--- 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) {
|
@ -8,18 +8,18 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
|
||||
--- 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);
|
||||
|
@ -12,13 +12,13 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
|
||||
--- a/pppd/main.c
|
||||
+++ b/pppd/main.c
|
||||
@@ -1035,7 +1035,8 @@ get_input(void)
|
||||
@@ -1152,7 +1152,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;
|
||||
lcp_lowerdown(0); /* serial link is no longer available */
|
||||
link_terminated(0);
|
||||
return;
|
||||
|
@ -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 <jo@mein.io>
|
||||
|
||||
--- 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
|
@ -11,62 +11,70 @@ packets which are treated as active.
|
||||
|
||||
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
|
||||
--- 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" ])
|
||||
@@ -359,6 +362,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
|
||||
@@ -138,6 +138,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 <pcap.h>
|
||||
+#include <pcap-bpf.h>
|
||||
/*
|
||||
* 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 <jo@mein.io>
|
||||
+ "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 <jo@mein.io>
|
||||
+}
|
||||
+#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 <pcap.h>
|
||||
+#include <pcap-bpf.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <errno.h>
|
||||
+#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 <jo@mein.io>
|
||||
+ 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 <jo@mein.io>
|
||||
+ }
|
||||
+ 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;
|
||||
+}
|
||||
|
@ -8,15 +8,15 @@ Signed-off-by: George Kashperko <george@znau.edu.ua>
|
||||
2 files changed, 53 insertions(+), 14 deletions(-)
|
||||
--- a/pppd/multilink.c
|
||||
+++ b/pppd/multilink.c
|
||||
@@ -35,6 +35,7 @@
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <signal.h>
|
||||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
+#include <net/if.h>
|
||||
|
||||
#include "pppd.h"
|
||||
#include "pppd-private.h"
|
||||
#include "fsm.h"
|
||||
@@ -56,7 +57,8 @@ static void iterate_bundle_links(void (*
|
||||
@@ -62,7 +63,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 <george@znau.edu.ua>
|
||||
|
||||
#define set_ip_epdisc(ep, addr) do { \
|
||||
ep->length = 4; \
|
||||
@@ -197,35 +199,38 @@ mp_join_bundle(void)
|
||||
@@ -215,35 +217,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 <george@znau.edu.ua>
|
||||
- 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 <george@znau.edu.ua>
|
||||
}
|
||||
|
||||
/* we have to make a new bundle */
|
||||
@@ -405,20 +410,39 @@ parse_num(char *str, const char *key, in
|
||||
@@ -423,20 +428,39 @@ parse_num(char *str, const char *key, in
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ Signed-off-by: George Kashperko <george@znau.edu.ua>
|
||||
&& memcmp(vd.dptr, key.dptr, vd.dsize) == 0;
|
||||
--- a/pppd/sys-linux.c
|
||||
+++ b/pppd/sys-linux.c
|
||||
@@ -923,6 +923,16 @@ void cfg_bundle(int mrru, int mtru, int
|
||||
@@ -984,6 +984,16 @@ void cfg_bundle(int mrru, int mtru, int
|
||||
add_fd(ppp_dev_fd);
|
||||
}
|
||||
|
||||
@ -129,14 +129,14 @@ Signed-off-by: George Kashperko <george@znau.edu.ua>
|
||||
+#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
|
||||
@@ -941,6 +951,8 @@ void make_new_bundle(int mrru, int mtru,
|
||||
@@ -1002,6 +1012,8 @@ void make_new_bundle(int mrru, int mtru,
|
||||
|
||||
/* set the mrru and flags */
|
||||
cfg_bundle(mrru, mtru, rssn, tssn);
|
||||
|
@ -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 <jo@mein.io>
|
||||
|
||||
--- a/pppd/sys-linux.c
|
||||
+++ b/pppd/sys-linux.c
|
||||
@@ -2248,6 +2248,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()) {
|
@ -13,7 +13,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
|
||||
--- a/pppd/sys-linux.c
|
||||
+++ b/pppd/sys-linux.c
|
||||
@@ -2198,6 +2198,9 @@ int sifdefaultroute (int unit, u_int32_t
|
||||
@@ -2251,6 +2251,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 <jo@mein.io>
|
||||
rt.rt_dev = ifname;
|
||||
rt.rt_metric = dfl_route_metric + 1; /* +1 for binary compatibility */
|
||||
|
||||
@@ -2206,7 +2209,7 @@ int sifdefaultroute (int unit, u_int32_t
|
||||
@@ -2259,7 +2262,7 @@ int sifdefaultroute (int unit, u_int32_t
|
||||
SIN_ADDR(rt.rt_genmask) = 0L;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
|
||||
--- a/pppd/sys-linux.c
|
||||
+++ b/pppd/sys-linux.c
|
||||
@@ -235,7 +235,7 @@ static int driver_is_old = 0;
|
||||
@@ -231,7 +231,7 @@ 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,7 +19,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
|
||||
static char loop_name[20];
|
||||
static unsigned char inbuf[512]; /* buffer for chars read from loopback */
|
||||
@@ -254,8 +254,8 @@ static int looped; /* 1 if using loop
|
||||
@@ -250,8 +250,8 @@ 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 */
|
||||
@ -29,7 +29,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
|
||||
#define MAX_IFS 100
|
||||
|
||||
@@ -1933,11 +1933,12 @@ int ccp_fatal_error (int unit)
|
||||
@@ -1970,11 +1970,12 @@ int ccp_fatal_error (int unit)
|
||||
*
|
||||
* path_to_procfs - find the path to the proc file system mount point
|
||||
*/
|
||||
@ -44,7 +44,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
struct mntent *mntent;
|
||||
FILE *fp;
|
||||
|
||||
@@ -1959,6 +1960,7 @@ static char *path_to_procfs(const char *
|
||||
@@ -1996,6 +1997,7 @@ static char *path_to_procfs(const char *
|
||||
fclose (fp);
|
||||
}
|
||||
}
|
||||
@ -52,7 +52,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
|
||||
strlcpy(proc_path + proc_path_len, tail,
|
||||
sizeof(proc_path) - proc_path_len);
|
||||
@@ -2843,15 +2845,19 @@ int ppp_available(void)
|
||||
@@ -2895,15 +2897,19 @@ int ppp_check_kernel_support(void)
|
||||
int my_version, my_modification, my_patch;
|
||||
int osmaj, osmin, ospatch;
|
||||
|
||||
@ -72,7 +72,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
|
||||
/* XXX should get from driver */
|
||||
driver_version = 2;
|
||||
@@ -2911,6 +2917,7 @@ int ppp_available(void)
|
||||
@@ -2963,6 +2969,7 @@ int ppp_check_kernel_support(void)
|
||||
|
||||
if (ok && ((ifr.ifr_hwaddr.sa_family & ~0xFF) != ARPHRD_PPP))
|
||||
ok = 0;
|
||||
@ -80,7 +80,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
|
||||
/*
|
||||
* This is the PPP device. Validate the version of the driver at this
|
||||
@@ -3592,6 +3599,7 @@ get_pty(int *master_fdp, int *slave_fdp,
|
||||
@@ -3577,6 +3584,7 @@ get_pty(int *master_fdp, int *slave_fdp,
|
||||
}
|
||||
#endif /* TIOCGPTN */
|
||||
|
||||
@ -88,7 +88,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
if (sfd < 0) {
|
||||
/* the old way - scan through the pty name space */
|
||||
for (i = 0; i < 64; ++i) {
|
||||
@@ -3610,6 +3618,7 @@ get_pty(int *master_fdp, int *slave_fdp,
|
||||
@@ -3601,6 +3609,7 @@ get_pty(int *master_fdp, int *slave_fdp,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -98,26 +98,26 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
return 0;
|
||||
--- a/pppd/plugins/pppoatm/pppoatm.c
|
||||
+++ b/pppd/plugins/pppoatm/pppoatm.c
|
||||
@@ -171,14 +171,6 @@ static void disconnect_pppoatm(void)
|
||||
@@ -179,14 +179,6 @@ static void disconnect_pppoatm(void)
|
||||
|
||||
void plugin_init(void)
|
||||
{
|
||||
-#ifdef 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 PPPoATM");
|
||||
-#else
|
||||
- fatal("No PPPoATM support on this OS");
|
||||
-#endif
|
||||
add_options(pppoa_options);
|
||||
ppp_add_options(pppoa_options);
|
||||
}
|
||||
|
||||
--- a/pppd/plugins/pppoe/plugin.c
|
||||
+++ b/pppd/plugins/pppoe/plugin.c
|
||||
@@ -58,9 +58,6 @@ static char const RCSID[] =
|
||||
@@ -57,9 +57,6 @@ static char const RCSID[] =
|
||||
|
||||
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 +125,30 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
char *pppd_pppoe_service = NULL;
|
||||
static char *acName = NULL;
|
||||
static char *existingSession = NULL;
|
||||
@@ -407,10 +404,6 @@ PPPoEDevnameHook(char *cmd, char **argv,
|
||||
@@ -421,10 +418,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)
|
||||
@@ -500,12 +500,7 @@ static void pppol2tp_cleanup(void)
|
||||
|
||||
void plugin_init(void)
|
||||
{
|
||||
-#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__)
|
||||
fatal("No PPPoL2TP support on this OS");
|
||||
#endif
|
||||
add_options(pppol2tp_options);
|
||||
ppp_add_options(pppol2tp_options);
|
||||
|
@ -5,19 +5,19 @@ information to the permanent storage, therfore remove this option.
|
||||
|
||||
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
|
||||
--- a/pppd/pppd.h
|
||||
+++ b/pppd/pppd.h
|
||||
@@ -318,7 +318,6 @@ extern int holdoff; /* Dead time before
|
||||
--- a/pppd/pppd-private.h
|
||||
+++ b/pppd/pppd-private.h
|
||||
@@ -187,7 +187,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
|
||||
@@ -150,7 +150,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 <jo@mein.io>
|
||||
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[] = {
|
||||
@@ -206,8 +206,10 @@ static struct option tty_options[] = {
|
||||
"Send and receive over socket, arg is host:port",
|
||||
OPT_PRIO | OPT_DEVNAM },
|
||||
|
||||
|
@ -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 <jo@mein.io>
|
||||
|
||||
--- a/pppd/sys-linux.c
|
||||
+++ b/pppd/sys-linux.c
|
||||
@@ -2981,6 +2981,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
|
||||
@@ -3046,6 +3047,7 @@ void logwtmp (const char *line, const ch
|
||||
close (wtmp);
|
||||
}
|
||||
#endif
|
||||
+#endif
|
||||
}
|
||||
#endif /* HAVE_LOGWTMP */
|
||||
|
@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
|
||||
--- a/pppd/main.c
|
||||
+++ b/pppd/main.c
|
||||
@@ -867,14 +867,17 @@ struct protocol_list {
|
||||
@@ -984,14 +984,17 @@ struct protocol_list {
|
||||
const char *name;
|
||||
} protocol_list[] = {
|
||||
{ 0x21, "IP" },
|
||||
@ -25,7 +25,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
{ 0x33, "Stream Protocol ST-II" },
|
||||
{ 0x35, "Banyan Vines" },
|
||||
{ 0x39, "AppleTalk EDDP" },
|
||||
@@ -888,8 +891,11 @@ struct protocol_list {
|
||||
@@ -1005,8 +1008,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 <jo@mein.io>
|
||||
{ 0x53, "Encryption" },
|
||||
{ 0x55, "Individual Link Encryption" },
|
||||
{ 0x57, "IPv6" },
|
||||
@@ -900,12 +906,15 @@ struct protocol_list {
|
||||
@@ -1017,12 +1023,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 <jo@mein.io>
|
||||
{ 0x0203, "IBM Source Routing BPDU" },
|
||||
{ 0x0205, "DEC LANBridge100 Spanning Tree" },
|
||||
{ 0x0207, "Cisco Discovery Protocol" },
|
||||
@@ -917,15 +926,19 @@ struct protocol_list {
|
||||
@@ -1034,15 +1043,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 <jo@mein.io>
|
||||
{ 0x4001, "Cray Communications Control Protocol" },
|
||||
{ 0x4003, "CDPD Mobile Network Registration Protocol" },
|
||||
{ 0x4005, "Expand accelerator protocol" },
|
||||
@@ -936,8 +949,10 @@ struct protocol_list {
|
||||
@@ -1053,8 +1066,10 @@ struct protocol_list {
|
||||
{ 0x4023, "RefTek Protocol" },
|
||||
{ 0x4025, "Fibre Channel" },
|
||||
{ 0x4027, "EMIT Protocols" },
|
||||
@ -84,7 +84,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
{ 0x8023, "OSI Network Layer Control Protocol" },
|
||||
{ 0x8025, "Xerox NS IDP Control Protocol" },
|
||||
{ 0x8027, "DECnet Phase IV Control Protocol" },
|
||||
@@ -946,7 +961,9 @@ struct protocol_list {
|
||||
@@ -1063,7 +1078,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 <jo@mein.io>
|
||||
{ 0x803f, "NETBIOS Framing Control Protocol" },
|
||||
{ 0x8041, "Cisco Systems Control Protocol" },
|
||||
{ 0x8043, "Ascom Timeplex" },
|
||||
@@ -955,18 +972,24 @@ struct protocol_list {
|
||||
@@ -1072,18 +1089,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 <jo@mein.io>
|
||||
{ 0x8207, "Cisco Discovery Protocol Control" },
|
||||
{ 0x8209, "Netcs Twin Routing" },
|
||||
{ 0x820b, "STP - Control Protocol" },
|
||||
@@ -975,24 +998,29 @@ struct protocol_list {
|
||||
@@ -1092,24 +1115,29 @@ struct protocol_list {
|
||||
{ 0x8281, "MPLSCP" },
|
||||
{ 0x8285, "IEEE p1284.4 standard - Protocol Control" },
|
||||
{ 0x8287, "ETSI TETRA TNP1 Control Protocol" },
|
||||
|
@ -9,7 +9,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
|
||||
--- 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 <jo@mein.io>
|
||||
|
||||
{ "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 },
|
||||
|
@ -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
|
||||
@@ -344,6 +344,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
|
||||
@@ -21,5 +21,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. <xeb@mail.ru> *
|
||||
+ * some cleanup done (C) 2012 by Daniel Golle <dgolle@allnet.de> *
|
||||
@ -377,6 +361,8 @@
|
||||
+#include <sys/ioctl.h>
|
||||
+
|
||||
+#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 <net/if.h>
|
||||
+#include <net/ethernet.h>
|
||||
+#include <linux/if_ether.h>
|
||||
+#include <linux/if_pppox.h>
|
||||
+
|
||||
+#include <stdio.h>
|
||||
@ -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);
|
||||
+
|
||||
|
@ -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 <net/if.h>
|
||||
-#include <net/ethernet.h>
|
||||
+#include <linux/if_ether.h>
|
||||
#include <linux/if_pppox.h>
|
||||
|
||||
#include <stdio.h>
|
@ -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)
|
@ -1,16 +1,16 @@
|
||||
--- a/pppd/chap-new.c
|
||||
+++ b/pppd/chap-new.c
|
||||
@@ -37,6 +37,9 @@
|
||||
#include "chap-new.h"
|
||||
--- a/pppd/chap.c
|
||||
+++ b/pppd/chap.c
|
||||
@@ -42,6 +42,9 @@
|
||||
#include "chap.h"
|
||||
#include "chap-md5.h"
|
||||
|
||||
+#include <semaphore.h>
|
||||
+#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 +526,18 @@ chap_respond(struct chap_client_state *c
|
||||
@@ -520,6 +523,18 @@ chap_respond(struct chap_client_state *c
|
||||
p[2] = len >> 8;
|
||||
p[3] = len;
|
||||
|
||||
@ -29,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
|
||||
@@ -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 */
|
||||
@ -70,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 },
|
||||
|
||||
@ -80,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
|
||||
@@ -336,6 +336,7 @@ extern char *bundle_name; /* bundle name
|
||||
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 @@
|
||||
@ -177,8 +173,8 @@
|
||||
+extern int syncppp(int nproc);
|
||||
--- a/pppd/upap.c
|
||||
+++ b/pppd/upap.c
|
||||
@@ -50,6 +50,8 @@
|
||||
#include "pppd.h"
|
||||
@@ -55,6 +55,8 @@
|
||||
#include "options.h"
|
||||
#include "upap.h"
|
||||
|
||||
+#include <semaphore.h>
|
||||
@ -186,7 +182,7 @@
|
||||
|
||||
static bool hide_password = 1;
|
||||
|
||||
@@ -540,6 +542,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);
|
||||
|
||||
|
@ -1,89 +0,0 @@
|
||||
From 831dca008699d485f2c8e91749657ef2d0b06166 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Schiller <ms@dev.tdt.de>
|
||||
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);
|
||||
}
|
||||
|
@ -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
|
@ -11,6 +11,7 @@ use strict;
|
||||
use warnings;
|
||||
use File::Basename;
|
||||
use File::Copy;
|
||||
use File::Path;
|
||||
use Text::ParseWords;
|
||||
use JSON::PP;
|
||||
|
||||
@ -173,7 +174,7 @@ sub download
|
||||
}
|
||||
|
||||
if (! -d "$target") {
|
||||
system("mkdir", "-p", "$target/");
|
||||
make_path($target);
|
||||
}
|
||||
|
||||
if (! open TMPDLS, "find $mirror -follow -name $filename 2>/dev/null |") {
|
||||
@ -244,7 +245,7 @@ sub download
|
||||
};
|
||||
|
||||
unlink "$target/$filename";
|
||||
system("mv", "$target/$filename.dl", "$target/$filename");
|
||||
move("$target/$filename.dl", "$target/$filename");
|
||||
cleanup();
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3990,6 +3990,7 @@ CONFIG_NET_CORE=y
|
||||
# CONFIG_NET_DSA_MT7530 is not set
|
||||
# CONFIG_NET_DSA_MV88E6060 is not set
|
||||
# CONFIG_NET_DSA_MV88E6XXX is not set
|
||||
# CONFIG_NET_DSA_MV88E6XXX_LEDS is not set
|
||||
# CONFIG_NET_DSA_MV88E6XXX_PTP is not set
|
||||
# CONFIG_NET_DSA_QCA8K is not set
|
||||
# CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT is not set
|
||||
|
@ -9,7 +9,7 @@ Subject: [PATCH] net/dsa/mv88e6xxx: disable ATU violation
|
||||
|
||||
--- a/drivers/net/dsa/mv88e6xxx/chip.c
|
||||
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
|
||||
@@ -3375,6 +3375,9 @@ static int mv88e6xxx_setup_port(struct m
|
||||
@@ -3405,6 +3405,9 @@ static int mv88e6xxx_setup_port(struct m
|
||||
else
|
||||
reg = 1 << port;
|
||||
|
||||
|
@ -1,27 +0,0 @@
|
||||
From: Tobias Waldekranz <tobias@waldekranz.com>
|
||||
Subject: [RFC net-next 7/7] net: dsa: mv88e6xxx: Request assisted learning on CPU port
|
||||
Date: Sat, 16 Jan 2021 02:25:15 +0100
|
||||
Archived-At: <https://lore.kernel.org/netdev/20210116012515.3152-8-tobias@waldekranz.com/>
|
||||
|
||||
While the hardware is capable of performing learning on the CPU port,
|
||||
it requires alot of additions to the bridge's forwarding path in order
|
||||
to handle multi-destination traffic correctly.
|
||||
|
||||
Until that is in place, opt for the next best thing and let DSA sync
|
||||
the relevant addresses down to the hardware FDB.
|
||||
|
||||
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
|
||||
---
|
||||
drivers/net/dsa/mv88e6xxx/chip.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/drivers/net/dsa/mv88e6xxx/chip.c
|
||||
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
|
||||
@@ -6993,6 +6993,7 @@ static int mv88e6xxx_register_switch(str
|
||||
ds->ops = &mv88e6xxx_switch_ops;
|
||||
ds->ageing_time_min = chip->info->age_time_coeff;
|
||||
ds->ageing_time_max = chip->info->age_time_coeff * U8_MAX;
|
||||
+ ds->assisted_learning_on_cpu_port = true;
|
||||
|
||||
/* Some chips support up to 32, but that requires enabling the
|
||||
* 5-bit port mode, which we do not support. 640k^W16 ought to
|
@ -1,10 +1,10 @@
|
||||
CONFIG_ADM6996_PHY=y
|
||||
CONFIG_CPU_MIPS32_R1=y
|
||||
# CONFIG_CPU_MIPS32_R2 is not set
|
||||
CONFIG_CPU_MIPSR1=y
|
||||
CONFIG_CRC16=y
|
||||
CONFIG_CRYPTO_DEFLATE=y
|
||||
CONFIG_FIRMWARE_MEMMAP=y
|
||||
CONFIG_FORCE_NR_CPUS=y
|
||||
CONFIG_GENERIC_ALLOCATOR=y
|
||||
CONFIG_GPIO_GENERIC=y
|
||||
CONFIG_GPIO_GENERIC_PLATFORM=y
|
||||
@ -15,7 +15,6 @@ CONFIG_NLS=y
|
||||
CONFIG_SGL_ALLOC=y
|
||||
CONFIG_SOC_AMAZON_SE=y
|
||||
# CONFIG_SOC_XWAY is not set
|
||||
CONFIG_SWCONFIG=y
|
||||
CONFIG_TARGET_ISA_REV=1
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_COMMON=y
|
||||
|
@ -70,6 +70,16 @@
|
||||
label = "blue:cover";
|
||||
gpios = <&pio 20 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
cover-red {
|
||||
label = "red:cover";
|
||||
gpios = <&pio 21 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
cover-green {
|
||||
label = "green:cover";
|
||||
gpios = <&pio 22 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
};
|
||||
|
||||
reg_3p3v: regulator-3p3v {
|
||||
|
@ -49,6 +49,14 @@
|
||||
|
||||
hard_config {
|
||||
read-only;
|
||||
|
||||
nvmem-layout {
|
||||
compatible = "mikrotik,routerboot-nvmem";
|
||||
|
||||
macaddr_hard: base-mac-address {
|
||||
#nvmem-cell-cells = <1>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
partition@10000 {
|
||||
|
@ -11,6 +11,7 @@
|
||||
led-failsafe = &led_usr;
|
||||
led-running = &led_usr;
|
||||
led-upgrade = &led_usr;
|
||||
label-mac-device = ðernet;
|
||||
};
|
||||
|
||||
ath9k-leds {
|
||||
@ -128,6 +129,9 @@
|
||||
|
||||
ðernet {
|
||||
pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>;
|
||||
|
||||
nvmem-cells = <&macaddr_hard 0>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
@ -146,6 +150,8 @@
|
||||
compatible = "pci168c,0030";
|
||||
reg = <0x0000 0 0 0 0>;
|
||||
qca,no-eeprom;
|
||||
nvmem-cells = <&macaddr_hard 1>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
};
|
||||
|
@ -11,6 +11,7 @@
|
||||
led-failsafe = &led_usr;
|
||||
led-running = &led_usr;
|
||||
led-upgrade = &led_usr;
|
||||
label-mac-device = &gmac1;
|
||||
};
|
||||
|
||||
leds {
|
||||
@ -40,6 +41,9 @@
|
||||
status = "okay";
|
||||
label = "wan";
|
||||
phy-handle = <ðphy0>;
|
||||
|
||||
nvmem-cells = <&macaddr_hard 0>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
|
||||
ðphy0 {
|
||||
|
@ -11,6 +11,7 @@
|
||||
led-failsafe = &led_pwr;
|
||||
led-running = &led_pwr;
|
||||
led-upgrade = &led_pwr;
|
||||
label-mac-device = &port0;
|
||||
};
|
||||
|
||||
leds {
|
||||
@ -51,6 +52,9 @@
|
||||
label = "sfp";
|
||||
phy-mode = "rgmii-rxid";
|
||||
phy-handle = <&ephy7>;
|
||||
|
||||
nvmem-cells = <&macaddr_hard 5>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
|
||||
&i2c {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user