Merge Mainline

This commit is contained in:
CN_SZTL 2020-11-14 13:55:18 +08:00
commit 604ea1e87f
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
22 changed files with 5819 additions and 624 deletions

View File

@ -166,9 +166,7 @@ define BuildKernel
$(if $(findstring Darwin,$(HOST_OS)),HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib -lncurses") \
YACC=$(STAGING_DIR_HOST)/bin/bison \
$$@
$(LINUX_RECONF_DIFF) $(LINUX_DIR)/.config | \
grep -vE '(CONFIG_CC_(HAS_ASM_GOTO|IS_GCC|IS_CLANG)|GCC_VERSION)=' \
> $(LINUX_RECONFIG_TARGET)
$(call LINUX_RECONF_DIFF,$(LINUX_DIR)/.config) > $(LINUX_RECONFIG_TARGET)
install: $(LINUX_DIR)/.image
+$(MAKE) -C image compile install TARGET_BUILD=

View File

@ -162,11 +162,11 @@ ifeq ($(CONFIG_TARGET),env)
LINUX_RECONFIG_TARGET = $(TOPDIR)/env/kernel-config
endif
__linux_confcmd = $(SCRIPT_DIR)/kconfig.pl $(2) $(patsubst %,+,$(wordlist 2,9999,$(1))) $(1)
__linux_confcmd = $(2) $(patsubst %,+,$(wordlist 2,9999,$(1))) $(1)
LINUX_CONF_CMD = $(call __linux_confcmd,$(LINUX_KCONFIG_LIST),)
LINUX_RECONF_CMD = $(call __linux_confcmd,$(LINUX_RECONFIG_LIST),)
LINUX_RECONF_DIFF = $(call __linux_confcmd,$(filter-out $(LINUX_RECONFIG_TARGET),$(LINUX_RECONFIG_LIST)),'>')
LINUX_CONF_CMD = $(SCRIPT_DIR)/kconfig.pl $(call __linux_confcmd,$(LINUX_KCONFIG_LIST))
LINUX_RECONF_CMD = $(SCRIPT_DIR)/kconfig.pl $(call __linux_confcmd,$(LINUX_RECONFIG_LIST))
LINUX_RECONF_DIFF = $(SCRIPT_DIR)/kconfig.pl - '>' $(call __linux_confcmd,$(filter-out $(LINUX_RECONFIG_TARGET),$(LINUX_RECONFIG_LIST))) $(1) $(GENERIC_PLATFORM_DIR)/config-filter
ifeq ($(DUMP),1)
BuildTarget=$(BuildTargets/DumpCurrent)

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=libnetfilter_log
PKG_VERSION:=1.0.1
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:= \

View File

@ -0,0 +1,108 @@
From 614d8b6cfb969c6102ef320de22b1eb199efce2a Mon Sep 17 00:00:00 2001
From: Felix Janda <felix.janda@posteo.de>
Date: Sat, 16 May 2015 13:37:53 +0200
Subject: include: Sync with current kernel headers
Signed-off-by: Felix Janda <felix.janda@posteo.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
include/libnetfilter_log/linux_nfnetlink_log.h | 51 +++++++++++++-------------
1 file changed, 25 insertions(+), 26 deletions(-)
diff --git a/include/libnetfilter_log/linux_nfnetlink_log.h b/include/libnetfilter_log/linux_nfnetlink_log.h
index 4c802c8..9f38277 100644
--- a/include/libnetfilter_log/linux_nfnetlink_log.h
+++ b/include/libnetfilter_log/linux_nfnetlink_log.h
@@ -20,33 +20,31 @@ enum nfulnl_msg_types {
};
struct nfulnl_msg_packet_hdr {
- u_int16_t hw_protocol; /* hw protocol (network order) */
- u_int8_t hook; /* netfilter hook */
- u_int8_t _pad;
-} __attribute__ ((packed));
+ __be16 hw_protocol; /* hw protocol (network order) */
+ __u8 hook; /* netfilter hook */
+ __u8 _pad;
+};
struct nfulnl_msg_packet_hw {
- u_int16_t hw_addrlen;
- u_int16_t _pad;
- u_int8_t hw_addr[8];
-} __attribute__ ((packed));
+ __be16 hw_addrlen;
+ __u16 _pad;
+ __u8 hw_addr[8];
+};
struct nfulnl_msg_packet_timestamp {
- aligned_u64 sec;
- aligned_u64 usec;
-} __attribute__ ((packed));
-
-#define NFULNL_PREFIXLEN 30 /* just like old log target */
+ __aligned_be64 sec;
+ __aligned_be64 usec;
+};
enum nfulnl_attr_type {
NFULA_UNSPEC,
NFULA_PACKET_HDR,
- NFULA_MARK, /* u_int32_t nfmark */
+ NFULA_MARK, /* __u32 nfmark */
NFULA_TIMESTAMP, /* nfulnl_msg_packet_timestamp */
- NFULA_IFINDEX_INDEV, /* u_int32_t ifindex */
- NFULA_IFINDEX_OUTDEV, /* u_int32_t ifindex */
- NFULA_IFINDEX_PHYSINDEV, /* u_int32_t ifindex */
- NFULA_IFINDEX_PHYSOUTDEV, /* u_int32_t ifindex */
+ NFULA_IFINDEX_INDEV, /* __u32 ifindex */
+ NFULA_IFINDEX_OUTDEV, /* __u32 ifindex */
+ NFULA_IFINDEX_PHYSINDEV, /* __u32 ifindex */
+ NFULA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */
NFULA_HWADDR, /* nfulnl_msg_packet_hw */
NFULA_PAYLOAD, /* opaque data payload */
NFULA_PREFIX, /* string prefix */
@@ -71,23 +69,23 @@ enum nfulnl_msg_config_cmds {
};
struct nfulnl_msg_config_cmd {
- u_int8_t command; /* nfulnl_msg_config_cmds */
+ __u8 command; /* nfulnl_msg_config_cmds */
} __attribute__ ((packed));
struct nfulnl_msg_config_mode {
- u_int32_t copy_range;
- u_int8_t copy_mode;
- u_int8_t _pad;
+ __be32 copy_range;
+ __u8 copy_mode;
+ __u8 _pad;
} __attribute__ ((packed));
enum nfulnl_attr_config {
NFULA_CFG_UNSPEC,
NFULA_CFG_CMD, /* nfulnl_msg_config_cmd */
NFULA_CFG_MODE, /* nfulnl_msg_config_mode */
- NFULA_CFG_NLBUFSIZ, /* u_int32_t buffer size */
- NFULA_CFG_TIMEOUT, /* u_int32_t in 1/100 s */
- NFULA_CFG_QTHRESH, /* u_int32_t */
- NFULA_CFG_FLAGS, /* u_int16_t */
+ NFULA_CFG_NLBUFSIZ, /* __u32 buffer size */
+ NFULA_CFG_TIMEOUT, /* __u32 in 1/100 s */
+ NFULA_CFG_QTHRESH, /* __u32 */
+ NFULA_CFG_FLAGS, /* __u16 */
__NFULA_CFG_MAX
};
#define NFULA_CFG_MAX (__NFULA_CFG_MAX -1)
@@ -95,6 +93,7 @@ enum nfulnl_attr_config {
#define NFULNL_COPY_NONE 0x00
#define NFULNL_COPY_META 0x01
#define NFULNL_COPY_PACKET 0x02
+/* 0xff is reserved, don't use it for new copy modes. */
#define NFULNL_CFG_F_SEQ 0x0001
#define NFULNL_CFG_F_SEQ_GLOBAL 0x0002
--
2.11.0

View File

@ -0,0 +1,52 @@
From 721ea5ec049e12afdd7c182f2899ab6d92914e68 Mon Sep 17 00:00:00 2001
From: Ken-ichirou MATSUZAWA <chamaken@gmail.com>
Date: Fri, 11 Sep 2015 12:12:11 +0900
Subject: include: Sync with kernel headers
Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
include/libnetfilter_log/linux_nfnetlink_log.h | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/include/libnetfilter_log/linux_nfnetlink_log.h b/include/libnetfilter_log/linux_nfnetlink_log.h
index 9f38277..081e7f9 100644
--- a/include/libnetfilter_log/linux_nfnetlink_log.h
+++ b/include/libnetfilter_log/linux_nfnetlink_log.h
@@ -1,16 +1,12 @@
#ifndef _NFNETLINK_LOG_H
#define _NFNETLINK_LOG_H
-#ifndef aligned_u64
-#define aligned_u64 unsigned long long __attribute__((aligned(8)))
-#endif
-
/* This file describes the netlink messages (i.e. 'protocol packets'),
* and not any kind of function definitions. It is shared between kernel and
* userspace. Don't put kernel specific stuff in here */
#include <linux/types.h>
-#include <libnfnetlink/linux_nfnetlink.h>
+#include <linux/netfilter/nfnetlink.h>
enum nfulnl_msg_types {
NFULNL_MSG_PACKET, /* packet from kernel to userspace */
@@ -55,6 +51,8 @@ enum nfulnl_attr_type {
NFULA_HWTYPE, /* hardware type */
NFULA_HWHEADER, /* hardware header */
NFULA_HWLEN, /* hardware header length */
+ NFULA_CT, /* nf_conntrack_netlink.h */
+ NFULA_CT_INFO, /* enum ip_conntrack_info */
__NFULA_MAX
};
@@ -97,5 +95,6 @@ enum nfulnl_attr_config {
#define NFULNL_CFG_F_SEQ 0x0001
#define NFULNL_CFG_F_SEQ_GLOBAL 0x0002
+#define NFULNL_CFG_F_CONNTRACK 0x0004
#endif /* _NFNETLINK_LOG_H */
--
2.11.0

View File

@ -12,9 +12,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/libnl-tiny.git
PKG_SOURCE_DATE:=2019-10-29
PKG_SOURCE_VERSION:=0219008cc8767655d7e747497e8e1133a3e8f840
PKG_MIRROR_HASH:=b84fab21374c6ddbf992acc4ec1c9c6896b32af97603027ca5c866d69d95780f
PKG_SOURCE_DATE:=2020-08-05
PKG_SOURCE_VERSION:=c291088f631d1694f7ba0444b59677b194348da8
PKG_MIRROR_HASH:=99bcce12701bb34dadb39689d95c2c5cf1e27719d0ecfd645d3957a8947025ac
CMAKE_INSTALL:=1
PKG_LICENSE:=LGPL-2.1
@ -27,6 +27,7 @@ define Package/libnl-tiny
SECTION:=libs
CATEGORY:=Libraries
TITLE:=netlink socket library
ABI_VERSION:=1
endef
define Package/libnl-tiny/description

View File

@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=wireguard
PKG_VERSION:=1.0.20200908
PKG_VERSION:=1.0.20201112
PKG_RELEASE:=1
PKG_SOURCE:=wireguard-linux-compat-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://git.zx2c4.com/wireguard-linux-compat/snapshot/
PKG_HASH:=ad33b2d2267a37e0f65c97e65e7d4d926d5aef7d530c251b63fbf919048eead9
PKG_HASH:=89eae7f0c0bd6c8df3ba2e090984974ff68741a9f26aa0922890f8ca727897e1
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING

View File

@ -14,7 +14,6 @@ PKG_MAINTAINER:=
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/c/ca-certificates
PKG_HASH:=43766d5a436519503dfd65ab83488ae33ab4d4ca3d0993797b58c92eb9ed4e63
PKG_BUILD_DIR:=$(BUILD_DIR)/work
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
@ -35,6 +34,13 @@ define Package/ca-bundle
PROVIDES:=ca-certs
endef
define Build/Prepare
$(DECOMPRESS_CMD) $(HOST_TAR) -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
$(Build/Patch)
endef
MAKE_PATH := work
define Build/Install
mkdir -p \
$(PKG_INSTALL_DIR)/usr/sbin \

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=busybox
PKG_VERSION:=1.31.1
PKG_RELEASE:=4
PKG_RELEASE:=6
PKG_FLAGS:=essential
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
@ -50,6 +50,7 @@ define Package/busybox/Default
TITLE:=Core utilities for embedded Linux
URL:=http://busybox.net/
DEPENDS:=+BUSYBOX_CONFIG_PAM:libpam +BUSYBOX_CONFIG_NTPD:jsonfilter
USERID:=ntpd=123:ntpd=123
endef
define Package/busybox
@ -144,6 +145,8 @@ endif
ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_NTPD),)
$(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
$(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
$(INSTALL_DIR) $(1)/etc/capabilities/
$(INSTALL_DATA) ./files/ntpd.capabilities $(1)/etc/capabilities/ntpd.json
endif
-rm -rf $(1)/lib64
endef

View File

@ -32,6 +32,7 @@ start_service() {
for crontab in /etc/crontabs/*; do
procd_set_param file "$crontab"
done
procd_set_param respawn
procd_close_instance
}

View File

@ -0,0 +1,22 @@
{
"bounding": [
"CAP_NET_BIND_SERVICE",
"CAP_SYS_TIME"
],
"effective": [
"CAP_NET_BIND_SERVICE",
"CAP_SYS_TIME"
],
"ambient": [
"CAP_NET_BIND_SERVICE",
"CAP_SYS_TIME"
],
"permitted": [
"CAP_NET_BIND_SERVICE",
"CAP_SYS_TIME"
],
"inheritable": [
"CAP_NET_BIND_SERVICE",
"CAP_SYS_TIME"
]
}

View File

@ -55,6 +55,13 @@ start_ntpd_instance() {
procd_append_param command -p $peer
done
procd_set_param respawn
[ -x /sbin/ujail ] && {
procd_add_jail ntpd
procd_set_param capabilities /etc/capabilities/ntpd.json
procd_set_param user ntpd
procd_set_param group ntpd
procd_set_param no_new_privs 1
}
procd_close_instance
}

View File

@ -0,0 +1,12 @@
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -2414,9 +2414,6 @@ static NOINLINE void ntp_init(char **arg
srand(getpid());
- if (getuid())
- bb_error_msg_and_die(bb_msg_you_must_be_root);
-
/* Set some globals */
G.discipline_jitter = G_precision_sec;
G.stratum = MAXSTRAT;

File diff suppressed because it is too large Load Diff

View File

@ -102,8 +102,15 @@ sub config_sub($$) {
my $cfg1 = shift;
my $cfg2 = shift;
my %config = %{$cfg1};
foreach my $config (keys %$cfg2) {
my @keys = map {
my $expr = $_;
$expr =~ /[?.*]/ ?
map {
/^$expr$/ ? $_ : ()
} keys %config : $expr;
} keys %$cfg2;
foreach my $config (@keys) {
delete $config{$config};
}
return \%config;

1517
scripts/spelling.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
# CONFIG_ARCH_(ENABLE|HAS|HAVE|INLINE|SUPPORTS|USE|WANT)_.* is not set
# CONFIG_AS_.* is not set
# CONFIG_CC_(CAN|HAS|IS|VERSION)_.* is not set
# CONFIG_LD_.* is not set
# CONFIG_GCC_VERSION is not set
# CONFIG_INLINE_.* is not set
# CONFIG_HAVE_(?!(ARCH_TIMER|TCM|SMP)).* is not set

View File

@ -39,7 +39,7 @@
#include "routerboot.h"
#define RB_HARDCONFIG_VER "0.05"
#define RB_HARDCONFIG_VER "0.06"
#define RB_HC_PR_PFX "[rb_hardconfig] "
/* ID values for hardware settings */
@ -76,6 +76,17 @@
#define RB_HW_OPT_HAS_TS_FOR_ADC BIT(22)
#define RB_HW_OPT_HAS_PLC BIT(29)
/*
* Tag ID values for ERD data.
* Mikrotik used to pack all calibration data under a single tag id 0x1, but
* recently switched to a new scheme where each radio calibration gets a
* separate tag. The new scheme has tag id bit 15 always set and seems to be
* mutually exclusive with the old scheme.
*/
#define RB_WLAN_ERD_ID_SOLO 0x0001
#define RB_WLAN_ERD_ID_MULTI_8001 0x8001
#define RB_WLAN_ERD_ID_MULTI_8201 0x8201
static struct kobject *hc_kobj;
static u8 *hc_buf; // ro buffer after init(): no locking required
static size_t hc_buflen;
@ -351,10 +362,22 @@ static ssize_t hc_wlan_data_bin_read(struct file *filp, struct kobject *kobj,
loff_t off, size_t count);
static struct hc_wlan_attr {
const u16 erd_tag_id;
struct bin_attribute battr;
u16 pld_ofs;
u16 pld_len;
} hc_wlandata_battr = {
} hc_wd_multi_battrs[] = {
{
.erd_tag_id = RB_WLAN_ERD_ID_MULTI_8001,
.battr = __BIN_ATTR(data_0, S_IRUSR, hc_wlan_data_bin_read, NULL, 0),
}, {
.erd_tag_id = RB_WLAN_ERD_ID_MULTI_8201,
.battr = __BIN_ATTR(data_2, S_IRUSR, hc_wlan_data_bin_read, NULL, 0),
}
};
static struct hc_wlan_attr hc_wd_solo_battr = {
.erd_tag_id = RB_WLAN_ERD_ID_SOLO,
.battr = __BIN_ATTR(wlan_data, S_IRUSR, hc_wlan_data_bin_read, NULL, 0),
};
@ -426,19 +449,19 @@ static struct hc_attr {
/*
* If the RB_ID_WLAN_DATA payload starts with RB_MAGIC_ERD, then past
* that magic number the payload itself contains a routerboot tag node
* locating the LZO-compressed calibration data at id 0x1.
* locating the LZO-compressed calibration data. So far this scheme is only
* known to use a single tag at id 0x1.
*/
static int hc_wlan_data_unpack_erd(const u8 *inbuf, size_t inlen,
static int hc_wlan_data_unpack_erd(const u16 tag_id, const u8 *inbuf, size_t inlen,
void *outbuf, size_t *outlen)
{
u16 lzo_ofs, lzo_len;
int ret;
/* Find embedded tag */
ret = routerboot_tag_find(inbuf, inlen, 0x1, // always id 1
&lzo_ofs, &lzo_len);
ret = routerboot_tag_find(inbuf, inlen, tag_id, &lzo_ofs, &lzo_len);
if (ret) {
pr_debug(RB_HC_PR_PFX "ERD data not found\n");
pr_debug(RB_HC_PR_PFX "no ERD data for id 0x%04x\n", tag_id);
goto fail;
}
@ -461,10 +484,10 @@ fail:
* that magic number is a payload that must be appended to the hc_lzor_prefix,
* the resulting blob is LZO-compressed. In the LZO decompression result,
* the RB_MAGIC_ERD magic number (aligned) must be located. Following that
* magic, there is a routerboot tag node (id 0x1) locating the RLE-encoded
* magic, there is one or more routerboot tag node(s) locating the RLE-encoded
* calibration data payload.
*/
static int hc_wlan_data_unpack_lzor(const u8 *inbuf, size_t inlen,
static int hc_wlan_data_unpack_lzor(const u16 tag_id, const u8 *inbuf, size_t inlen,
void *outbuf, size_t *outlen)
{
u16 rle_ofs, rle_len;
@ -492,10 +515,8 @@ static int hc_wlan_data_unpack_lzor(const u8 *inbuf, size_t inlen,
if (ret) {
if (LZO_E_INPUT_NOT_CONSUMED == ret) {
/*
* The tag length appears to always be aligned (probably
* because it is the "root" RB_ID_WLAN_DATA tag), thus
* the LZO payload may be padded, which can trigger a
* spurious error which we ignore here.
* The tag length is always aligned thus the LZO payload may be padded,
* which can trigger a spurious error which we ignore here.
*/
pr_debug(RB_HC_PR_PFX "LZOR: LZO EOF before buffer end - this may be harmless\n");
} else {
@ -520,9 +541,9 @@ static int hc_wlan_data_unpack_lzor(const u8 *inbuf, size_t inlen,
templen -= (u8 *)needle - tempbuf;
/* Past magic. Look for tag node */
ret = routerboot_tag_find((u8 *)needle, templen, 0x1, &rle_ofs, &rle_len);
ret = routerboot_tag_find((u8 *)needle, templen, tag_id, &rle_ofs, &rle_len);
if (ret) {
pr_debug(RB_HC_PR_PFX "LZOR: RLE data not found\n");
pr_debug(RB_HC_PR_PFX "LZOR: no RLE data for id 0x%04x\n", tag_id);
goto fail;
}
@ -542,7 +563,7 @@ fail:
return ret;
}
static int hc_wlan_data_unpack(const size_t tofs, size_t tlen,
static int hc_wlan_data_unpack(const u16 tag_id, const size_t tofs, size_t tlen,
void *outbuf, size_t *outlen)
{
const u8 *lbuf;
@ -562,23 +583,25 @@ static int hc_wlan_data_unpack(const size_t tofs, size_t tlen,
/* Skip magic */
lbuf += sizeof(magic);
tlen -= sizeof(magic);
ret = hc_wlan_data_unpack_lzor(lbuf, tlen, outbuf, outlen);
ret = hc_wlan_data_unpack_lzor(tag_id, lbuf, tlen, outbuf, outlen);
break;
case RB_MAGIC_ERD:
/* Skip magic */
lbuf += sizeof(magic);
tlen -= sizeof(magic);
ret = hc_wlan_data_unpack_erd(lbuf, tlen, outbuf, outlen);
ret = hc_wlan_data_unpack_erd(tag_id, lbuf, tlen, outbuf, outlen);
break;
default:
/*
* If the RB_ID_WLAN_DATA payload doesn't start with a
* magic number, the payload itself is the raw RLE-encoded
* calibration data.
* calibration data. Only RB_WLAN_ERD_ID_SOLO makes sense here.
*/
ret = routerboot_rle_decode(lbuf, tlen, outbuf, outlen);
if (ret)
pr_debug(RB_HC_PR_PFX "RLE decoding error (%d)\n", ret);
if (RB_WLAN_ERD_ID_SOLO == tag_id) {
ret = routerboot_rle_decode(lbuf, tlen, outbuf, outlen);
if (ret)
pr_debug(RB_HC_PR_PFX "RLE decoding error (%d)\n", ret);
}
break;
}
@ -633,7 +656,7 @@ static ssize_t hc_wlan_data_bin_read(struct file *filp, struct kobject *kobj,
if (!outbuf)
return -ENOMEM;
ret = hc_wlan_data_unpack(hc_wattr->pld_ofs, hc_wattr->pld_len, outbuf, &outlen);
ret = hc_wlan_data_unpack(hc_wattr->erd_tag_id, hc_wattr->pld_ofs, hc_wattr->pld_len, outbuf, &outlen);
if (ret) {
kfree(outbuf);
return ret;
@ -655,14 +678,17 @@ static ssize_t hc_wlan_data_bin_read(struct file *filp, struct kobject *kobj,
int __init rb_hardconfig_init(struct kobject *rb_kobj)
{
struct kobject *hc_wlan_kobj;
struct mtd_info *mtd;
size_t bytes_read, buflen;
size_t bytes_read, buflen, outlen;
const u8 *buf;
int i, ret;
void *outbuf;
int i, j, ret;
u32 magic;
hc_buf = NULL;
hc_kobj = NULL;
hc_wlan_kobj = NULL;
// TODO allow override
mtd = get_mtd_device_nm(RB_MTD_HARD_CONFIG);
@ -713,15 +739,62 @@ int __init rb_hardconfig_init(struct kobject *rb_kobj)
/* Account for skipped magic */
hc_attrs[i].pld_ofs += sizeof(magic);
/* Special case RB_ID_WLAN_DATA to prep and create the binary attribute */
/*
* Special case RB_ID_WLAN_DATA to prep and create the binary attribute.
* We first check if the data is "old style" within a single tag (or no tag at all):
* If it is we publish this single blob as a binary attribute child of hc_kobj to
* preserve backward compatibility.
* If it isn't and instead uses multiple ERD tags, we create a subfolder and
* publish the known ones there.
*/
if ((RB_ID_WLAN_DATA == hc_attrs[i].tag_id) && hc_attrs[i].pld_len) {
hc_wlandata_battr.pld_ofs = hc_attrs[i].pld_ofs;
hc_wlandata_battr.pld_len = hc_attrs[i].pld_len;
outlen = RB_ART_SIZE;
outbuf = kmalloc(outlen, GFP_KERNEL);
if (!outbuf) {
pr_warn(RB_HC_PR_PFX "Out of memory parsing WLAN tag\n");
continue;
}
ret = sysfs_create_bin_file(hc_kobj, &hc_wlandata_battr.battr);
if (ret)
pr_warn(RB_HC_PR_PFX "Could not create %s sysfs entry (%d)\n",
hc_wlandata_battr.battr.attr.name, ret);
/* Test ID_SOLO first, if found: done */
ret = hc_wlan_data_unpack(RB_WLAN_ERD_ID_SOLO, hc_attrs[i].pld_ofs, hc_attrs[i].pld_len, outbuf, &outlen);
if (!ret) {
hc_wd_solo_battr.pld_ofs = hc_attrs[i].pld_ofs;
hc_wd_solo_battr.pld_len = hc_attrs[i].pld_len;
ret = sysfs_create_bin_file(hc_kobj, &hc_wd_solo_battr.battr);
if (ret)
pr_warn(RB_HC_PR_PFX "Could not create %s sysfs entry (%d)\n",
hc_wd_solo_battr.battr.attr.name, ret);
}
/* Otherwise, create "wlan_data" subtree and publish known data */
else {
hc_wlan_kobj = kobject_create_and_add("wlan_data", hc_kobj);
if (!hc_wlan_kobj) {
kfree(outbuf);
pr_warn(RB_HC_PR_PFX "Could not create wlan_data sysfs folder\n");
continue;
}
for (j = 0; j < ARRAY_SIZE(hc_wd_multi_battrs); j++) {
outlen = RB_ART_SIZE;
ret = hc_wlan_data_unpack(hc_wd_multi_battrs[j].erd_tag_id,
hc_attrs[i].pld_ofs, hc_attrs[i].pld_len, outbuf, &outlen);
if (ret) {
hc_wd_multi_battrs[j].pld_ofs = hc_wd_multi_battrs[j].pld_len = 0;
continue;
}
hc_wd_multi_battrs[j].pld_ofs = hc_attrs[i].pld_ofs;
hc_wd_multi_battrs[j].pld_len = hc_attrs[i].pld_len;
ret = sysfs_create_bin_file(hc_wlan_kobj, &hc_wd_multi_battrs[j].battr);
if (ret)
pr_warn(RB_HC_PR_PFX "Could not create wlan_data/%s sysfs entry (%d)\n",
hc_wd_multi_battrs[j].battr.attr.name, ret);
}
}
kfree(outbuf);
}
/* All other tags are published via standard attributes */
else {

View File

@ -126,7 +126,7 @@ CONFIG_EFI_RUNTIME_MAP=y
CONFIG_EFI_RUNTIME_WRAPPERS=y
CONFIG_EFI_STUB=y
# CONFIG_EFI_TEST is not set
CONFIG_EFI_VARS=y
# CONFIG_EFI_VARS is not set
# CONFIG_EISA is not set
# CONFIG_EL3 is not set
CONFIG_FAILOVER=y

View File

@ -12,8 +12,8 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=70ee5e8b573f76745760dd6b75f705590fc1923a
PKG_MIRROR_HASH:=d816dc7658446c2969d307730b58df5f8a65853b4e57a655895feb685590d63b
PKG_SOURCE_VERSION:=5c36293f067d2af16e4eb9f9465be36f346ea6d0
PKG_MIRROR_HASH:=f01b467843af97fe29dd67d0dc52e8f2effc968258ae806af37be085239a3e4c
PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz

View File

@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME := firmware-utils
PKG_RELEASE := 4
PKG_RELEASE := 5
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/kernel.mk

View File

@ -47,7 +47,7 @@ static unsigned char buf_pattern[4096], buf[4096];
int main(int argc, char **argv)
{
int k_off = 0, ptn = 0, c, ret = EXIT_SUCCESS;
int k_off = 0, ptn = 1, c, ret = EXIT_SUCCESS;
char *ifn = NULL, *ofn = NULL, *key = NULL;
size_t n, k_len;
FILE *out, *in;
@ -99,11 +99,11 @@ int main(int argc, char **argv)
while ((n = fread(buf, 1, sizeof(buf), in)) > 0) {
for (int i = 0; i < n; i++) {
buf_pattern[i] = ptn + 1;
buf_pattern[i] = ptn;
ptn++;
if (ptn > 250)
ptn = 0;
if (ptn > PATTERN_LEN)
ptn = 1;
}
k_off = xor_pattern(buf_pattern, n, key, k_len, k_off);