ucentral: development update

* fix ath11k reload issue
* drop patches that were used by data mode v0
* imporve maverick logging
* fix lldp on qca units

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2021-06-05 15:11:11 +02:00
parent c6f47257ee
commit 4f20c642a5
14 changed files with 317 additions and 270 deletions

View File

@@ -2,7 +2,12 @@
active=$(ubus call ucentral status | jsonfilter -e '@.active')
[ -n "$active" -a ! "$active" -eq 1 ] && exit 0
[ -n "$active" -a ! "$active" -eq 1 ] && {
logger maverick: all good
exit 0
}
logger maverick: entering failsafe
rm /etc/config/network /etc/config/wireless
cp /rom/etc/config/uhttpd /rom/etc/config/firewall /rom/etc/config/dhcp /rom/etc/config/dropbear /etc/config

View File

@@ -11,7 +11,7 @@
static void
maverick_cb(struct uloop_timeout *delay)
{
ULOG_INFO("triggering maverick");
ULOG_INFO("triggering maverick check");
if (system("/usr/libexec/ucentral/maverick.sh"))
ULOG_ERR("failed to launch Maverick");
uloop_end();

View File

@@ -6,7 +6,7 @@ PKG_RELEASE:=1
PKG_SOURCE_URL=https://github.com/blogic/ucentral-schema.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2021-02-15
PKG_SOURCE_VERSION:=3def7c0f68a82154a3b0f0120a87183412d2777a
PKG_SOURCE_VERSION:=c60d97fbb5408fc53d4a8f522f7a698ff5f7f8d7
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
PKG_LICENSE:=BSD-3-Clause

View File

@@ -8,6 +8,4 @@ uci set lldpd.config.description="TIP/OpenAP"
uci set lldpd.config.lldp_hostname="$(cat /tmp/sysinfo/model)"
uci del lldpd.config.lldp_location
uci del lldpd.config.interface
uci add_list lldpd.config.interface=wan
uci add_list lldpd.config.interface=lan
uci commit lldpd

View File

@@ -94,10 +94,10 @@ CONFIG_EAP_TTLS=y
#CONFIG_EAP_PAX=y
# EAP-PSK for the integrated EAP server (this is _not_ needed for WPA-PSK)
#CONFIG_EAP_PSK=y
CONFIG_EAP_PSK=y
# EAP-pwd for the integrated EAP server (secure authentication with a password)
#CONFIG_EAP_PWD=y
CONFIG_EAP_PWD=y
# EAP-SAKE for the integrated EAP server
#CONFIG_EAP_SAKE=y

View File

@@ -108,6 +108,54 @@ void hostapd_ubus_free_iface(struct hostapd_iface *iface)
return;
}
static void hostapd_notify_ubus(struct ubus_object *obj, char *bssname, char *event)
{
char *event_type;
if (!ctx || !obj)
return;
if (asprintf(&event_type, "bss.%s", event) < 0)
return;
blob_buf_init(&b, 0);
blobmsg_add_string(&b, "name", bssname);
ubus_notify(ctx, obj, event_type, b.head, -1);
free(event_type);
}
static void hostapd_send_procd_event(char *bssname, char *event)
{
char *name, *s;
uint32_t id;
void *v;
if (!ctx || ubus_lookup_id(ctx, "service", &id))
return;
if (asprintf(&name, "hostapd.%s.%s", bssname, event) < 0)
return;
blob_buf_init(&b, 0);
s = blobmsg_alloc_string_buffer(&b, "type", strlen(name) + 1);
sprintf(s, "%s", name);
blobmsg_add_string_buffer(&b);
v = blobmsg_open_table(&b, "data");
blobmsg_close_table(&b, v);
ubus_invoke(ctx, id, "event", b.head, NULL, NULL, 1000);
free(name);
}
static void hostapd_send_shared_event(struct ubus_object *obj, char *bssname, char *event)
{
hostapd_send_procd_event(bssname, event);
hostapd_notify_ubus(obj, bssname, event);
}
static void
hostapd_bss_del_ban(void *eloop_data, void *user_ctx)
{
@@ -152,7 +200,79 @@ hostapd_bss_reload(struct ubus_context *ctx, struct ubus_object *obj,
struct blob_attr *msg)
{
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
return hostapd_reload_config(hapd->iface, 1);
int ret = hostapd_reload_config(hapd->iface, 1);
hostapd_send_shared_event(&hapd->iface->interfaces->ubus, hapd->conf->iface, "reload");
return ret;
}
static void
hostapd_parse_vht_map_blobmsg(uint16_t map)
{
char label[4];
int16_t val;
int i;
for (i = 0; i < 8; i++) {
snprintf(label, 4, "%dss", i + 1);
val = (map & (BIT(1) | BIT(0))) + 7;
blobmsg_add_u16(&b, label, val == 10 ? -1 : val);
map = map >> 2;
}
}
static void
hostapd_parse_vht_capab_blobmsg(struct ieee80211_vht_capabilities *vhtc)
{
void *supported_mcs;
void *map;
int i;
static const struct {
const char *name;
uint32_t flag;
} vht_capas[] = {
{ "su_beamformee", VHT_CAP_SU_BEAMFORMEE_CAPABLE },
{ "mu_beamformee", VHT_CAP_MU_BEAMFORMEE_CAPABLE },
};
for (i = 0; i < ARRAY_SIZE(vht_capas); i++)
blobmsg_add_u8(&b, vht_capas[i].name,
!!(vhtc->vht_capabilities_info & vht_capas[i].flag));
supported_mcs = blobmsg_open_table(&b, "mcs_map");
/* RX map */
map = blobmsg_open_table(&b, "rx");
hostapd_parse_vht_map_blobmsg(le_to_host16(vhtc->vht_supported_mcs_set.rx_map));
blobmsg_close_table(&b, map);
/* TX map */
map = blobmsg_open_table(&b, "tx");
hostapd_parse_vht_map_blobmsg(le_to_host16(vhtc->vht_supported_mcs_set.tx_map));
blobmsg_close_table(&b, map);
blobmsg_close_table(&b, supported_mcs);
}
static void
hostapd_parse_capab_blobmsg(struct sta_info *sta)
{
void *r, *v;
v = blobmsg_open_table(&b, "capabilities");
if (sta->vht_capabilities) {
r = blobmsg_open_table(&b, "vht");
hostapd_parse_vht_capab_blobmsg(sta->vht_capabilities);
blobmsg_close_table(&b, r);
}
/* ToDo: Add HT / HE capability parsing */
blobmsg_close_table(&b, v);
}
static int
@@ -161,6 +281,7 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
struct blob_attr *msg)
{
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
struct hostap_sta_driver_data sta_driver_data;
struct sta_info *sta;
void *list, *c;
char mac_buf[20];
@@ -203,6 +324,31 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
if (retrieve_sta_taxonomy(hapd, sta, r, 1024) > 0)
blobmsg_add_string_buffer(&b);
#endif
/* Driver information */
if (hostapd_drv_read_sta_data(hapd, &sta_driver_data, sta->addr) >= 0) {
r = blobmsg_open_table(&b, "bytes");
blobmsg_add_u64(&b, "rx", sta_driver_data.rx_bytes);
blobmsg_add_u64(&b, "tx", sta_driver_data.tx_bytes);
blobmsg_close_table(&b, r);
r = blobmsg_open_table(&b, "airtime");
blobmsg_add_u64(&b, "rx", sta_driver_data.rx_airtime);
blobmsg_add_u64(&b, "tx", sta_driver_data.tx_airtime);
blobmsg_close_table(&b, r);
r = blobmsg_open_table(&b, "packets");
blobmsg_add_u32(&b, "rx", sta_driver_data.rx_packets);
blobmsg_add_u32(&b, "tx", sta_driver_data.tx_packets);
blobmsg_close_table(&b, r);
r = blobmsg_open_table(&b, "rate");
/* Rate in kbits */
blobmsg_add_u32(&b, "rx", sta_driver_data.current_rx_rate * 100);
blobmsg_add_u32(&b, "tx", sta_driver_data.current_tx_rate * 100);
blobmsg_close_table(&b, r);
blobmsg_add_u32(&b, "signal", sta_driver_data.signal);
}
hostapd_parse_capab_blobmsg(sta);
blobmsg_close_table(&b, c);
}
blobmsg_close_array(&b, list);
@@ -226,6 +372,45 @@ hostapd_bss_get_features(struct ubus_context *ctx, struct ubus_object *obj,
return 0;
}
static int
hostapd_bss_get_status(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
void *airtime_table, *dfs_table;
struct os_reltime now;
char phy_name[17];
char mac_buf[20];
blob_buf_init(&b, 0);
blobmsg_add_string(&b, "status", hostapd_state_text(hapd->iface->state));
blobmsg_add_u32(&b, "freq", hapd->iface->freq);
snprintf(phy_name, 17, "%s", hapd->iface->phy);
blobmsg_add_string(&b, "phy", phy_name);
/* Airtime */
airtime_table = blobmsg_open_table(&b, "airtime");
blobmsg_add_u64(&b, "time", hapd->iface->last_channel_time);
blobmsg_add_u64(&b, "time_busy", hapd->iface->last_channel_time_busy);
blobmsg_add_u16(&b, "utilization", hapd->iface->channel_utilization);
blobmsg_close_table(&b, airtime_table);
/* DFS */
dfs_table = blobmsg_open_table(&b, "dfs");
blobmsg_add_u32(&b, "cac_seconds", hapd->iface->dfs_cac_ms / 1000);
blobmsg_add_u8(&b, "cac_active", !!(hapd->iface->cac_started));
os_reltime_age(&hapd->iface->dfs_cac_start, &now);
blobmsg_add_u32(&b, "cac_seconds_left",
hapd->iface->cac_started ? hapd->iface->dfs_cac_ms / 1000 - now.sec : 0);
blobmsg_close_table(&b, dfs_table);
ubus_send_reply(ctx, req, b.head);
return 0;
}
enum {
NOTIFY_RESPONSE,
__NOTIFY_MAX
@@ -344,6 +529,7 @@ hostapd_bss_list_bans(struct ubus_context *ctx, struct ubus_object *obj,
return 0;
}
#ifdef CONFIG_WPS
static int
hostapd_bss_wps_start(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
@@ -360,6 +546,53 @@ hostapd_bss_wps_start(struct ubus_context *ctx, struct ubus_object *obj,
return 0;
}
static const char * pbc_status_enum_str(enum pbc_status status)
{
switch (status) {
case WPS_PBC_STATUS_DISABLE:
return "Disabled";
case WPS_PBC_STATUS_ACTIVE:
return "Active";
case WPS_PBC_STATUS_TIMEOUT:
return "Timed-out";
case WPS_PBC_STATUS_OVERLAP:
return "Overlap";
default:
return "Unknown";
}
}
static int
hostapd_bss_wps_status(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
int rc;
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
blob_buf_init(&b, 0);
blobmsg_add_string(&b, "pbc_status", pbc_status_enum_str(hapd->wps_stats.pbc_status));
blobmsg_add_string(&b, "last_wps_result",
(hapd->wps_stats.status == WPS_STATUS_SUCCESS ?
"Success":
(hapd->wps_stats.status == WPS_STATUS_FAILURE ?
"Failed" : "None")));
/* If status == Failure - Add possible Reasons */
if(hapd->wps_stats.status == WPS_STATUS_FAILURE &&
hapd->wps_stats.failure_reason > 0)
blobmsg_add_string(&b, "reason", wps_ei_str(hapd->wps_stats.failure_reason));
if (hapd->wps_stats.status)
blobmsg_printf(&b, "peer_address", MACSTR, MAC2STR(hapd->wps_stats.peer_addr));
ubus_send_reply(ctx, req, b.head);
return 0;
}
static int
hostapd_bss_wps_cancel(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
@@ -375,6 +608,7 @@ hostapd_bss_wps_cancel(struct ubus_context *ctx, struct ubus_object *obj,
return 0;
}
#endif /* CONFIG_WPS */
static int
hostapd_bss_update_beacon(struct ubus_context *ctx, struct ubus_object *obj,
@@ -424,6 +658,10 @@ hostapd_config_add(struct ubus_context *ctx, struct ubus_object *obj,
if (hostapd_add_iface(interfaces, buf))
return UBUS_STATUS_INVALID_ARGUMENT;
blob_buf_init(&b, 0);
blobmsg_add_u32(&b, "pid", getpid());
ubus_send_reply(ctx, req, b.head);
return UBUS_STATUS_OK;
}
@@ -805,7 +1043,6 @@ hostapd_rrm_nr_set(struct ubus_context *ctx, struct ubus_object *obj,
struct blob_attr *tb_l[__NR_SET_LIST_MAX];
struct blob_attr *tb[ARRAY_SIZE(nr_e_policy)];
struct blob_attr *cur;
int ret = 0;
int rem;
hostapd_rrm_nr_enable(hapd);
@@ -819,32 +1056,47 @@ hostapd_rrm_nr_set(struct ubus_context *ctx, struct ubus_object *obj,
struct wpa_ssid_value ssid;
struct wpabuf *data;
u8 bssid[ETH_ALEN];
char *s;
char *s, *nr_s;
blobmsg_parse_array(nr_e_policy, ARRAY_SIZE(nr_e_policy), tb, blobmsg_data(cur), blobmsg_data_len(cur));
if (!tb[0] || !tb[1] || !tb[2])
goto invalid;
s = blobmsg_get_string(tb[0]);
if (hwaddr_aton(s, bssid))
goto invalid;
s = blobmsg_get_string(tb[1]);
ssid.ssid_len = strlen(s);
if (ssid.ssid_len > sizeof(ssid.ssid))
goto invalid;
memcpy(&ssid, s, ssid.ssid_len);
data = wpabuf_parse_bin(blobmsg_get_string(tb[2]));
/* Neighbor Report binary */
nr_s = blobmsg_get_string(tb[2]);
data = wpabuf_parse_bin(nr_s);
if (!data)
goto invalid;
/* BSSID */
s = blobmsg_get_string(tb[0]);
if (strlen(s) == 0) {
/* Copy BSSID from neighbor report */
if (hwaddr_compact_aton(nr_s, bssid))
goto invalid;
} else if (hwaddr_aton(s, bssid)) {
goto invalid;
}
/* SSID */
s = blobmsg_get_string(tb[1]);
if (strlen(s) == 0) {
/* Copy SSID from hostapd BSS conf */
memcpy(&ssid, &hapd->conf->ssid, sizeof(ssid));
} else {
ssid.ssid_len = strlen(s);
if (ssid.ssid_len > sizeof(ssid.ssid))
goto invalid;
memcpy(&ssid, s, ssid.ssid_len);
}
hostapd_neighbor_set(hapd, bssid, &ssid, data, NULL, NULL, 0, 0);
wpabuf_free(data);
continue;
invalid:
ret = UBUS_STATUS_INVALID_ARGUMENT;
return UBUS_STATUS_INVALID_ARGUMENT;
}
return 0;
@@ -1028,7 +1280,7 @@ hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, struct ubus_object *obj,
if (tb[WNM_DISASSOC_ABRIDGED] && blobmsg_get_bool(tb[WNM_DISASSOC_ABRIDGED]))
req_mode |= WNM_BSS_TM_REQ_ABRIDGED;
if (wnm_send_bss_tm_req(hapd, sta, req_mode, duration, 0, NULL,
if (wnm_send_bss_tm_req(hapd, sta, req_mode, duration, duration, NULL,
NULL, nr, nr_len, NULL, 0))
return UBUS_STATUS_UNKNOWN_ERROR;
@@ -1039,10 +1291,14 @@ hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, struct ubus_object *obj,
static const struct ubus_method bss_methods[] = {
UBUS_METHOD_NOARG("reload", hostapd_bss_reload),
UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients),
UBUS_METHOD_NOARG("get_status", hostapd_bss_get_status),
UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy),
UBUS_METHOD_NOARG("list_bans", hostapd_bss_list_bans),
#ifdef CONFIG_WPS
UBUS_METHOD_NOARG("wps_start", hostapd_bss_wps_start),
UBUS_METHOD_NOARG("wps_status", hostapd_bss_wps_status),
UBUS_METHOD_NOARG("wps_cancel", hostapd_bss_wps_cancel),
#endif
UBUS_METHOD_NOARG("update_beacon", hostapd_bss_update_beacon),
UBUS_METHOD_NOARG("get_features", hostapd_bss_get_features),
#ifdef NEED_AP_MLME
@@ -1092,6 +1348,8 @@ void hostapd_ubus_add_bss(struct hostapd_data *hapd)
obj->n_methods = bss_object_type.n_methods;
ret = ubus_add_object(ctx, obj);
hostapd_ubus_ref_inc();
hostapd_send_shared_event(&hapd->iface->interfaces->ubus, hapd->conf->iface, "add");
}
void hostapd_ubus_free_bss(struct hostapd_data *hapd)
@@ -1102,6 +1360,8 @@ void hostapd_ubus_free_bss(struct hostapd_data *hapd)
if (!ctx)
return;
hostapd_send_shared_event(&hapd->iface->interfaces->ubus, hapd->conf->iface, "remove");
if (obj->id) {
ubus_remove_object(ctx, obj);
hostapd_ubus_ref_dec();

View File

@@ -1036,13 +1036,6 @@ drv_mac80211_setup() {
local found
for wdev in $(list_phy_interfaces "$phy"); do
found=0
for cwdev in $OLDAPLIST $OLDSPLIST $OLDUMLIST; do
if [ "$wdev" = "$cwdev" ]; then
found=1
break
fi
done
if [ "$found" = "0" ]; then
ip link set dev "$wdev" down
iw dev "$wdev" del
@@ -1107,33 +1100,24 @@ drv_mac80211_setup() {
for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif
NEWAPLIST=
for_each_interface "ap" mac80211_prepare_vif
NEW_MD5=$(test -e "${hostapd_conf_file}" && md5sum ${hostapd_conf_file})
OLD_MD5=$(uci -q -P /var/state get wireless._${phy}.md5)
if [ "${NEWAPLIST}" != "${OLDAPLIST}" ]; then
mac80211_vap_cleanup hostapd "${OLDAPLIST}"
fi
mac80211_vap_cleanup hostapd "${OLDAPLIST}"
[ -n "${NEWAPLIST}" ] && mac80211_iw_interface_add "$phy" "${NEWAPLIST%% *}" __ap
local add_ap=0
local primary_ap=${NEWAPLIST%% *}
[ -n "$hostapd_ctrl" ] && {
local no_reload=1
if [ -n "$(ubus list | grep hostapd.$primary_ap)" ]; then
[ "${NEW_MD5}" = "${OLD_MD5}" ] || {
ubus call hostapd.$primary_ap reload
no_reload=$?
if [ "$no_reload" != "0" ]; then
mac80211_vap_cleanup hostapd "${OLDAPLIST}"
mac80211_vap_cleanup wpa_supplicant "$(uci -q -P /var/state get wireless._${phy}.splist)"
mac80211_vap_cleanup none "$(uci -q -P /var/state get wireless._${phy}.umlist)"
sleep 2
mac80211_iw_interface_add "$phy" "${NEWAPLIST%% *}" __ap
for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif
fi
}
mac80211_vap_cleanup hostapd "${OLDAPLIST}"
mac80211_vap_cleanup wpa_supplicant "$(uci -q -P /var/state get wireless._${phy}.splist)"
mac80211_vap_cleanup none "$(uci -q -P /var/state get wireless._${phy}.umlist)"
sleep 2
mac80211_iw_interface_add "$phy" "${NEWAPLIST%% *}" __ap
for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif
fi
if [ "$no_reload" != "0" ]; then
add_ap=1
ubus wait_for hostapd
ip link set $primary_ap down
local hostapd_res="$(ubus call hostapd config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}")"
ret="$?"
[ "$ret" != 0 -o -z "$hostapd_res" ] && {

View File

@@ -1,54 +0,0 @@
--- a/drivers/net/wireless/ath/ath11k/reg.c
+++ b/drivers/net/wireless/ath/ath11k/reg.c
@@ -41,6 +41,37 @@ static bool ath11k_regdom_changes(struct
return memcmp(regd->alpha2, alpha2, 2) != 0;
}
+static bool ath11k_reg_validate_pdev_state(struct ath11k* ar)
+{
+ struct ath11k_base *ab = ar->ab;
+ struct ath11k_pdev *pdev;
+ struct ath11k* tmp_ar;
+ int i;
+
+ rcu_read_lock();
+ for (i = 0; i < ab->num_radios; i++) {
+ pdev = rcu_dereference(ab->pdevs_active[i]);
+ if (!pdev)
+ continue;
+
+ tmp_ar = pdev->ar;
+ if (tmp_ar) {
+ mutex_lock(&tmp_ar->conf_mutex);
+ if (tmp_ar->num_started_vdevs) {
+ if (tmp_ar == ar)
+ ath11k_warn(ab, "%s has active interface, please bring down to set country code",
+ wiphy_name(ar->hw->wiphy));
+ mutex_unlock(&tmp_ar->conf_mutex);
+ rcu_read_unlock();
+ return false;
+ }
+ mutex_unlock(&tmp_ar->conf_mutex);
+ }
+ }
+ rcu_read_unlock();
+ return true;
+}
+
static void
ath11k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
{
@@ -74,6 +105,13 @@ ath11k_reg_notifier(struct wiphy *wiphy,
return;
}
+ /* The SET_INIT_COUNTRY command should not be sent to firmware while any vdev is active.
+ * Also it does not make sense to give the command for certain pdev's alone.
+ * Hence check all the pdev's if any have an active vdev before sending the command.
+ */
+ if (!ath11k_reg_validate_pdev_state(ar))
+ return;
+
/* Set the country code to the firmware and wait for
* the WMI_REG_CHAN_LIST_CC EVENT for updating the
* reg info

View File

@@ -1,25 +0,0 @@
From d91340b9e12cd871bcf0cab1a06a4a37b4b74a05 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Tue, 6 Oct 2020 16:39:16 +0200
Subject: [PATCH 12/21] dnsmasq: turn the base uci section into a named one
Handling this section from opensync is complicated if it is unnamed.
Signed-off-by: John Crispin <john@phrozen.org>
---
package/network/services/dnsmasq/files/dhcp.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package/network/services/dnsmasq/files/dhcp.conf b/package/network/services/dnsmasq/files/dhcp.conf
index 8c42ef782e..ef8901aad2 100644
--- a/package/network/services/dnsmasq/files/dhcp.conf
+++ b/package/network/services/dnsmasq/files/dhcp.conf
@@ -1,4 +1,4 @@
-config dnsmasq
+config dnsmasq dnsmasq
option domainneeded 1
option boguspriv 1
option filterwin2k 0 # enable for dial on demand
--
2.25.1

View File

@@ -1,94 +0,0 @@
From c7cf22faf7dc1eff6ed56f7e24d1726766770279 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 23 Jul 2020 16:09:28 +0200
Subject: [PATCH 13/21] ubox: add log priority filtering
Allow logread to filer based on priority.
Signed-off-by: John Crispin <john@phrozen.org>
---
package/system/ubox/files/log.init | 4 +-
.../system/ubox/patches/100-log-prio.patch | 49 +++++++++++++++++++
2 files changed, 52 insertions(+), 1 deletion(-)
create mode 100644 package/system/ubox/patches/100-log-prio.patch
diff --git a/package/system/ubox/files/log.init b/package/system/ubox/files/log.init
index 250f805b44..34471bd64a 100644
--- a/package/system/ubox/files/log.init
+++ b/package/system/ubox/files/log.init
@@ -20,7 +20,8 @@ validate_log_section()
'log_port:port:514' \
'log_proto:or("tcp", "udp"):udp' \
'log_trailer_null:bool:0' \
- 'log_prefix:string'
+ 'log_prefix:string' \
+ 'log_max_prio:uinteger'
}
validate_log_daemon()
@@ -80,6 +81,7 @@ start_service_remote()
"tcp") [ "${log_trailer_null}" -eq 1 ] && procd_append_param command -0;;
esac
[ -z "${log_prefix}" ] || procd_append_param command -P "${log_prefix}"
+ [ -z "${log_max_prio}" ] || procd_append_param command -m "${log_max_prio}"
procd_close_instance
}
diff --git a/package/system/ubox/patches/100-log-prio.patch b/package/system/ubox/patches/100-log-prio.patch
new file mode 100644
index 0000000000..f1abfbd0e6
--- /dev/null
+++ b/package/system/ubox/patches/100-log-prio.patch
@@ -0,0 +1,49 @@
+Index: ubox-2019-12-31-0e34af14/log/logread.c
+===================================================================
+--- ubox-2019-12-31-0e34af14.orig/log/logread.c
++++ ubox-2019-12-31-0e34af14/log/logread.c
+@@ -68,6 +68,7 @@ static int log_timestamp;
+ static int logd_conn_tries = LOGD_CONNECT_RETRY;
+ static int facility_include;
+ static int facility_exclude;
++static int log_max_prio;
+
+ /* check for facility filter; return 0 if message shall be dropped */
+ static int check_facility_filter(int f)
+@@ -147,6 +148,9 @@ static int log_notify(struct blob_attr *
+ }
+ p = blobmsg_get_u32(tb[LOG_PRIO]);
+
++ if (log_max_prio && LOG_PRI(p) > log_max_prio)
++ return 0;
++
+ if (!check_facility_filter(LOG_FAC(p)))
+ return 0;
+
+@@ -233,6 +237,7 @@ static int usage(const char *prog)
+ " -u Use UDP as the protocol\n"
+ " -t Add an extra timestamp\n"
+ " -0 Use \\0 instead of \\n as trailer when using TCP\n"
++ " -m <priority> Only show messages with priority less or equal than <priority>\n"
+ "\n", prog);
+ return 1;
+ }
+@@ -307,7 +312,7 @@ int main(int argc, char **argv)
+
+ signal(SIGPIPE, SIG_IGN);
+
+- while ((ch = getopt(argc, argv, "u0fcs:l:z:Z:r:F:p:S:P:h:e:t")) != -1) {
++ while ((ch = getopt(argc, argv, "u0fcs:l:z:Z:r:F:p:S:P:h:e:tm:")) != -1) {
+ switch (ch) {
+ case 'u':
+ log_udp = 1;
+@@ -362,6 +367,9 @@ int main(int argc, char **argv)
+ case 't':
+ log_timestamp = 1;
+ break;
++ case 'm':
++ log_max_prio = atoi(optarg);
++ break;
+ default:
+ return usage(*argv);
+ }
--
2.25.1

View File

@@ -1,45 +0,0 @@
From 838e381ac93a69bcdeb30c41d0d45ef5a338de76 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Sun, 26 Jul 2020 19:16:21 +0200
Subject: [PATCH 14/21] firewall: tune lan/wan into named sections
We want to reference these from within OpenSync. They need to be named for this to work.
Signed-off-by: John Crispin <john@phrozen.org>
---
package/network/config/firewall/files/firewall.config | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/package/network/config/firewall/files/firewall.config b/package/network/config/firewall/files/firewall.config
index 5e22f984ce..de6e8a6c73 100644
--- a/package/network/config/firewall/files/firewall.config
+++ b/package/network/config/firewall/files/firewall.config
@@ -6,14 +6,14 @@ config defaults
# Uncomment this line to disable ipv6 rules
# option disable_ipv6 1
-config zone
+config zone lan
option name lan
list network 'lan'
option input ACCEPT
option output ACCEPT
option forward ACCEPT
-config zone
+config zone wan
option name wan
list network 'wan'
list network 'wan6'
@@ -23,7 +23,7 @@ config zone
option masq 1
option mtu_fix 1
-config forwarding
+config forwarding lan_fw
option src lan
option dest wan
--
2.25.1

View File

@@ -1,19 +1,34 @@
From 62ddcca43fe29aeedbc04c2705c01b8ae0b738f5 Mon Sep 17 00:00:00 2001
From 7a4571cc0c12d54d0aca93dfedbe8dc33cff39fa Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Fri, 4 Dec 2020 16:29:35 +0100
Subject: [PATCH 01/13] lldp: add TIP tweaks
Subject: [PATCH 01/11] lldp: add TIP tweaks
Signed-off-by: John Crispin <john@phrozen.org>
---
package/network/services/lldpd/Makefile | 1 +
package/network/services/lldpd/Makefile | 5 ++--
.../network/services/lldpd/files/lldpd.config | 16 ----------
.../network/services/lldpd/files/lldpd.init | 30 +++++++------------
3 files changed, 12 insertions(+), 35 deletions(-)
3 files changed, 14 insertions(+), 37 deletions(-)
diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile
index 74d6791091..5acbb89da6 100644
index 74d6791091..fd55c94cf4 100644
--- a/package/network/services/lldpd/Makefile
+++ b/package/network/services/lldpd/Makefile
@@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=lldpd
-PKG_VERSION:=1.0.7
+PKG_VERSION:=1.0.5
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://media.luffy.cx/files/lldpd
-PKG_HASH:=1df79179d489c841b49265f2ab5ff05f284a647e95862d2f3c02b3fb079a87e1
+PKG_HASH:=2dd3b212f4dbabfcbb2794c0010b245f9f8e74b387984e757be6243a74c6cb99
PKG_MAINTAINER:=Stijn Tintel <stijn@linux-ipv6.be>
PKG_LICENSE:=ISC
@@ -97,6 +97,7 @@ CONFIGURE_ARGS += \
--disable-hardening \
--without-xml \

View File

@@ -20,6 +20,7 @@ packages:
- ieee8021x
- igmpproxy
- ip-bridge
- kmod-sched-bpf
- lldpd
- maverick
- opennds

View File

@@ -3,3 +3,5 @@ description: Add the wifi support AX targets
feeds:
- name: wifi_ax
path: ../../feeds/wifi-ax
packages:
- wireless-regdb