Merge Official Source

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2023-11-02 12:47:01 +08:00
commit 3f9bf2c41b
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
12 changed files with 315 additions and 15 deletions

View File

@ -26,6 +26,14 @@ menu "Global build settings"
directory containing machine readable list of built profiles
and resulting images.
config JSON_CYCLONEDX_SBOM
bool "Create CycloneDX SBOM JSON"
default BUILDBOT
help
Create a JSON files *.bom.cdx.json in the build
directory containing Software Bill Of Materials in CycloneDX
format.
config ALL_NONSHARED
bool "Select all target specific packages by default"
select ALL_KMODS

View File

@ -277,6 +277,11 @@ endef
define Image/Manifest
$(call opkg,$(TARGET_DIR_ORIG)) list-installed > \
$(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest
$(if $(CONFIG_JSON_CYCLONEDX_SBOM), \
$(SCRIPT_DIR)/package-metadata.pl imgcyclonedxsbom \
$(TMP_DIR)/.packageinfo \
$(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest > \
$(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).bom.cdx.json)
endef
define Image/gzip-ext4-padded-squashfs

View File

@ -36,6 +36,8 @@ $(if $(USERID),Require-User: $(USERID)
)Source: $(PKG_SOURCE)
$(if $(LICENSE),License: $(LICENSE)
)$(if $(LICENSE_FILES),LicenseFiles: $(LICENSE_FILES)
)$(if $(PKG_CPE_ID),CPE-ID: $(PKG_CPE_ID)
)$(if $(ABI_VERSION),ABI-Version: $(ABI_VERSION)
)Type: $(if $(Package/$(1)/targets),$(Package/$(1)/targets),$(if $(PKG_TARGETS),$(PKG_TARGETS),ipkg))
$(if $(KCONFIG),Kernel-Config: $(KCONFIG)
)$(if $(BUILDONLY),Build-Only: $(BUILDONLY)

View File

@ -106,6 +106,14 @@ ifdef CONFIG_SIGNED_PACKAGES
$(STAGING_DIR_HOST)/bin/usign -S -m Packages -s $(BUILD_KEY); \
); done
endif
ifdef CONFIG_JSON_CYCLONEDX_SBOM
@echo Creating CycloneDX package SBOMs...
@for d in $(PACKAGE_SUBDIRS); do ( \
[ -d $$d ] && \
cd $$d || continue; \
$(SCRIPT_DIR)/package-metadata.pl pkgcyclonedxsbom Packages.manifest > Packages.bom.cdx.json || true; \
); done
endif
$(curdir)/flags-install:= -j1

View File

@ -141,7 +141,7 @@
+CONFIG_LMB_MAX_REGIONS=64
--- /dev/null
+++ b/configs/mt7986a_bpi-r3-mini-snand_defconfig
@@ -0,0 +1,137 @@
@@ -0,0 +1,138 @@
+CONFIG_ARM=y
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
+CONFIG_POSITION_INDEPENDENT=y

View File

@ -0,0 +1,62 @@
From: David Bauer <mail@david-bauer.net>
To: hostap@lists.infradead.org
Cc: =?utf-8?q?=C3=89tienne_Morice?= <neon.emorice@mail.com>
Subject: [PATCH] nl80211: add extra-ies only if allowed by driver
Date: Sun, 30 Jan 2022 20:22:00 +0100
Message-Id: <20220130192200.10883-1-mail@david-bauer.net>
List-Id: <hostap.lists.infradead.org>
Upgrading wpa_supplicant from 2.9 to 2.10 breaks broadcom-wl
based adapters. The reason for it is hostapd tries to install additional
IEs for scanning while the driver does not support this.
The kernel indicates the maximum number of bytes for additional scan IEs
using the NL80211_ATTR_MAX_SCAN_IE_LEN attribute. Save this value and
only add additional scan IEs in case the driver can accommodate these
additional IEs.
Reported-by: Étienne Morice <neon.emorice@mail.com>
Tested-by: Étienne Morice <neon.emorice@mail.com>
Signed-off-by: David Bauer <mail@david-bauer.net>
---
src/drivers/driver.h | 3 +++
src/drivers/driver_nl80211_capa.c | 4 ++++
src/drivers/driver_nl80211_scan.c | 2 +-
3 files changed, 8 insertions(+), 1 deletion(-)
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2283,6 +2283,9 @@ struct wpa_driver_capa {
/** Maximum number of iterations in a single scan plan */
u32 max_sched_scan_plan_iterations;
+ /** Maximum number of extra IE bytes for scans */
+ u16 max_scan_ie_len;
+
/** Whether sched_scan (offloaded scanning) is supported */
int sched_scan_supported;
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -949,6 +949,10 @@ static int wiphy_info_handler(struct nl_
nla_get_u32(tb[NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS]);
}
+ if (tb[NL80211_ATTR_MAX_SCAN_IE_LEN])
+ capa->max_scan_ie_len =
+ nla_get_u16(tb[NL80211_ATTR_MAX_SCAN_IE_LEN]);
+
if (tb[NL80211_ATTR_MAX_MATCH_SETS])
capa->max_match_sets =
nla_get_u8(tb[NL80211_ATTR_MAX_MATCH_SETS]);
--- a/src/drivers/driver_nl80211_scan.c
+++ b/src/drivers/driver_nl80211_scan.c
@@ -222,7 +222,7 @@ nl80211_scan_common(struct i802_bss *bss
wpa_printf(MSG_DEBUG, "nl80211: Passive scan requested");
}
- if (params->extra_ies) {
+ if (params->extra_ies && drv->capa.max_scan_ie_len >= params->extra_ies_len) {
wpa_hexdump(MSG_MSGDUMP, "nl80211: Scan extra IEs",
params->extra_ies, params->extra_ies_len);
if (nla_put(msg, NL80211_ATTR_IE, params->extra_ies_len,

View File

@ -5,9 +5,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/urngd.git
PKG_SOURCE_DATE:=2023-07-25
PKG_SOURCE_VERSION:=7aefb47be57df0467d97d539f7fe9e23e607a3b4
PKG_MIRROR_HASH:=427d4228fd65cf4320b8c212e710b86bcbfcdd4239f4e67132b3b471f7437202
PKG_SOURCE_DATE:=2023-11-01
PKG_SOURCE_VERSION:=44365eb1e1165f2a44cb31f404b04cf85031718e
PKG_MIRROR_HASH:=743bdfacf1f1e779047a55fe8f388aaf31f6e55e8a4d0a00fcabffb68af2202e
PKG_LICENSE:=GPL-2.0 BSD-3-Clause
PKG_LICENSE_FILES:=

View File

@ -2,7 +2,7 @@ package metadata;
use base 'Exporter';
use strict;
use warnings;
our @EXPORT = qw(%package %vpackage %srcpackage %category %overrides clear_packages parse_package_metadata parse_target_metadata get_multiline @ignore %usernames %groupnames);
our @EXPORT = qw(%package %vpackage %srcpackage %category %overrides clear_packages parse_package_metadata parse_package_manifest_metadata parse_target_metadata get_multiline @ignore %usernames %groupnames);
our %package;
our %vpackage;
@ -256,6 +256,8 @@ sub parse_package_metadata($) {
/^Source: \s*(.+)\s*$/ and $pkg->{source} = $1;
/^License: \s*(.+)\s*$/ and $pkg->{license} = $1;
/^LicenseFiles: \s*(.+)\s*$/ and $pkg->{licensefiles} = $1;
/^CPE-ID: \s*(.+)\s*$/ and $pkg->{cpe_id} = $1;
/^ABI-Version: \s*(.+)\s*$/ and $pkg->{abi_version} = $1;
/^Default: \s*(.+)\s*$/ and $pkg->{default} = $1;
/^Provides: \s*(.+)\s*$/ and do {
my @vpkg = split /\s+/, $1;
@ -315,4 +317,42 @@ sub parse_package_metadata($) {
return 1;
}
sub parse_package_manifest_metadata($) {
my $file = shift;
my $pkg;
my %pkgs;
open FILE, "<$file" or do {
warn "Cannot open '$file': $!\n";
return undef;
};
while (<FILE>) {
chomp;
/^Package:\s*(.+?)\s*$/ and do {
$pkg = {};
$pkg->{name} = $1;
$pkg->{depends} = [];
$pkgs{$1} = $pkg;
};
/^Version:\s*(.+)\s*$/ and $pkg->{version} = $1;
/^Depends:\s*(.+)\s*$/ and $pkg->{depends} = [ split /\s+/, $1 ];
/^Source:\s*(.+)\s*$/ and $pkg->{source} = $1;
/^SourceName:\s*(.+)\s*$/ and $pkg->{sourcename} = $1;
/^License:\s*(.+)\s*$/ and $pkg->{license} = $1;
/^LicenseFiles:\s*(.+)\s*$/ and $pkg->{licensefiles} = $1;
/^Section:\s*(.+)\s*$/ and $pkg->{section} = $1;
/^SourceDateEpoch: \s*(.+)\s*$/ and $pkg->{sourcedateepoch} = $1;
/^CPE-ID:\s*(.+)\s*$/ and $pkg->{cpe_id} = $1;
/^Architecture:\s*(.+)\s*$/ and $pkg->{architecture} = $1;
/^Installed-Size:\s*(.+)\s*$/ and $pkg->{installedsize} = $1;
/^Filename:\s*(.+)\s*$/ and $pkg->{filename} = $1;
/^Size:\s*(\d+)\s*$/ and $pkg->{size} = $1;
/^SHA256sum:\s*(.*)\s*$/ and $pkg->{sha256sum} = $1;
}
close FILE;
return %pkgs;
}
1;

View File

@ -4,6 +4,8 @@ use lib "$FindBin::Bin";
use strict;
use metadata;
use Getopt::Long;
use Time::Piece;
use JSON::PP;
my %board;
@ -611,6 +613,7 @@ ${json}{
"version":"$pkg->{version}",
"category":"$pkg->{category}",
"license":"$pkg->{license}",
"cpe_id":"$pkg->{cpe_id}",
"maintainer": [$pkg_maintainer],
"depends":[$pkg_deps]},
END_JSON
@ -621,6 +624,173 @@ END_JSON
print "[$json]";
}
sub image_manifest_packages($)
{
my %packages;
my $imgmanifest = shift;
open FILE, "<$imgmanifest" or return;
while (<FILE>) {
/^(.+?) - (.+)$/ and $packages{$1} = $2;
}
close FILE;
return %packages;
}
sub dump_cyclonedxsbom_json {
my (@components) = @_;
my $uuid = sprintf(
"%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
rand(0xffff), rand(0xffff), rand(0xffff),
rand(0x0fff) | 0x4000,
rand(0x3fff) | 0x8000,
rand(0xffff), rand(0xffff), rand(0xffff)
);
my $cyclonedx = {
bomFormat => "CycloneDX",
specVersion => "1.4",
serialNumber => "urn:uuid:$uuid",
version => 1,
metadata => {
timestamp => gmtime->datetime,
},
"components" => [@components],
};
return encode_json($cyclonedx);
}
sub gen_image_cyclonedxsbom() {
my $pkginfo = shift @ARGV;
my $imgmanifest = shift @ARGV;
my @components;
my %image_packages;
%image_packages = image_manifest_packages($imgmanifest);
%image_packages or exit 1;
parse_package_metadata($pkginfo) or exit 1;
$package{"kernel"} = {
license => "GPL-2.0",
cpe_id => "cpe:/o:linux:linux_kernel",
name => "kernel",
};
my %abimap;
my @abipkgs = grep { defined $package{$_}->{abi_version} } keys %package;
foreach my $name (@abipkgs) {
my $pkg = $package{$name};
my $abipkg = $name . $pkg->{abi_version};
$abimap{$abipkg} = $name;
}
foreach my $name (sort {uc($a) cmp uc($b)} keys %image_packages) {
my $pkg = $package{$name};
if (!$pkg) {
$pkg = $package{$abimap{$name}};
next if !$pkg;
}
my @licenses;
my @license = split(/\s+/, $pkg->{license});
foreach my $lic (@license) {
push @licenses, (
{ "license" => { "name" => $lic } }
);
}
my $type;
if ($pkg->{category}) {
my $category = $pkg->{category};
my %cat_type = (
"Firmware" => "firmware",
"Libraries" => "library"
);
if ($cat_type{$category}) {
$type = $cat_type{$category};
} else {
$type = "application";
}
}
my $version = $pkg->{version};
if ($image_packages{$name}) {
$version = $image_packages{$name};
}
$version =~ s/-\d+$// if $version;
if ($name =~ /^(kernel|kmod-)/ and $version =~ /^(\d+\.\d+\.\d+)/) {
$version = $1;
}
push @components, {
name => $pkg->{name},
version => $version,
@licenses > 0 ? (licenses => [ @licenses ]) : (),
$pkg->{cpe_id} ? (cpe => $pkg->{cpe_id}.":".$version) : (),
$type ? (type => $type) : (),
$version ? (version => $version) : (),
};
}
print dump_cyclonedxsbom_json(@components);
}
sub gen_package_cyclonedxsbom() {
my $pkgmanifest = shift @ARGV;
my @components;
my %mpkgs;
%mpkgs = parse_package_manifest_metadata($pkgmanifest);
%mpkgs or exit 1;
foreach my $name (sort {uc($a) cmp uc($b)} keys %mpkgs) {
my $pkg = $mpkgs{$name};
my @licenses;
my @license = split(/\s+/, $pkg->{license});
foreach my $lic (@license) {
push @licenses, (
{ "license" => { "name" => $lic } }
);
}
my $type;
if ($pkg->{section}) {
my $section = $pkg->{section};
my %section_type = (
"firmware" => "firmware",
"libs" => "library"
);
if ($section_type{$section}) {
$type = $section_type{$section};
} else {
$type = "application";
}
}
my $version = $pkg->{version};
$version =~ s/-\d+$// if $version;
if ($name =~ /^(kernel|kmod-)/ and $version =~ /^(\d+\.\d+\.\d+)/) {
$version = $1;
}
push @components, {
name => $name,
version => $version,
@licenses > 0 ? (licenses => [ @licenses ]) : (),
$pkg->{cpe_id} ? (cpe => $pkg->{cpe_id}.":".$version) : (),
$type ? (type => $type) : (),
$version ? (version => $version) : (),
};
}
print dump_cyclonedxsbom_json(@components);
}
sub parse_command() {
GetOptions("ignore=s", \@ignore);
my $cmd = shift @ARGV;
@ -631,6 +801,8 @@ sub parse_command() {
/^source$/ and return gen_package_source();
/^pkgaux$/ and return gen_package_auxiliary();
/^pkgmanifestjson$/ and return gen_package_manifest_json();
/^imgcyclonedxsbom$/ and return gen_image_cyclonedxsbom();
/^pkgcyclonedxsbom$/ and return gen_package_cyclonedxsbom();
/^license$/ and return gen_package_license(0);
/^licensefull$/ and return gen_package_license(1);
/^usergroup$/ and return gen_usergroup_list();
@ -638,15 +810,17 @@ sub parse_command() {
}
die <<EOF
Available Commands:
$0 mk [file] Package metadata in makefile format
$0 config [file] Package metadata in Kconfig format
$0 mk [file] Package metadata in makefile format
$0 config [file] Package metadata in Kconfig format
$0 kconfig [file] [config] [patchver] Kernel config overrides
$0 source [file] Package source file information
$0 pkgaux [file] Package auxiliary variables in makefile format
$0 pkgmanifestjson [file] Package manifests in JSON format
$0 license [file] Package license information
$0 source [file] Package source file information
$0 pkgaux [file] Package auxiliary variables in makefile format
$0 pkgmanifestjson [file] Package manifests in JSON format
$0 imgcyclonedxsbom <file> [manifest] Image package manifest in CycloneDX SBOM JSON format
$0 pkgcyclonedxsbom <file> Package manifest in CycloneDX SBOM JSON format
$0 license [file] Package license information
$0 licensefull [file] Package license information (full list)
$0 usergroup [file] Package usergroup allocation list
$0 usergroup [file] Package usergroup allocation list
$0 version_filter [patchver] [list...] Filter list of version tagged strings
Options:

View File

@ -120,7 +120,7 @@ mediatek_setup_macs()
cmcc,rax3000m-emmc-ubootmod)
wan_mac=$(mmc_get_mac_binary factory 0x2a)
lan_mac=$(mmc_get_mac_binary factory 0x24)
label=$wan_mac
label_mac=$wan_mac
;;
glinet,gl-mt6000)
label_mac=$(mmc_get_mac_binary factory 0x0a)

View File

@ -23,7 +23,7 @@ ifeq ($(HOST_OS),Darwin)
HOST_CFLAGS += -I/opt/homebrew/include
endif
HOST_CFLAGS += -Wno-error
HOST_CFLAGS += -Wno-error -fPIC
HOST_CONFIGURE_ARGS += \
--without-libintl-prefix \
@ -34,6 +34,7 @@ HOST_CONFIGURE_ARGS += \
--disable-shared \
--enable-static \
--without-lzma \
--without-bzlib \
--without-zstd
ifeq ($(HOST_OS),Darwin)

View File

@ -291,7 +291,7 @@
case DW_TAG_rvalue_reference_type
+#define auxv_info_alias(arch) \
+ int EBLHOOK_1(arch, auxv_info) (GElf_Xword a_type, const char **name, const char **format) \
+ int EBLHOOK_1(arch ## _, auxv_info) (GElf_Xword a_type, const char **name, const char **format) \
+ { \
+ return EBLHOOK(auxv_info)(a_type, name, format); \
+ }