Merge Official Source

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen
2023-11-10 13:03:58 +08:00
20 changed files with 170 additions and 78 deletions

View File

@@ -277,11 +277,13 @@ endef
define Image/Manifest
$(call opkg,$(TARGET_DIR_ORIG)) list-installed > \
$(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest
ifndef IB
$(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)
endif
endef
define Image/gzip-ext4-padded-squashfs

View File

@@ -940,7 +940,7 @@ mac80211_setup_supplicant() {
if [ "$mode" = "sta" ]; then
wpa_supplicant_add_network "$ifname"
else
wpa_supplicant_add_network "$ifname" "$freq" "$htmode" "$noscan"
wpa_supplicant_add_network "$ifname" "$freq" "$htmode" "$hostapd_noscan"
fi
wpa_supplicant_add_interface "$ifname" "$mode"

View File

@@ -104,7 +104,7 @@ config MBEDTLS_ECP_DP_SECP384R1_ENABLED
config MBEDTLS_ECP_DP_SECP521R1_ENABLED
bool "MBEDTLS_ECP_DP_SECP521R1_ENABLED"
default n
default y
config MBEDTLS_ECP_DP_SECP192K1_ENABLED
bool "MBEDTLS_ECP_DP_SECP192K1_ENABLED"

View File

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=mbedtls
PKG_VERSION:=2.28.5
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz

View File

@@ -5,9 +5,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
PKG_SOURCE_DATE:=2023-10-20
PKG_SOURCE_VERSION:=5590a80e2566d378be955f61c287a63fb3bdf329
PKG_MIRROR_HASH:=eef792b4e9fa7a5227cf8c2ec4ed5e6558dd04c119cd9f97561923821fd1aa92
PKG_SOURCE_DATE:=2023-11-07
PKG_SOURCE_VERSION:=516ab774cc16d4b04b3b17a067cbf2649f1adaeb
PKG_MIRROR_HASH:=76dcc7988d8ade7e8a80af8a79e9b509093c5eea9e785b0e5f7aef845787118a
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=GPL-2.0

View File

@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=hostapd
PKG_RELEASE:=5
PKG_RELEASE:=6
PKG_SOURCE_URL:=http://w1.fi/hostap.git
PKG_SOURCE_PROTO:=git

View File

@@ -10,6 +10,36 @@ const iftypes = {
monitor: nl80211.const.NL80211_IFTYPE_MONITOR,
};
const mesh_params = {
mesh_retry_timeout: "retry_timeout",
mesh_confirm_timeout: "confirm_timeout",
mesh_holding_timeout: "holding_timeout",
mesh_max_peer_links: "max_peer_links",
mesh_max_retries: "max_retries",
mesh_ttl: "ttl",
mesh_element_ttl: "element_ttl",
mesh_auto_open_plinks: "auto_open_plinks",
mesh_hwmp_max_preq_retries: "hwmp_max_preq_retries",
mesh_path_refresh_time: "path_refresh_time",
mesh_min_discovery_timeout: "min_discovery_timeout",
mesh_hwmp_active_path_timeout: "hwmp_active_path_timeout",
mesh_hwmp_preq_min_interval: "hwmp_preq_min_interval",
mesh_hwmp_net_diameter_traversal_time: "hwmp_net_diam_trvs_time",
mesh_hwmp_rootmode: "hwmp_rootmode",
mesh_hwmp_rann_interval: "hwmp_rann_interval",
mesh_gate_announcements: "gate_announcements",
mesh_sync_offset_max_neighor: "sync_offset_max_neighbor",
mesh_rssi_threshold: "rssi_threshold",
mesh_hwmp_active_path_to_root_timeout: "hwmp_path_to_root_timeout",
mesh_hwmp_root_interval: "hwmp_root_interval",
mesh_hwmp_confirmation_interval: "hwmp_confirmation_interval",
mesh_awake_window: "awake_window",
mesh_plink_timeout: "plink_timeout",
mesh_fwding: "forwarding",
mesh_power_mode: "power_mode",
mesh_nolearn: "nolearn"
};
function wdev_remove(name)
{
nl80211.request(nl80211.const.NL80211_CMD_DEL_INTERFACE, 0, { dev: name });
@@ -94,6 +124,31 @@ function wdev_create(phy, name, data)
return null;
}
function wdev_set_mesh_params(name, data)
{
let mesh_cfg = {};
for (let key in mesh_params) {
let val = data[key];
if (val == null)
continue;
mesh_cfg[mesh_params[key]] = int(val);
}
if (!length(mesh_cfg))
return null;
nl80211.request(nl80211.const.NL80211_CMD_SET_MESH_CONFIG, 0,
{ dev: name, mesh_params: mesh_cfg });
return nl80211.error();
}
function wdev_set_up(name, up)
{
rtnl.request(rtnl.const.RTM_SETLINK, 0, { dev: name, change: 1, flags: up ? 1 : 0 });
}
function phy_sysfs_file(phy, name)
{
return trim(readfile(`/sys/class/ieee80211/${phy}/${name}`));
@@ -315,4 +370,4 @@ function vlist_new(cb) {
}, vlist_proto);
}
export { wdev_remove, wdev_create, is_equal, vlist_new, phy_is_fullmac, phy_open };
export { wdev_remove, wdev_create, wdev_set_mesh_params, wdev_set_up, is_equal, vlist_new, phy_is_fullmac, phy_open };

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env ucode
'use strict';
import { vlist_new, is_equal, wdev_create, wdev_remove, phy_open } from "/usr/share/hostap/common.uc";
import { vlist_new, is_equal, wdev_create, wdev_set_mesh_params, wdev_remove, wdev_set_up, phy_open } from "/usr/share/hostap/common.uc";
import { readfile, writefile, basename, readlink, glob } from "fs";
let libubus = require("ubus");
@@ -9,17 +9,6 @@ let phy = shift(ARGV);
let command = shift(ARGV);
let phydev;
const mesh_params = [
"mesh_retry_timeout", "mesh_confirm_timeout", "mesh_holding_timeout", "mesh_max_peer_links",
"mesh_max_retries", "mesh_ttl", "mesh_element_ttl", "mesh_hwmp_max_preq_retries",
"mesh_path_refresh_time", "mesh_min_discovery_timeout", "mesh_hwmp_active_path_timeout",
"mesh_hwmp_preq_min_interval", "mesh_hwmp_net_diameter_traversal_time", "mesh_hwmp_rootmode",
"mesh_hwmp_rann_interval", "mesh_gate_announcements", "mesh_sync_offset_max_neighor",
"mesh_rssi_threshold", "mesh_hwmp_active_path_to_root_timeout", "mesh_hwmp_root_interval",
"mesh_hwmp_confirmation_interval", "mesh_awake_window", "mesh_plink_timeout",
"mesh_auto_open_plinks", "mesh_fwding", "mesh_power_mode"
];
function iface_stop(wdev)
{
if (keep_devices[wdev.ifname])
@@ -33,7 +22,7 @@ function iface_start(wdev)
let ifname = wdev.ifname;
if (readfile(`/sys/class/net/${ifname}/ifindex`)) {
system([ "ip", "link", "set", "dev", ifname, "down" ]);
wdev_set_up(ifname, false);
wdev_remove(ifname);
}
let wdev_config = {};
@@ -42,7 +31,7 @@ function iface_start(wdev)
if (!wdev_config.macaddr && wdev.mode != "monitor")
wdev_config.macaddr = phydev.macaddr_next();
wdev_create(phy, ifname, wdev_config);
system([ "ip", "link", "set", "dev", ifname, "up" ]);
wdev_set_up(ifname, true);
if (wdev.freq)
system(`iw dev ${ifname} set freq ${wdev.freq} ${wdev.htmode}`);
if (wdev.mode == "adhoc") {
@@ -60,19 +49,8 @@ function iface_start(wdev)
push(cmd, key, wdev[key]);
system(cmd);
cmd = ["iw", "dev", ifname, "set", "mesh_param" ];
let len = length(cmd);
for (let param in mesh_params)
if (wdev[param])
push(cmd, param, wdev[param]);
if (len == length(cmd))
return;
system(cmd);
wdev_set_mesh_params(ifname, wdev);
}
}
function iface_cb(new_if, old_if)

View File

@@ -1,6 +1,6 @@
let libubus = require("ubus");
import { open, readfile } from "fs";
import { wdev_create, wdev_remove, is_equal, vlist_new, phy_open } from "common";
import { wdev_create, wdev_set_mesh_params, wdev_remove, is_equal, wdev_set_up, vlist_new, phy_open } from "common";
let ubus = libubus.connect();
@@ -40,6 +40,7 @@ function iface_start(phydev, iface, macaddr_list)
let ret = wdev_create(phy, ifname, wdev_config);
if (ret)
wpas.printf(`Failed to create device ${ifname}: ${ret}`);
wdev_set_up(ifname, true);
wpas.add_iface(iface.config);
iface.running = true;
}
@@ -316,6 +317,23 @@ return {
}
iface_hostapd_notify(phy, ifname, iface, state);
if (state != "COMPLETED")
return;
let phy_data = wpas.data.config[phy];
if (!phy_data)
return;
let iface_data = phy_data.data[ifname];
if (!iface_data)
return;
let wdev_config = iface_data.config;
if (!wdev_config || wdev_config.mode != "mesh")
return;
wdev_set_mesh_params(ifname, wdev_config);
},
event: function(ifname, iface, ev, info) {
let phy = wpas.data.iface_phy[ifname];

View File

@@ -24,8 +24,8 @@
frequency);
goto out_free;
}
+ if (ssid->noscan)
+ conf->noscan = 1;
+ if (conf->noscan)
+ ssid->noscan = 1;
if (ssid->mesh_basic_rates == NULL) {
/*
@@ -45,7 +45,7 @@
unsigned int j;
static const int ht40plus[] = {
- 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157, 165, 173,
+ 1, 2, 3, 4, 5, 6, 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157, 165, 173,
+ 1, 2, 3, 4, 5, 6, 7, 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157, 165, 173,
184, 192
};
int ht40 = -1;
@@ -58,6 +58,15 @@
u8 channel;
bool is_6ghz;
bool dfs_enabled = wpa_s->conf->country[0] && (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR);
@@ -3080,6 +3080,8 @@ void ibss_mesh_setup_freq(struct wpa_sup
freq->he_enabled = ibss_mesh_can_use_he(wpa_s, ssid, mode,
ieee80211_mode);
freq->channel = channel;
+ if (mode->mode == HOSTAPD_MODE_IEEE80211G && ssid->noscan)
+ ibss_mesh_select_40mhz(wpa_s, ssid, mode, freq, obss_scan, dfs_enabled);
/* Setup higher BW only for 5 GHz */
if (mode->mode == HOSTAPD_MODE_IEEE80211A) {
ibss_mesh_select_40mhz(wpa_s, ssid, mode, freq, obss_scan, dfs_enabled);
--- a/wpa_supplicant/config_ssid.h
+++ b/wpa_supplicant/config_ssid.h
@@ -1035,6 +1035,8 @@ struct wpa_ssid {

View File

@@ -1,6 +1,6 @@
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -5767,7 +5767,7 @@ wpa_supplicant_alloc(struct wpa_supplica
@@ -5769,7 +5769,7 @@ wpa_supplicant_alloc(struct wpa_supplica
if (wpa_s == NULL)
return NULL;
wpa_s->scan_req = INITIAL_SCAN_REQ;

View File

@@ -174,7 +174,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
* macsec_policy - Determines the policy for MACsec secure session
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -4175,6 +4175,12 @@ static void wpas_start_assoc_cb(struct w
@@ -4177,6 +4177,12 @@ static void wpas_start_assoc_cb(struct w
params.beacon_int = ssid->beacon_int;
else
params.beacon_int = wpa_s->conf->beacon_int;

View File

@@ -348,7 +348,7 @@
CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -7593,6 +7593,8 @@ struct wpa_supplicant * wpa_supplicant_a
@@ -7595,6 +7595,8 @@ struct wpa_supplicant * wpa_supplicant_a
}
#endif /* CONFIG_P2P */
@@ -357,7 +357,7 @@
return wpa_s;
}
@@ -7619,6 +7621,8 @@ int wpa_supplicant_remove_iface(struct w
@@ -7621,6 +7623,8 @@ int wpa_supplicant_remove_iface(struct w
struct wpa_supplicant *parent = wpa_s->parent;
#endif /* CONFIG_MESH */
@@ -366,7 +366,7 @@
/* Remove interface from the global list of interfaces */
prev = global->ifaces;
if (prev == wpa_s) {
@@ -7965,8 +7969,12 @@ int wpa_supplicant_run(struct wpa_global
@@ -7967,8 +7971,12 @@ int wpa_supplicant_run(struct wpa_global
eloop_register_signal_terminate(wpa_supplicant_terminate, global);
eloop_register_signal_reconfig(wpa_supplicant_reconfig, global);

View File

@@ -196,7 +196,7 @@
#ifdef CONFIG_BGSCAN
if (state == WPA_COMPLETED && wpa_s->current_ssid != wpa_s->bgscan_ssid)
@@ -7594,6 +7595,7 @@ struct wpa_supplicant * wpa_supplicant_a
@@ -7596,6 +7597,7 @@ struct wpa_supplicant * wpa_supplicant_a
#endif /* CONFIG_P2P */
wpas_ubus_add_bss(wpa_s);
@@ -204,7 +204,7 @@
return wpa_s;
}
@@ -7621,6 +7623,7 @@ int wpa_supplicant_remove_iface(struct w
@@ -7623,6 +7625,7 @@ int wpa_supplicant_remove_iface(struct w
struct wpa_supplicant *parent = wpa_s->parent;
#endif /* CONFIG_MESH */
@@ -212,7 +212,7 @@
wpas_ubus_free_bss(wpa_s);
/* Remove interface from the global list of interfaces */
@@ -7931,6 +7934,7 @@ struct wpa_global * wpa_supplicant_init(
@@ -7933,6 +7936,7 @@ struct wpa_global * wpa_supplicant_init(
eloop_register_timeout(WPA_SUPPLICANT_CLEANUP_INTERVAL, 0,
wpas_periodic, global, NULL);
@@ -220,7 +220,7 @@
return global;
}
@@ -7969,12 +7973,8 @@ int wpa_supplicant_run(struct wpa_global
@@ -7971,12 +7975,8 @@ int wpa_supplicant_run(struct wpa_global
eloop_register_signal_terminate(wpa_supplicant_terminate, global);
eloop_register_signal_reconfig(wpa_supplicant_reconfig, global);
@@ -233,7 +233,7 @@
return 0;
}
@@ -8007,6 +8007,8 @@ void wpa_supplicant_deinit(struct wpa_gl
@@ -8009,6 +8009,8 @@ void wpa_supplicant_deinit(struct wpa_gl
wpas_notify_supplicant_deinitialized(global);

View File

@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=px5g-mbedtls
PKG_RELEASE:=9
PKG_RELEASE:=10
PKG_LICENSE:=LGPL-2.1
PKG_BUILD_FLAGS:=no-mips16

View File

@@ -30,6 +30,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <stdbool.h>
#include <errno.h>
#include <mbedtls/bignum.h>
#include <mbedtls/entropy.h>
@@ -55,10 +56,13 @@ static int _urandom(void *ctx, unsigned char *out, size_t len)
return 0;
}
static void write_file(const char *path, int len, bool pem)
static void write_file(const char *path, size_t len, bool pem, bool cert)
{
FILE *f = stdout;
mode_t mode = S_IRUSR | S_IWUSR;
const char *buf_start = buf;
int fd = STDERR_FILENO;
ssize_t written;
int err;
if (!pem)
buf_start += sizeof(buf) - len;
@@ -67,17 +71,30 @@ static void write_file(const char *path, int len, bool pem)
fprintf(stderr, "No data to write\n");
exit(1);
}
if (cert)
mode |= S_IRGRP | S_IROTH;
if (!f) {
if (path)
fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
if (fd < 0) {
fprintf(stderr, "error: I/O error\n");
exit(1);
}
written = write(fd, buf_start, len);
if (written != len) {
fprintf(stderr, "writing key failed with: %s\n", strerror(errno));
exit(1);
}
err = fsync(fd);
if (err < 0) {
fprintf(stderr, "syncing key failed with: %s\n", strerror(errno));
exit(1);
}
if (path)
f = fopen(path, "w");
fwrite(buf_start, 1, len, f);
fclose(f);
close(fd);
}
static mbedtls_ecp_group_id ecp_curve(const char *name)
@@ -110,7 +127,7 @@ static void write_key(mbedtls_pk_context *key, const char *path, bool pem)
len = 0;
}
write_file(path, len, pem);
write_file(path, len, pem, false);
}
static void gen_key(mbedtls_pk_context *key, bool rsa, int ksize, int exp,
@@ -301,7 +318,7 @@ int selfsigned(char **arg)
return 1;
}
}
write_file(certpath, len, pem);
write_file(certpath, len, pem, true);
mbedtls_x509write_crt_free(&cert);
mbedtls_mpi_free(&serial);

View File

@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=px5g-wolfssl
PKG_RELEASE:=8.2
PKG_RELEASE:=9
PKG_LICENSE:=GPL-2.0-or-later
PKG_BUILD_FLAGS:=no-mips16

View File

@@ -7,6 +7,8 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <wolfssl/options.h>
#include <wolfssl/wolfcrypt/asn.h>
#include <wolfssl/wolfcrypt/asn_public.h>
@@ -24,27 +26,38 @@ enum {
RSA_KEY_TYPE = 1,
};
int write_file(byte *buf, int bufSz, char *path) {
int ret;
FILE *file;
int write_file(byte *buf, int bufSz, char *path, bool cert) {
mode_t mode = S_IRUSR | S_IWUSR;
ssize_t written;
int err;
int fd;
if (cert)
mode |= S_IRGRP | S_IROTH;
if (path) {
file = fopen(path, "wb");
if (file == NULL) {
fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
if (fd < 0) {
perror("Error opening file");
exit(1);
}
} else {
file = stdout;
fd = STDERR_FILENO;
}
written = write(fd, buf, bufSz);
if (written != bufSz) {
perror("Error write file");
exit(1);
}
err = fsync(fd);
if (err < 0) {
perror("Error fsync file");
exit(1);
}
ret = (int)fwrite(buf, 1, bufSz, file);
if (path) {
fclose(file);
close(fd);
}
if (ret > 0) {
/* ret > 0 indicates a successful file write, set to zero for return */
ret = 0;
}
return ret;
return 0;
}
int write_key(ecc_key *ecKey, RsaKey *rsaKey, int type, int keySz, char *fName,
@@ -73,9 +86,9 @@ int write_key(ecc_key *ecKey, RsaKey *rsaKey, int type, int keySz, char *fName,
fprintf(stderr, "DER to PEM failed: %d\n", ret);
}
pemSz = ret;
ret = write_file(pem, pemSz, fName);
ret = write_file(pem, pemSz, fName, false);
} else {
ret = write_file(der, derSz, fName);
ret = write_file(der, derSz, fName, false);
}
return ret;
}
@@ -281,7 +294,7 @@ int selfsigned(WC_RNG *rng, char **arg) {
}
pemSz = ret;
ret = write_file(pemBuf, pemSz, certpath);
ret = write_file(pemBuf, pemSz, certpath, true);
if (ret != 0) {
fprintf(stderr, "Write Cert failed: %d\n", ret);
return ret;

View File

@@ -12,9 +12,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/jow-/ucode.git
PKG_SOURCE_DATE:=2023-11-02
PKG_SOURCE_VERSION:=cfb24ea4f12131dcefe4f1ede2f51d3d16b88dec
PKG_MIRROR_HASH:=f515a23ab438f92be5788c42b9f614a82e670de2df1c01cd63143cdc77fa24fe
PKG_SOURCE_DATE:=2023-11-07
PKG_SOURCE_VERSION:=a6e75e02528e36f3610a7f0073453018336def2e
PKG_MIRROR_HASH:=e1a0f98ba865ed5911d5db3bfca55a2f1b825992bf5f7c7e324928d9412d7ae2
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
PKG_LICENSE:=ISC