[IWINFO PATCH v4 2/4] iwinfo: export center_chan info for local wifi

2020-12-05 Thread Ansuel Smith
Iwinfo already export the htmode but there is no way to know where the
channel expan in case a 40Mhz+ channel width is used. Export the center
channels used by the driver to better know the channel utilizzation of
the wifi.

Signed-off-by: Ansuel Smith 
---
 include/iwinfo.h |  2 ++
 iwinfo_cli.c | 23 +++
 iwinfo_nl80211.c | 76 +++-
 3 files changed, 100 insertions(+), 1 deletion(-)

diff --git a/include/iwinfo.h b/include/iwinfo.h
index 676db91..680f384 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -282,6 +282,8 @@ struct iwinfo_ops {
int (*survey)(const char *, char *, int *);
int (*lookup_phy)(const char *, char *);
void (*close)(void);
+   int (*center_chan1)(const char *, int *);
+   int (*center_chan2)(const char *, int *);
 };
 
 const char * iwinfo_type(const char *ifname);
diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index 6bfe0ab..cc5d298 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -445,6 +445,24 @@ static char * print_channel(const struct iwinfo_ops *iw, 
const char *ifname)
return format_channel(ch);
 }
 
+static char * print_center_chan1(const struct iwinfo_ops *iw, const char 
*ifname)
+{
+   int ch;
+   if (iw->center_chan1(ifname, ))
+   ch = -1;
+
+   return format_channel(ch);
+}
+
+static char * print_center_chan2(const struct iwinfo_ops *iw, const char 
*ifname)
+{
+   int ch;
+   if (iw->center_chan2(ifname, ))
+   ch = -1;
+
+   return format_channel(ch);
+}
+
 static char * print_frequency(const struct iwinfo_ops *iw, const char *ifname)
 {
int freq;
@@ -566,6 +584,11 @@ static void print_info(const struct iwinfo_ops *iw, const 
char *ifname)
print_mode(iw, ifname),
print_channel(iw, ifname),
print_frequency(iw, ifname));
+   if (iw->center_chan1 != NULL) {
+   printf("  Center Channel 1: %s",
+   print_center_chan1(iw, ifname));
+   printf(" 2: %s\n", print_center_chan2(iw, ifname));
+   }
printf("  Tx-Power: %s  Link Quality: %s/%s\n",
print_txpower(iw, ifname),
print_quality(iw, ifname),
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index 5917e3a..1bcc5ea 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -1262,6 +1262,56 @@ static int nl80211_get_frequency(const char *ifname, int 
*buf)
return (*buf == 0) ? -1 : 0;
 }
 
+static int nl80211_get_center_freq1_cb(struct nl_msg *msg, void *arg)
+{
+   int *freq = arg;
+   struct nlattr **tb = nl80211_parse(msg);
+
+   if (tb[NL80211_ATTR_CENTER_FREQ1])
+   *freq = nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ1]);
+
+   return NL_SKIP;
+}
+
+static int nl80211_get_center_freq1(const char *ifname, int *buf)
+{
+   char *res;
+
+   /* try to find frequency from interface info */
+   res = nl80211_phy2ifname(ifname);
+   *buf = 0;
+
+   nl80211_request(res ? res : ifname, NL80211_CMD_GET_INTERFACE, 0,
+   nl80211_get_center_freq1_cb, buf);
+
+   return (*buf == 0) ? -1 : 0;
+}
+
+static int nl80211_get_center_freq2_cb(struct nl_msg *msg, void *arg)
+{
+   int *freq = arg;
+   struct nlattr **tb = nl80211_parse(msg);
+
+   if (tb[NL80211_ATTR_CENTER_FREQ2])
+   *freq = nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ2]);
+
+   return NL_SKIP;
+}
+
+static int nl80211_get_center_freq2(const char *ifname, int *buf)
+{
+   char *res;
+
+   /* try to find frequency from interface info */
+   res = nl80211_phy2ifname(ifname);
+   *buf = 0;
+
+   nl80211_request(res ? res : ifname, NL80211_CMD_GET_INTERFACE, 0,
+   nl80211_get_center_freq2_cb, buf);
+
+   return (*buf == 0) ? -1 : 0;
+}
+
 static int nl80211_get_channel(const char *ifname, int *buf)
 {
if (!nl80211_get_frequency(ifname, buf))
@@ -1273,6 +1323,28 @@ static int nl80211_get_channel(const char *ifname, int 
*buf)
return -1;
 }
 
+static int nl80211_get_center_chan1(const char *ifname, int *buf)
+{
+   if (!nl80211_get_center_freq1(ifname, buf))
+   {
+   *buf = nl80211_freq2channel(*buf);
+   return 0;
+   }
+
+   return -1;
+}
+
+static int nl80211_get_center_chan2(const char *ifname, int *buf)
+{
+   if (!nl80211_get_center_freq2(ifname, buf))
+   {
+   *buf = nl80211_freq2channel(*buf);
+   return 0;
+   }
+
+   return -1;
+}
+
 static int nl80211_get_txpower_cb(struct nl_msg *msg, void *arg)
 {
int *buf = arg;
@@ -3242,5 +3314,7 @@ const struct iwinfo_ops nl80211_ops = {
.countrylist  = nl80211_get_countrylist,
.survey   = nl80211_get_survey,
.lookup_phy   = nl80211_lookup_phyname,
-   .close= nl80211_close
+   .close= nl80211_close,
+   

[IWINFO PATCH v4 1/4] iwinfo: export ht and vht operation in scan results

2020-12-05 Thread Ansuel Smith
Export ht and vht operation data in scan results. These additional data
can be usefull to check wifi channel utilizzation by neraby stations.

Signed-off-by: Ansuel Smith 
---
 include/iwinfo.h | 34 ++
 iwinfo_cli.c | 35 ++-
 iwinfo_nl80211.c | 10 ++
 3 files changed, 78 insertions(+), 1 deletion(-)

diff --git a/include/iwinfo.h b/include/iwinfo.h
index 5e64294..676db91 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -170,6 +170,38 @@ struct iwinfo_crypto_entry {
uint8_t auth_algs;
 };
 
+struct iwinfo_scanlist_ht_chan_entry {
+   uint8_t primary_chan;
+   uint8_t secondary_chan_off;
+   uint8_t chan_width;
+};
+
+struct iwinfo_scanlist_vht_chan_entry {
+   uint8_t chan_width;
+   uint8_t center_chan_1;
+   uint8_t center_chan_2;
+};
+
+static const char *ht_secondary_offset[4] = {
+   "no secondary",
+   "above",
+   "[reserved!]",
+   "below",
+};
+
+
+static uint16_t ht_chan_width[2] = {
+   20, /* 20 MHz */
+   2040, /* 40 MHz or higher (refer to vht if supported) */
+};
+
+static uint16_t vht_chan_width[] = {
+   [0] = 40, /* 40 MHz or lower (refer to ht to a more precise width) */
+   [1] = 80, /* 80 MHz */
+   [3] = 8080, /* 80+80 MHz */
+   [2] = 160, /* 160 MHz */
+};
+
 struct iwinfo_scanlist_entry {
uint8_t mac[6];
char ssid[IWINFO_ESSID_MAX_SIZE+1];
@@ -179,6 +211,8 @@ struct iwinfo_scanlist_entry {
uint8_t quality;
uint8_t quality_max;
struct iwinfo_crypto_entry crypto;
+   struct iwinfo_scanlist_ht_chan_entry ht_chan_info;
+   struct iwinfo_scanlist_vht_chan_entry vht_chan_info;
 };
 
 struct iwinfo_country_entry {
diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index 0332bc2..6bfe0ab 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -323,6 +323,20 @@ static char * format_assocrate(struct iwinfo_rate_entry *r)
return buf;
 }
 
+static const char* format_chan_width(uint16_t width)
+{
+   switch (width) {
+   case 20: return "20 MHz";
+   case 2040: return "40 MHz and upper or 20 MHz with intolerant 
bit";
+   case 40: return "40 MHz or lower";
+   case 80: return "80 MHz";
+   case 8080: return "80+80 MHz";
+   case 160: return "160 MHz";
+   }
+
+   return "unknown";
+}
+
 
 static const char * print_type(const struct iwinfo_ops *iw, const char *ifname)
 {
@@ -612,8 +626,27 @@ static void print_scanlist(const struct iwinfo_ops *iw, 
const char *ifname)
format_signal(e->signal - 0x100),
format_quality(e->quality),
format_quality_max(e->quality_max));
-   printf("  Encryption: %s\n\n",
+   printf("  Encryption: %s\n",
   format_encryption(>crypto));
+   printf("  HT Operation:\n");
+   printf("Primary Channel: %d\n",
+  e->ht_chan_info.primary_chan);
+   printf("Secondary Channel Offset: %s\n",
+  ht_secondary_offset[e->ht_chan_info.secondary_chan_off]);
+   printf("Channel Width: %s\n",
+  
format_chan_width(ht_chan_width[e->ht_chan_info.chan_width]));
+
+   if (e->vht_chan_info.center_chan_1) {
+ printf("  VHT Operation:\n");
+ printf("Channel Width: %s\n",
+
format_chan_width(vht_chan_width[e->vht_chan_info.chan_width]));
+ printf("Center Frequency 1: %d\n",
+e->vht_chan_info.center_chan_1);
+ printf("Center Frequency 2: %d\n",
+e->vht_chan_info.center_chan_2);
+   }
+
+   printf("\n");
}
 }
 
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index 2b2a043..5917e3a 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -2306,6 +2306,16 @@ static void nl80211_get_scanlist_ie(struct nlattr **bss,
iwinfo_parse_rsn(>crypto, ie + 6, ie[1] - 4,
 IWINFO_CIPHER_TKIP, 
IWINFO_KMGMT_PSK);
break;
+   case 61: /* HT oeration */
+   e->ht_chan_info.primary_chan = ie[2];
+   e->ht_chan_info.secondary_chan_off = ie[3] & 0x3;
+   e->ht_chan_info.chan_width = (ie[4] & 0x4)>>2;
+   break;
+   case 192: /* VHT operation */
+   e->vht_chan_info.chan_width = ie[2];
+   e->vht_chan_info.center_chan_1 = ie[3];
+   e->vht_chan_info.center_chan_2 = ie[4];
+   break;
}
 

[RPCD PATCH v4 4/4] iwinfo: export center channel for info ubus call

2020-12-05 Thread Ansuel Smith
Iwinfo export the center channel sued by the wifi. Include this data in
the ubus info call to better know the channel utilizzation of the wifi.

Signed-off-by: Ansuel Smith 
---
 iwinfo.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/iwinfo.c b/iwinfo.c
index 45ca784..94fa822 100644
--- a/iwinfo.c
+++ b/iwinfo.c
@@ -364,6 +364,8 @@ rpc_iwinfo_info(struct ubus_context *ctx, struct 
ubus_object *obj,
 
rpc_iwinfo_call_int("mode", iw->mode, IWINFO_OPMODE_NAMES);
rpc_iwinfo_call_int("channel", iw->channel, NULL);
+   rpc_iwinfo_call_int("center_chan1", iw->center_chan1, NULL);
+   rpc_iwinfo_call_int("center_chan2", iw->center_chan2, NULL);
 
rpc_iwinfo_call_int("frequency", iw->frequency, NULL);
rpc_iwinfo_call_int("frequency_offset", iw->frequency_offset, NULL);
-- 
2.29.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v4 0/4] Add support channel with to iwinfo

2020-12-05 Thread Ansuel Smith
This series modify 2 different repo. Iwinfo and Rpcd
The 2 iwinfo patch add support to iwinfo to display and export channel
width and center_channel info for both wifi scan and wifi info related
to the local wifi.
The other 2 rpcd patch export the iwinfo data to ubus to make them
usable by the webui.

v4:
- Fix error in iwinfo_cli
v3:
- Add check for center_chan support in iwinfo_cli
- Use uinit to represent chan width and add function format_chant_width
v2:
- Put the static char array to the iwinfo include. (the rpcd plugin use
the same include)
- Add additional patch to export center_chanl for local wifi.

-- 
2.29.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[RPCD PATCH v4 3/4] iwinfo: add ht and vht operation info to wifi scan

2020-12-05 Thread Ansuel Smith
Iwinfo exports ht and vht operation info useful to get channel info of
nearby stations. Add these new info to ubus output.

Signed-off-by: Ansuel Smith 
---
 iwinfo.c | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/iwinfo.c b/iwinfo.c
index 7780e69..45ca784 100644
--- a/iwinfo.c
+++ b/iwinfo.c
@@ -403,7 +403,7 @@ rpc_iwinfo_scan(struct ubus_context *ctx, struct 
ubus_object *obj,
 struct blob_attr *msg)
 {
int i, rv, len;
-   void *c, *d;
+   void *c, *d, *t;
char mac[18];
char res[IWINFO_BUFSIZE];
struct iwinfo_scanlist_entry *e;
@@ -441,6 +441,20 @@ rpc_iwinfo_scan(struct ubus_context *ctx, struct 
ubus_object *obj,
blobmsg_add_u32(, "quality", e->quality);
blobmsg_add_u32(, "quality_max", e->quality_max);
 
+   t = blobmsg_open_table(, "ht_operation");
+   blobmsg_add_u32(, "primary_channel", 
e->ht_chan_info.primary_chan);
+   blobmsg_add_string(, "secondary_channel_offset", 
ht_secondary_offset[e->ht_chan_info.secondary_chan_off]);
+   blobmsg_add_u32(, "channel_width", 
ht_chan_width[e->ht_chan_info.chan_width]);
+   blobmsg_close_table(, t);
+
+   if (e->vht_chan_info.center_chan_1) {
+   t = blobmsg_open_table(, "vht_operation");
+   blobmsg_add_u32(, "channel_width", 
vht_chan_width[e->vht_chan_info.chan_width]);
+   blobmsg_add_u32(, "center_freq_1", 
e->vht_chan_info.center_chan_1);
+   blobmsg_add_u32(, "center_freq_2", 
e->vht_chan_info.center_chan_2);
+   blobmsg_close_table(, t);
+   }
+
rpc_iwinfo_add_encryption("encryption", >crypto);
 
blobmsg_close_table(, d);
-- 
2.29.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[IWINFO PATCH v3 1/4] iwinfo: export ht and vht operation in scan results

2020-12-05 Thread Ansuel Smith
Export ht and vht operation data in scan results. These additional data
can be usefull to check wifi channel utilizzation by neraby stations.

Signed-off-by: Ansuel Smith 
---
 include/iwinfo.h | 34 ++
 iwinfo_cli.c | 35 ++-
 iwinfo_nl80211.c | 10 ++
 3 files changed, 78 insertions(+), 1 deletion(-)

diff --git a/include/iwinfo.h b/include/iwinfo.h
index 5e64294..676db91 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -170,6 +170,38 @@ struct iwinfo_crypto_entry {
uint8_t auth_algs;
 };
 
+struct iwinfo_scanlist_ht_chan_entry {
+   uint8_t primary_chan;
+   uint8_t secondary_chan_off;
+   uint8_t chan_width;
+};
+
+struct iwinfo_scanlist_vht_chan_entry {
+   uint8_t chan_width;
+   uint8_t center_chan_1;
+   uint8_t center_chan_2;
+};
+
+static const char *ht_secondary_offset[4] = {
+   "no secondary",
+   "above",
+   "[reserved!]",
+   "below",
+};
+
+
+static uint16_t ht_chan_width[2] = {
+   20, /* 20 MHz */
+   2040, /* 40 MHz or higher (refer to vht if supported) */
+};
+
+static uint16_t vht_chan_width[] = {
+   [0] = 40, /* 40 MHz or lower (refer to ht to a more precise width) */
+   [1] = 80, /* 80 MHz */
+   [3] = 8080, /* 80+80 MHz */
+   [2] = 160, /* 160 MHz */
+};
+
 struct iwinfo_scanlist_entry {
uint8_t mac[6];
char ssid[IWINFO_ESSID_MAX_SIZE+1];
@@ -179,6 +211,8 @@ struct iwinfo_scanlist_entry {
uint8_t quality;
uint8_t quality_max;
struct iwinfo_crypto_entry crypto;
+   struct iwinfo_scanlist_ht_chan_entry ht_chan_info;
+   struct iwinfo_scanlist_vht_chan_entry vht_chan_info;
 };
 
 struct iwinfo_country_entry {
diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index 0332bc2..6bfe0ab 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -323,6 +323,20 @@ static char * format_assocrate(struct iwinfo_rate_entry *r)
return buf;
 }
 
+static const char* format_chan_width(uint16_t width)
+{
+   switch (width) {
+   case 20: return "20 MHz";
+   case 2040: return "40 MHz and upper or 20 MHz with intolerant 
bit";
+   case 40: return "40 MHz or lower";
+   case 80: return "80 MHz";
+   case 8080: return "80+80 MHz";
+   case 160: return "160 MHz";
+   }
+
+   return "unknown";
+}
+
 
 static const char * print_type(const struct iwinfo_ops *iw, const char *ifname)
 {
@@ -612,8 +626,27 @@ static void print_scanlist(const struct iwinfo_ops *iw, 
const char *ifname)
format_signal(e->signal - 0x100),
format_quality(e->quality),
format_quality_max(e->quality_max));
-   printf("  Encryption: %s\n\n",
+   printf("  Encryption: %s\n",
   format_encryption(>crypto));
+   printf("  HT Operation:\n");
+   printf("Primary Channel: %d\n",
+  e->ht_chan_info.primary_chan);
+   printf("Secondary Channel Offset: %s\n",
+  ht_secondary_offset[e->ht_chan_info.secondary_chan_off]);
+   printf("Channel Width: %s\n",
+  format_chan_width(e->ht_chan_info.chan_width));
+
+   if (e->vht_chan_info.center_chan_1) {
+ printf("  VHT Operation:\n");
+ printf("Channel Width: %s\n",
+format_chan_width(e->vht_chan_info.chan_width));
+ printf("Center Frequency 1: %d\n",
+e->vht_chan_info.center_chan_1);
+ printf("Center Frequency 2: %d\n",
+e->vht_chan_info.center_chan_2);
+   }
+
+   printf("\n");
}
 }
 
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index 2b2a043..5917e3a 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -2306,6 +2306,16 @@ static void nl80211_get_scanlist_ie(struct nlattr **bss,
iwinfo_parse_rsn(>crypto, ie + 6, ie[1] - 4,
 IWINFO_CIPHER_TKIP, 
IWINFO_KMGMT_PSK);
break;
+   case 61: /* HT oeration */
+   e->ht_chan_info.primary_chan = ie[2];
+   e->ht_chan_info.secondary_chan_off = ie[3] & 0x3;
+   e->ht_chan_info.chan_width = (ie[4] & 0x4)>>2;
+   break;
+   case 192: /* VHT operation */
+   e->vht_chan_info.chan_width = ie[2];
+   e->vht_chan_info.center_chan_1 = ie[3];
+   e->vht_chan_info.center_chan_2 = ie[4];
+   break;
}
 
ielen -= ie[1] + 2;
-- 
2.29.2



[IWINFO PATCH v3 2/4] iwinfo: export center_chan info for local wifi

2020-12-05 Thread Ansuel Smith
Iwinfo already export the htmode but there is no way to know where the
channel expan in case a 40Mhz+ channel width is used. Export the center
channels used by the driver to better know the channel utilizzation of
the wifi.

Signed-off-by: Ansuel Smith 
---
 include/iwinfo.h |  2 ++
 iwinfo_cli.c | 23 +++
 iwinfo_nl80211.c | 76 +++-
 3 files changed, 100 insertions(+), 1 deletion(-)

diff --git a/include/iwinfo.h b/include/iwinfo.h
index 676db91..680f384 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -282,6 +282,8 @@ struct iwinfo_ops {
int (*survey)(const char *, char *, int *);
int (*lookup_phy)(const char *, char *);
void (*close)(void);
+   int (*center_chan1)(const char *, int *);
+   int (*center_chan2)(const char *, int *);
 };
 
 const char * iwinfo_type(const char *ifname);
diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index 6bfe0ab..cc5d298 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -445,6 +445,24 @@ static char * print_channel(const struct iwinfo_ops *iw, 
const char *ifname)
return format_channel(ch);
 }
 
+static char * print_center_chan1(const struct iwinfo_ops *iw, const char 
*ifname)
+{
+   int ch;
+   if (iw->center_chan1(ifname, ))
+   ch = -1;
+
+   return format_channel(ch);
+}
+
+static char * print_center_chan2(const struct iwinfo_ops *iw, const char 
*ifname)
+{
+   int ch;
+   if (iw->center_chan2(ifname, ))
+   ch = -1;
+
+   return format_channel(ch);
+}
+
 static char * print_frequency(const struct iwinfo_ops *iw, const char *ifname)
 {
int freq;
@@ -566,6 +584,11 @@ static void print_info(const struct iwinfo_ops *iw, const 
char *ifname)
print_mode(iw, ifname),
print_channel(iw, ifname),
print_frequency(iw, ifname));
+   if (iw->center_chan1 != NULL) {
+   printf("  Center Channel 1: %s",
+   print_center_chan1(iw, ifname));
+   printf(" 2: %s\n", print_center_chan2(iw, ifname));
+   }
printf("  Tx-Power: %s  Link Quality: %s/%s\n",
print_txpower(iw, ifname),
print_quality(iw, ifname),
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index 5917e3a..1bcc5ea 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -1262,6 +1262,56 @@ static int nl80211_get_frequency(const char *ifname, int 
*buf)
return (*buf == 0) ? -1 : 0;
 }
 
+static int nl80211_get_center_freq1_cb(struct nl_msg *msg, void *arg)
+{
+   int *freq = arg;
+   struct nlattr **tb = nl80211_parse(msg);
+
+   if (tb[NL80211_ATTR_CENTER_FREQ1])
+   *freq = nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ1]);
+
+   return NL_SKIP;
+}
+
+static int nl80211_get_center_freq1(const char *ifname, int *buf)
+{
+   char *res;
+
+   /* try to find frequency from interface info */
+   res = nl80211_phy2ifname(ifname);
+   *buf = 0;
+
+   nl80211_request(res ? res : ifname, NL80211_CMD_GET_INTERFACE, 0,
+   nl80211_get_center_freq1_cb, buf);
+
+   return (*buf == 0) ? -1 : 0;
+}
+
+static int nl80211_get_center_freq2_cb(struct nl_msg *msg, void *arg)
+{
+   int *freq = arg;
+   struct nlattr **tb = nl80211_parse(msg);
+
+   if (tb[NL80211_ATTR_CENTER_FREQ2])
+   *freq = nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ2]);
+
+   return NL_SKIP;
+}
+
+static int nl80211_get_center_freq2(const char *ifname, int *buf)
+{
+   char *res;
+
+   /* try to find frequency from interface info */
+   res = nl80211_phy2ifname(ifname);
+   *buf = 0;
+
+   nl80211_request(res ? res : ifname, NL80211_CMD_GET_INTERFACE, 0,
+   nl80211_get_center_freq2_cb, buf);
+
+   return (*buf == 0) ? -1 : 0;
+}
+
 static int nl80211_get_channel(const char *ifname, int *buf)
 {
if (!nl80211_get_frequency(ifname, buf))
@@ -1273,6 +1323,28 @@ static int nl80211_get_channel(const char *ifname, int 
*buf)
return -1;
 }
 
+static int nl80211_get_center_chan1(const char *ifname, int *buf)
+{
+   if (!nl80211_get_center_freq1(ifname, buf))
+   {
+   *buf = nl80211_freq2channel(*buf);
+   return 0;
+   }
+
+   return -1;
+}
+
+static int nl80211_get_center_chan2(const char *ifname, int *buf)
+{
+   if (!nl80211_get_center_freq2(ifname, buf))
+   {
+   *buf = nl80211_freq2channel(*buf);
+   return 0;
+   }
+
+   return -1;
+}
+
 static int nl80211_get_txpower_cb(struct nl_msg *msg, void *arg)
 {
int *buf = arg;
@@ -3242,5 +3314,7 @@ const struct iwinfo_ops nl80211_ops = {
.countrylist  = nl80211_get_countrylist,
.survey   = nl80211_get_survey,
.lookup_phy   = nl80211_lookup_phyname,
-   .close= nl80211_close
+   .close= nl80211_close,
+   

[RPCD PATCH v3 3/4] iwinfo: add ht and vht operation info to wifi scan

2020-12-05 Thread Ansuel Smith
Iwinfo exports ht and vht operation info useful to get channel info of
nearby stations. Add these new info to ubus output.

Signed-off-by: Ansuel Smith 
---
 iwinfo.c | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/iwinfo.c b/iwinfo.c
index 7780e69..45ca784 100644
--- a/iwinfo.c
+++ b/iwinfo.c
@@ -403,7 +403,7 @@ rpc_iwinfo_scan(struct ubus_context *ctx, struct 
ubus_object *obj,
 struct blob_attr *msg)
 {
int i, rv, len;
-   void *c, *d;
+   void *c, *d, *t;
char mac[18];
char res[IWINFO_BUFSIZE];
struct iwinfo_scanlist_entry *e;
@@ -441,6 +441,20 @@ rpc_iwinfo_scan(struct ubus_context *ctx, struct 
ubus_object *obj,
blobmsg_add_u32(, "quality", e->quality);
blobmsg_add_u32(, "quality_max", e->quality_max);
 
+   t = blobmsg_open_table(, "ht_operation");
+   blobmsg_add_u32(, "primary_channel", 
e->ht_chan_info.primary_chan);
+   blobmsg_add_string(, "secondary_channel_offset", 
ht_secondary_offset[e->ht_chan_info.secondary_chan_off]);
+   blobmsg_add_u32(, "channel_width", 
ht_chan_width[e->ht_chan_info.chan_width]);
+   blobmsg_close_table(, t);
+
+   if (e->vht_chan_info.center_chan_1) {
+   t = blobmsg_open_table(, "vht_operation");
+   blobmsg_add_u32(, "channel_width", 
vht_chan_width[e->vht_chan_info.chan_width]);
+   blobmsg_add_u32(, "center_freq_1", 
e->vht_chan_info.center_chan_1);
+   blobmsg_add_u32(, "center_freq_2", 
e->vht_chan_info.center_chan_2);
+   blobmsg_close_table(, t);
+   }
+
rpc_iwinfo_add_encryption("encryption", >crypto);
 
blobmsg_close_table(, d);
-- 
2.29.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v3 0/4] Add support channel with to iwinfo

2020-12-05 Thread Ansuel Smith
This series modify 2 different repo. Iwinfo and Rpcd
The 2 iwinfo patch add support to iwinfo to display and export channel
width and center_channel info for both wifi scan and wifi info related
to the local wifi.
The other 2 rpcd patch export the iwinfo data to ubus to make them
usable by the webui.

v3:
- Add check for center_chan support in iwinfo_cli
- Use uinit to represent chan width and add function format_chant_width
v2:
- Put the static char array to the iwinfo include. (the rpcd plugin use
the same include)
- Add additional patch to export center_chanl for local wifi.

-- 
2.29.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[RPCD PATCH v3 4/4] iwinfo: export center channel for info ubus call

2020-12-05 Thread Ansuel Smith
Iwinfo export the center channel sued by the wifi. Include this data in
the ubus info call to better know the channel utilizzation of the wifi.

Signed-off-by: Ansuel Smith 
---
 iwinfo.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/iwinfo.c b/iwinfo.c
index 45ca784..94fa822 100644
--- a/iwinfo.c
+++ b/iwinfo.c
@@ -364,6 +364,8 @@ rpc_iwinfo_info(struct ubus_context *ctx, struct 
ubus_object *obj,
 
rpc_iwinfo_call_int("mode", iw->mode, IWINFO_OPMODE_NAMES);
rpc_iwinfo_call_int("channel", iw->channel, NULL);
+   rpc_iwinfo_call_int("center_chan1", iw->center_chan1, NULL);
+   rpc_iwinfo_call_int("center_chan2", iw->center_chan2, NULL);
 
rpc_iwinfo_call_int("frequency", iw->frequency, NULL);
rpc_iwinfo_call_int("frequency_offset", iw->frequency_offset, NULL);
-- 
2.29.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[RFC PATCH 3/5] ath79: deactivate PARTITION_ADVANCED

2020-12-05 Thread Sven Roederer
on this low-end hardware it's nearly impossible to add external drives, so
there seems no need for this partition-type.
this will safe some kernel-size
---
 target/linux/ath79/tiny/config-default | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/linux/ath79/tiny/config-default 
b/target/linux/ath79/tiny/config-default
index 8a83323bc2..c42f44b004 100644
--- a/target/linux/ath79/tiny/config-default
+++ b/target/linux/ath79/tiny/config-default
@@ -6,6 +6,7 @@ CONFIG_NET_DSA_MV88E6060=y
 # CONFIG_NET_DSA_TAG_QCA is not set
 CONFIG_NET_DSA_TAG_TRAILER=y
 CONFIG_NET_SWITCHDEV=y
+# CONFIG_PARTITION_ADVANCED is not set
 CONFIG_PHYLINK=y
 # CONFIG_PHY_AR7100_USB is not set
 # CONFIG_PHY_AR7200_USB is not set
-- 
2.20.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[RFC PATCH 2/5] kernel: deactivate usb on ath79-tiny

2020-12-05 Thread Sven Roederer
From: adminuser 

---
 target/linux/ath79/image/tiny-tp-link.mk | 4 
 target/linux/ath79/image/tiny-ubnt.mk| 2 --
 target/linux/ath79/image/tiny.mk | 1 -
 target/linux/ath79/tiny/config-default   | 5 +++--
 4 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/target/linux/ath79/image/tiny-tp-link.mk 
b/target/linux/ath79/image/tiny-tp-link.mk
index d5b36de577..ab931f02fb 100644
--- a/target/linux/ath79/image/tiny-tp-link.mk
+++ b/target/linux/ath79/image/tiny-tp-link.mk
@@ -16,7 +16,6 @@ define Device/tplink_tl-mr3020-v1
   SOC := ar9331
   DEVICE_MODEL := TL-MR3020
   DEVICE_VARIANT := v1
-  DEVICE_PACKAGES := kmod-usb-chipidea2 kmod-usb-ledtrig-usbport
   TPLINK_HWID := 0x3021
   SUPPORTED_DEVICES += tl-mr3020
 endef
@@ -27,7 +26,6 @@ define Device/tplink_tl-mr3040-v2
   SOC := ar9331
   DEVICE_MODEL := TL-MR3040
   DEVICE_VARIANT := v2
-  DEVICE_PACKAGES := kmod-usb-chipidea2 kmod-usb-ledtrig-usbport
   TPLINK_HWID := 0x3042
   SUPPORTED_DEVICES += tl-mr3040-v2
 endef
@@ -39,7 +37,6 @@ define Device/tplink_tl-mr3220-v1
   DEVICE_MODEL := TL-MR3220
   DEVICE_VARIANT := v1
   TPLINK_HWID := 0x3221
-  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
   SUPPORTED_DEVICES += tl-mr3220
 endef
 TARGET_DEVICES += tplink_tl-mr3220-v1
@@ -238,7 +235,6 @@ define Device/tplink_tl-wr703n
   $(Device/tplink-4mlzma)
   SOC := ar9331
   DEVICE_MODEL := TL-WR703N
-  DEVICE_PACKAGES := kmod-usb-chipidea2
   TPLINK_HWID := 0x07030101
   SUPPORTED_DEVICES += tl-wr703n
 endef
diff --git a/target/linux/ath79/image/tiny-ubnt.mk 
b/target/linux/ath79/image/tiny-ubnt.mk
index a8c5a2cf68..be7dd46761 100644
--- a/target/linux/ath79/image/tiny-ubnt.mk
+++ b/target/linux/ath79/image/tiny-ubnt.mk
@@ -31,7 +31,6 @@ endef
 # UBNT_VERSION e.g. one of (6.0.0, 8.5.3)
 define Device/ubnt
   DEVICE_VENDOR := Ubiquiti
-  DEVICE_PACKAGES := kmod-usb2
   IMAGES += factory.bin
   IMAGE/factory.bin := append-kernel | pad-to (BLOCKSIZE) | \
append-rootfs | pad-rootfs | check-size | mkubntimage-split
@@ -40,7 +39,6 @@ endef
 define Device/ubnt-xm
   $(Device/ubnt)
   DEVICE_VARIANT := XM
-  DEVICE_PACKAGES += kmod-usb-ohci
   IMAGE_SIZE := 7448k
   UBNT_BOARD := XM
   UBNT_CHIP := ar7240
diff --git a/target/linux/ath79/image/tiny.mk b/target/linux/ath79/image/tiny.mk
index 83c34d718b..800b2055db 100644
--- a/target/linux/ath79/image/tiny.mk
+++ b/target/linux/ath79/image/tiny.mk
@@ -34,7 +34,6 @@ define Device/pqi_air-pen
   SOC := ar9330
   DEVICE_VENDOR := PQI
   DEVICE_MODEL := Air-Pen
-  DEVICE_PACKAGES := kmod-usb2
   IMAGE_SIZE := 7680k
   SUPPORTED_DEVICES += pqi-air-pen
 endef
diff --git a/target/linux/ath79/tiny/config-default 
b/target/linux/ath79/tiny/config-default
index 42243cfc48..8a83323bc2 100644
--- a/target/linux/ath79/tiny/config-default
+++ b/target/linux/ath79/tiny/config-default
@@ -7,7 +7,8 @@ CONFIG_NET_DSA_MV88E6060=y
 CONFIG_NET_DSA_TAG_TRAILER=y
 CONFIG_NET_SWITCHDEV=y
 CONFIG_PHYLINK=y
-CONFIG_PHY_AR7100_USB=y
-CONFIG_PHY_AR7200_USB=y
+# CONFIG_PHY_AR7100_USB is not set
+# CONFIG_PHY_AR7200_USB is not set
 CONFIG_REGULATOR=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
+# CONFIG_USB_SUPPORT is not set
-- 
2.20.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[RFC PATCH 1/5] ath79: put some 8/32MB devices to tiny subtarget

2020-12-05 Thread Sven Roederer
Even the 8MB flash/ 32MB RAM devices provide enough space to install a full 
OpenWrt
and LuCI they often fail to run as stable as 64MB RAM devices. For this reason 
make
such boards also available in the ath79-tiny target.
Affected boards include (for now):
* Ubiquiti Nanostation M (XM)
* TPLink WR1043v1; WR842v1/v2; WR710

Signed-off-by: Sven Roederer 
---
 target/linux/ath79/image/Makefile |   1 +
 target/linux/ath79/image/common-tp-link.mk|   2 +
 target/linux/ath79/image/tiny-tp-link.mk  |  66 +
 target/linux/ath79/image/tiny-ubnt.mk | 132 ++
 .../ath79/tiny/base-files/etc/board.d/01_leds |   7 +
 .../tiny/base-files/etc/board.d/02_network|  11 +-
 .../base-files/etc/board.d/03_gpio_switches   |  20 +++
 .../etc/hotplug.d/firmware/10-ath9k-eeprom|   7 +-
 target/linux/ath79/tiny/target.mk |   4 +-
 9 files changed, 246 insertions(+), 4 deletions(-)
 create mode 100644 target/linux/ath79/image/tiny-ubnt.mk
 create mode 100755 
target/linux/ath79/tiny/base-files/etc/board.d/03_gpio_switches

diff --git a/target/linux/ath79/image/Makefile 
b/target/linux/ath79/image/Makefile
index 9bec159cf0..565ab14520 100644
--- a/target/linux/ath79/image/Makefile
+++ b/target/linux/ath79/image/Makefile
@@ -81,6 +81,7 @@ endif
 ifeq ($(SUBTARGET),tiny)
 include tiny-netgear.mk
 include tiny-tp-link.mk
+include tiny-ubnt.mk
 endif
 
 $(eval $(call BuildImage))
diff --git a/target/linux/ath79/image/common-tp-link.mk 
b/target/linux/ath79/image/common-tp-link.mk
index 0b7b0e1935..07dd622f30 100644
--- a/target/linux/ath79/image/common-tp-link.mk
+++ b/target/linux/ath79/image/common-tp-link.mk
@@ -40,6 +40,7 @@ define Device/tplink-4m
   $(Device/tplink-nolzma)
   TPLINK_FLASHLAYOUT := 4M
   IMAGE_SIZE := 3904k
+  FEATURES := small_flash
   DEFAULT := n
 endef
 
@@ -47,6 +48,7 @@ define Device/tplink-4mlzma
   $(Device/tplink-v1)
   TPLINK_FLASHLAYOUT := 4Mlzma
   IMAGE_SIZE := 3904k
+  FEATURES := small_flash
   DEFAULT := n
 endef
 
diff --git a/target/linux/ath79/image/tiny-tp-link.mk 
b/target/linux/ath79/image/tiny-tp-link.mk
index c918c6baa6..d5b36de577 100644
--- a/target/linux/ath79/image/tiny-tp-link.mk
+++ b/target/linux/ath79/image/tiny-tp-link.mk
@@ -223,6 +223,17 @@ define Device/tplink_tl-wa901nd-v5
 endef
 TARGET_DEVICES += tplink_tl-wa901nd-v5
 
+define Device/tplink_tl-wr1043nd-v1
+  $(Device/tplink-8m)
+  SOC := ar9132
+  DEVICE_MODEL := TL-WR1043N/ND
+  DEVICE_VARIANT := v1
+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
+  TPLINK_HWID := 0x10430001
+  SUPPORTED_DEVICES += tl-wr1043nd
+endef
+TARGET_DEVICES += tplink_tl-wr1043nd-v1
+
 define Device/tplink_tl-wr703n
   $(Device/tplink-4mlzma)
   SOC := ar9331
@@ -243,6 +254,29 @@ define Device/tplink_tl-wr740n-v1
 endef
 TARGET_DEVICES += tplink_tl-wr740n-v1
 
+define Device/tplink_tl-wr710n-v1
+  $(Device/tplink-8mlzma)
+  SOC := ar9331
+  DEVICE_MODEL := TL-WR710N
+  DEVICE_VARIANT := v1
+  DEVICE_PACKAGES := kmod-usb-chipidea2 kmod-usb-ledtrig-usbport
+  TPLINK_HWID := 0x0711
+  SUPPORTED_DEVICES += tl-wr710n
+endef
+TARGET_DEVICES += tplink_tl-wr710n-v1
+
+define Device/tplink_tl-wr710n-v2.1
+  $(Device/tplink-8mlzma)
+  SOC := ar9331
+  DEVICE_MODEL := TL-WR710N
+  DEVICE_VARIANT := v2.1
+  DEVICE_PACKAGES := kmod-usb-chipidea2 kmod-usb-ledtrig-usbport
+  TPLINK_HWID := 0x0712
+  TPLINK_HWREV := 0x2
+  SUPPORTED_DEVICES += tl-wr710n
+endef
+TARGET_DEVICES += tplink_tl-wr710n-v2.1
+
 define Device/tplink_tl-wr740n-v3
   $(Device/tplink-4m)
   SOC := ar7240
@@ -327,6 +361,16 @@ define Device/tplink_tl-wr802n-v2
 endef
 TARGET_DEVICES += tplink_tl-wr802n-v2
 
+define Device/tplink_tl-wr810n-v2
+  $(Device/tplink-8mlzma)
+  SOC := qca9533
+  DEVICE_MODEL := TL-WR810N
+  DEVICE_VARIANT := v2
+  TPLINK_HWID := 0x812
+  SUPPORTED_DEVICES += tl-wr810n-v2
+endef
+TARGET_DEVICES += tplink_tl-wr810n-v2
+
 define Device/tplink_tl-wr841-v5
   $(Device/tplink-4m)
   SOC := ar7240
@@ -403,6 +447,28 @@ define Device/tplink_tl-wr841-v12
 endef
 TARGET_DEVICES += tplink_tl-wr841-v12
 
+define Device/tplink_tl-wr842n-v1
+  $(Device/tplink-8m)
+  SOC := ar7241
+  DEVICE_MODEL := TL-WR842N/ND
+  DEVICE_VARIANT := v1
+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
+  TPLINK_HWID := 0x8420001
+  SUPPORTED_DEVICES += tl-mr3420
+endef
+TARGET_DEVICES += tplink_tl-wr842n-v1
+
+define Device/tplink_tl-wr842n-v2
+  $(Device/tplink-8mlzma)
+  SOC := ar9341
+  DEVICE_MODEL := TL-WR842N/ND
+  DEVICE_VARIANT := v2
+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
+  TPLINK_HWID := 0x8420002
+  SUPPORTED_DEVICES += tl-wr842n-v2
+endef
+TARGET_DEVICES += tplink_tl-wr842n-v2
+
 define Device/tplink_tl-wr940n-v3
   $(Device/tplink-4mlzma)
   SOC := tp9343
diff --git a/target/linux/ath79/image/tiny-ubnt.mk 
b/target/linux/ath79/image/tiny-ubnt.mk
new file mode 100644
index 00..a8c5a2cf68
--- /dev/null
+++ b/target/linux/ath79/image/tiny-ubnt.mk
@@ -0,0 +1,132 @@

[RFC PATCH 4/5] kernel: ath79-tiny deactivate usually not needed features

2020-12-05 Thread Sven Roederer
From: adminuser 

this includes:
* CONFIG_AIO
* CONFIG_HAVE_IDE
* CONFIG_NVMEM
* CONFIG_DEBUG_FS
* CONFIG_DEBUG_KERNEL
* CONFIG_HAVE_DEBUG_KMEMLEAK
* CONFIG_HAVE_DEBUG_STACKOVERFLOW
* CONFIG_ISDN
* CONFIG_SND_DRIVERS
* CONFIG_STAGING
* CONFIG_HAVE_KVM
* CONFIG_VIRTIO_MENU
---
 target/linux/ath79/tiny/config-default | 13 +
 1 file changed, 13 insertions(+)

diff --git a/target/linux/ath79/tiny/config-default 
b/target/linux/ath79/tiny/config-default
index c42f44b004..5dcdf30af4 100644
--- a/target/linux/ath79/tiny/config-default
+++ b/target/linux/ath79/tiny/config-default
@@ -13,3 +13,16 @@ CONFIG_PHYLINK=y
 CONFIG_REGULATOR=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
 # CONFIG_USB_SUPPORT is not set
+# CONFIG_HAVE_DEBUG_KMEMLEAK is not set
+# CONFIG_HAVE_DEBUG_STACKOVERFLOW is not set
+# CONFIG_HAVE_IDE is not set
+# CONFIG_HAVE_KVM is not set
+# CONFIG_NVMEM is not set
+# CONFIG_AIO is not set
+# CONFIG_DEBUG_FS is not set
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_ISDN is not set
+# CONFIG_SND_DRIVERS is not set
+# CONFIG_STAGING is not set
+# CONFIG_VIRTIO_MENU is not set
+
-- 
2.20.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[RFC PATCH 5/5] kernel: ath79-tiny: enable CONFIG_BLOCK

2020-12-05 Thread Sven Roederer
From: adminuser 

---
 target/linux/ath79/tiny/config-default | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/linux/ath79/tiny/config-default 
b/target/linux/ath79/tiny/config-default
index 5dcdf30af4..f686d284f6 100644
--- a/target/linux/ath79/tiny/config-default
+++ b/target/linux/ath79/tiny/config-default
@@ -16,6 +16,7 @@ CONFIG_REGULATOR_FIXED_VOLTAGE=y
 # CONFIG_HAVE_DEBUG_KMEMLEAK is not set
 # CONFIG_HAVE_DEBUG_STACKOVERFLOW is not set
 # CONFIG_HAVE_IDE is not set
+CONFIG_BLOCK=y
 # CONFIG_HAVE_KVM is not set
 # CONFIG_NVMEM is not set
 # CONFIG_AIO is not set
-- 
2.20.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[RFC 0/5] ath79: add a lower RAM-using version of 8/32 devices

2020-12-05 Thread Sven Roederer
Currently 8MB flash / 32MB RAM devices are fully supported in OpenWrt, as they
work quite well for basic usage (including full LuCI). 
On some projects with advanced features (e.g. Freifunk) the lack of RAM turns 
them into unstable devices. Mostly caused by several OOM problems per day.
This series tries to prolong the usage of these boards by moving them to the 
ath79-tiny target. Indeed it makes these boards available on ath79-tiny in 
addition to the current ath79-generic variant.
To improve the low RAM situation the default kernel-config for the tiny sub-
target will also disable some uncommon features. So the kernel image becomes 
smaller, which results in lower flash- and RAM-footprint.

[RFC PATCH 1/5] ath79: put some 8/32MB devices to tiny subtarget
[RFC PATCH 2/5] kernel: deactivate usb on ath79-tiny
[RFC PATCH 3/5] ath79: deactivate PARTITION_ADVANCED
[RFC PATCH 4/5] kernel: ath79-tiny deactivate usually not needed features
[RFC PATCH 5/5] kernel: ath79-tiny: enable CONFIG_BLOCK


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: ramips: add support for Xiaomi Mi Router 4AC (100M Edition)

2020-12-05 Thread Sorin Pop
The difference is the size of the overlay and partition table and the
uboot that is used on the devices.

xiaomi_mir4a-100m uses bc16 as entry point
and
xiaomi_mir4ac-100m uses bc26 as entry point

from what I have seen mir4a is a CN version of MIR4AC which is EU.

On Sun, Dec 6, 2020 at 2:38 AM Adrian Schmutzler
 wrote:
>
> > -Original Message-
> > From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> > On Behalf Of Sorin Pop
> > Sent: Sonntag, 6. Dezember 2020 00:54
> > To: openwrt-devel@lists.openwrt.org
> > Subject: ramips: add support for Xiaomi Mi Router 4AC (100M Edition)
> >
> > - SoC:  MediaTek MT7628AN
> > - Flash:16MB (Winbond W25Q128JV)
> > - RAM:  64MB
> > - Serial:   As marked on PCB, 3V3 logic, baudrate is 115200
> > - Ethernet: 3x 10/100 Mbps (switched, 2x LAN + WAN)
> > - WIFI0:MT7628AN 2.4GHz 802.11b/g/n
> > - WIFI1:MT7612EN 5GHz 802.11ac
> > - Antennas: 4x external (2 per radio), non-detachable
> > - LEDs: Programmable power-LED (two-colored, yellow/blue)
> > Non-programmable internet-LED (shows WAN-activity)
> > - Buttons:  Reset
>
> So, the only difference in implementation is the size of overlay/firmware 
> partitions?
>
> Best
>
> Adrian
>
> >
> > INSTALLATION:
> >
> > 1. Connect to the serial port of the router and power it up.
> >If you get a prompt asking for boot-mode, go to step 3.
> > 2. Unplug the router after
> >> Erasing SPI Flash...
> >> raspi_erase: offs:2 len:1
> >occurs on the serial port. Plug the router back in.
> > 3. At the prompt select option 2 (Load system code then
> >write to Flash via TFTP.)
> > 4. Enter 192.168.1.1 as the device IP and 192.168.1.2 as the
> >Server-IP.
> > 5. Connect your computer to LAN1 and assign it as 192.168.1.2/24.
> > 6. Serve the sysupgrade image via TFTP
> >
> > This router seems to have the same hardware as Xiaomi Mi Router 4A (100M
> > Edition) but it uses a different U-Boot.
> >
> > Signed-off-by: Sorin Pop 



-- 
Sorin Alexandru Pop
Tel: +40-723-346437

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] nettle: update to 3.6

2020-12-05 Thread Rosen Penev
Updated ABI_VERSION.

Switched PKG_BUILD_PARALLEL on as there seems to be no issue anymore.
I can't find any information about why it was turned off.

Fixed license information.

Signed-off-by: Rosen Penev 
---
 package/libs/nettle/Makefile | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/package/libs/nettle/Makefile b/package/libs/nettle/Makefile
index b9324e4793..b15ea0fa07 100644
--- a/package/libs/nettle/Makefile
+++ b/package/libs/nettle/Makefile
@@ -8,17 +8,17 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=nettle
-PKG_VERSION:=3.5.1
-PKG_RELEASE:=2
+PKG_VERSION:=3.6
+PKG_RELEASE:=1
 PKG_USE_MIPS16:=0
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@GNU/nettle
-PKG_HASH:=75cca1998761b02e16f2db56da52992aef622bf55a3b45ec538bc2eedadc9419
+PKG_HASH:=d24c0d0f2abffbc8f4f34dcf114b0f131ec3774895f3555922fe2f40f3d5e3f1
 
-PKG_LICENSE:=GPL-2.0+
+PKG_LICENSE:=GPL-2.0-or-later
 PKG_LICENSE_FILES:=COPYING
-PKG_BUILD_PARALLEL:=0
+PKG_BUILD_PARALLEL:=1
 
 PKG_CONFIG_DEPENDS := CONFIG_LIBNETTLE_MINI
 
@@ -30,7 +30,7 @@ define Package/libnettle
   TITLE:=GNU crypto library
   URL:=http://www.lysator.liu.se/~nisse/nettle/
   DEPENDS+= +!LIBNETTLE_MINI:libgmp
-  ABI_VERSION:=7
+  ABI_VERSION:=8
 endef
 
 define Package/libnettle/config
-- 
2.28.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


RE: ramips: add support for Xiaomi Mi Router 4AC (100M Edition)

2020-12-05 Thread Adrian Schmutzler
> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Sorin Pop
> Sent: Sonntag, 6. Dezember 2020 00:54
> To: openwrt-devel@lists.openwrt.org
> Subject: ramips: add support for Xiaomi Mi Router 4AC (100M Edition)
> 
> - SoC:  MediaTek MT7628AN
> - Flash:16MB (Winbond W25Q128JV)
> - RAM:  64MB
> - Serial:   As marked on PCB, 3V3 logic, baudrate is 115200
> - Ethernet: 3x 10/100 Mbps (switched, 2x LAN + WAN)
> - WIFI0:MT7628AN 2.4GHz 802.11b/g/n
> - WIFI1:MT7612EN 5GHz 802.11ac
> - Antennas: 4x external (2 per radio), non-detachable
> - LEDs: Programmable power-LED (two-colored, yellow/blue)
> Non-programmable internet-LED (shows WAN-activity)
> - Buttons:  Reset

So, the only difference in implementation is the size of overlay/firmware 
partitions?

Best

Adrian

> 
> INSTALLATION:
> 
> 1. Connect to the serial port of the router and power it up.
>If you get a prompt asking for boot-mode, go to step 3.
> 2. Unplug the router after
>> Erasing SPI Flash...
>> raspi_erase: offs:2 len:1
>occurs on the serial port. Plug the router back in.
> 3. At the prompt select option 2 (Load system code then
>write to Flash via TFTP.)
> 4. Enter 192.168.1.1 as the device IP and 192.168.1.2 as the
>Server-IP.
> 5. Connect your computer to LAN1 and assign it as 192.168.1.2/24.
> 6. Serve the sysupgrade image via TFTP
> 
> This router seems to have the same hardware as Xiaomi Mi Router 4A (100M
> Edition) but it uses a different U-Boot.
> 
> Signed-off-by: Sorin Pop 


openpgp-digital-signature.asc
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


ramips: add support for Xiaomi Mi Router 4AC (100M Edition)

2020-12-05 Thread Sorin Pop
- SoC:  MediaTek MT7628AN
- Flash:16MB (Winbond W25Q128JV)
- RAM:  64MB
- Serial:   As marked on PCB, 3V3 logic, baudrate is 115200
- Ethernet: 3x 10/100 Mbps (switched, 2x LAN + WAN)
- WIFI0:MT7628AN 2.4GHz 802.11b/g/n
- WIFI1:MT7612EN 5GHz 802.11ac
- Antennas: 4x external (2 per radio), non-detachable
- LEDs: Programmable power-LED (two-colored, yellow/blue)
Non-programmable internet-LED (shows WAN-activity)
- Buttons:  Reset

INSTALLATION:

1. Connect to the serial port of the router and power it up.
   If you get a prompt asking for boot-mode, go to step 3.
2. Unplug the router after
   > Erasing SPI Flash...
   > raspi_erase: offs:2 len:1
   occurs on the serial port. Plug the router back in.
3. At the prompt select option 2 (Load system code then
   write to Flash via TFTP.)
4. Enter 192.168.1.1 as the device IP and 192.168.1.2 as the
   Server-IP.
5. Connect your computer to LAN1 and assign it as 192.168.1.2/24.
6. Serve the sysupgrade image via TFTP

This router seems to have the same hardware as Xiaomi Mi Router 4A
(100M Edition) but it uses a different U-Boot.

Signed-off-by: Sorin Pop 


xiaomi-mir4ac-100m.patch
Description: Binary data
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] base-files: flush kernel memory cache during sysupgrade

2020-12-05 Thread Sven Roederer
Am Dienstag, 24. November 2020, 07:39:48 CET schrieb Hannu Nyman:
> Flush kernel memory caches during sysupgrade in order
> to mitigate the impact from memory consumption spikes
> in low-RAM devices.
> 
> This may help to prevent sysupgrade causing a reboot
> before the actual flashing starts.
> 
> Signed-off-by: Hannu Nyman 
> ---
> 
> I have noticed this to help in 64 MB WNDR3700v2, where sysupgrade
> typically has failed when the router has been running some time,
> but succeeded when sysupgrade is done right after a reboot.
> 

On a 8/32MB device (NanoStation M) it took several attemts to get a sysupgrade 
in place. With this change it mostly finished successfully on the 1st attempt.

> The cache flushing is non-destructive and as the router is going
> to sysupgrade, there aren't "long-term" performance issues.
> 

As it seems to have no sideeffects I would like to see this merged.


Best Sven

> Reference to mailing list discussion in
> http://lists.openwrt.org/pipermail/openwrt-devel/2020-November/032266.html
> 
> Kernel documentation:
> https://www.kernel.org/doc/Documentation/sysctl/vm.txt
> 
> 
>  package/base-files/files/lib/upgrade/common.sh | 1 +
>  package/base-files/files/lib/upgrade/stage2| 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/package/base-files/files/lib/upgrade/common.sh
> b/package/base-files/files/lib/upgrade/common.sh index
> a5c27dc2fb..b44a5998f4 100644
> --- a/package/base-files/files/lib/upgrade/common.sh
> +++ b/package/base-files/files/lib/upgrade/common.sh
> @@ -297,6 +297,7 @@ indicate_upgrade() {
>  # $(2): (optional) pipe command to extract firmware, e.g. dd bs=n skip=m
>  default_do_upgrade() {
>   sync
> + echo 3 > /proc/sys/vm/drop_caches
>   if [ -n "$UPGRADE_BACKUP" ]; then
>   get_image "$1" "$2" | mtd $MTD_ARGS $MTD_CONFIG_ARGS -j 
"$UPGRADE_BACKUP"
> write - "${PART_NAME:-image}" else
> diff --git a/package/base-files/files/lib/upgrade/stage2
> b/package/base-files/files/lib/upgrade/stage2 index c7629c383f..23d356a447
> 100755
> --- a/package/base-files/files/lib/upgrade/stage2
> +++ b/package/base-files/files/lib/upgrade/stage2
> @@ -123,6 +123,7 @@ kill_remaining KILL 1
> 
>  sleep 1
> 
> +echo 3 > /proc/sys/vm/drop_caches
> 
>  if [ -n "$IMAGE" ] && type 'platform_pre_upgrade' >/dev/null 2>/dev/null;
> then platform_pre_upgrade "$IMAGE"





___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] procd: also depend on jshn

2020-12-05 Thread Sven Roederer
fixes "file no found" error on stripped down images, caused by prod.sh:43.

Signed-off-by: Sven Roederer 
---
 package/system/procd/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile
index 09aded15b5..be41c5276d 100644
--- a/package/system/procd/Makefile
+++ b/package/system/procd/Makefile
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=procd
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
@@ -45,7 +45,7 @@ define Package/procd/Default
   SECTION:=base
   CATEGORY:=Base system
   DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox \
- +libubus +libblobmsg-json +libjson-c
+ +libubus +libblobmsg-json +libjson-c +jshn
   TITLE:=OpenWrt system process manager
   USERID:=:dialout=20 :audio=29
 endef
-- 
2.20.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: odhcp6c RENEW timeout issue leads to OOM/OOPS [Was: Re: QEMU x86/64 ubus issues ... ]

2020-12-05 Thread Petr Štetiar
Hans Dedecker  [2020-12-04 13:55:27]:

> Could you run odhcpd with loglevel 7 as I would like to understand
> what triggers the numerous transmission of the Reconfigure messages

http://ynezz.true.cz/openwrt/odhcp6c/syslog-2020-12-05.log.gz

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: SAD DNS cache poisoning attack

2020-12-05 Thread Baptiste Jonglez
On 05-12-20, Alexander 'lynxis' Couzens wrote:
> Hi,
> 
> I'm wondering is dnsmasq also vulnerable as forwarder? Or
> only as recursive resolver?

Yes, as forwarder.  I don't think dnsmasq implements a real recursive
resolver.

> Did someone tested it? Is there a public poc?

I tested the basic behaviour used by the attack (ICMP errors when hitting
a closed port, nothing when hitting a open port and spoofing the peer
address) and it worked.  I did not reproduce the full attack but since we
are not customizing this part of the kernel it should work.

I am not aware of a public PoC.  Successful cache poisoning is not
straightforward to pull off because you still have to guess the
transaction ID and you have limited time to do so.  But a motivated
attacker can definitely do it, it does not require significant resources.

Baptiste


signature.asc
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: SAD DNS cache poisoning attack

2020-12-05 Thread Alexander 'lynxis' Couzens
Hi,

I'm wondering is dnsmasq also vulnerable as forwarder? Or
only as recursive resolver?

Did someone tested it? Is there a public poc?

Best,
lynxis
-- 
Alexander Couzens

mail: lyn...@fe80.eu
jabber: lyn...@fe80.eu
gpg: 390D CF78 8BF9 AA50 4F8F  F1E2 C29E 9DA6 A0DF 8604


pgpud5IIPn7jp.pgp
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCHv2] libcxx[abi]: remove

2020-12-05 Thread Rosen Penev
This is a neat project, but offers no benefit to OpenWrt. The initial
reason for it was to be a replacement for libstdcpp as it is smaller
and lacks compatibility for C++98. Unfortunately, compiling several
packages with it results in larger ipk sizes.

While not a member of the packages feed, this will be moved to
packages-abandoned to keep it somewhere.

Signed-off-by: Rosen Penev 
---
 v2: remove extra config stuff
 config/Config-build.in   |  4 --
 include/uclibc++.mk  | 12 +---
 package/libs/libcxx/Makefile | 66 --
 package/libs/libcxx/files/g++-libcxx | 19 --
 package/libs/libcxx/patches/010-ssp.patch| 13 
 package/libs/libcxxabi/Makefile  | 71 
 package/libs/libcxxabi/patches/010-arm.patch | 27 
 7 files changed, 2 insertions(+), 210 deletions(-)
 delete mode 100644 package/libs/libcxx/Makefile
 delete mode 100755 package/libs/libcxx/files/g++-libcxx
 delete mode 100644 package/libs/libcxx/patches/010-ssp.patch
 delete mode 100644 package/libs/libcxxabi/Makefile
 delete mode 100644 package/libs/libcxxabi/patches/010-arm.patch

diff --git a/config/Config-build.in b/config/Config-build.in
index a54df11566..cfefa4eed3 100644
--- a/config/Config-build.in
+++ b/config/Config-build.in
@@ -215,10 +215,6 @@ menu "Global build settings"
config USE_UCLIBCXX
bool "uClibc++"
 
-   config USE_LIBCXX
-   bool "libc++"
-   depends on !USE_UCLIBC
-
config USE_LIBSTDCXX
bool "libstdc++"
endchoice
diff --git a/include/uclibc++.mk b/include/uclibc++.mk
index 27533279c9..a1a61f26d4 100644
--- a/include/uclibc++.mk
+++ b/include/uclibc++.mk
@@ -4,8 +4,8 @@ ifndef DUMP
   endif
 endif
 
-PKG_PREPARED_DEPENDS += CONFIG_USE_UCLIBCXX CONFIG_USE_LIBCXX
-CXX_DEPENDS = +USE_UCLIBCXX:uclibcxx +USE_LIBCXX:libcxx 
+USE_LIBSTDCXX:libstdcpp
+PKG_PREPARED_DEPENDS += CONFIG_USE_UCLIBCXX
+CXX_DEPENDS = +USE_UCLIBCXX:uclibcxx +USE_LIBSTDCXX:libstdcpp
 
 ifneq ($(CONFIG_USE_UCLIBCXX),)
  ifneq ($(CONFIG_CCACHE),)
@@ -14,11 +14,3 @@ ifneq ($(CONFIG_USE_UCLIBCXX),)
   TARGET_CXX=g++-uc
  endif
 endif
-
-ifneq ($(CONFIG_USE_LIBCXX),)
- ifneq ($(CONFIG_CCACHE),)
-  TARGET_CXX_NOCACHE=g++-libcxx
- else
-  TARGET_CXX=g++-libcxx
- endif
-endif
diff --git a/package/libs/libcxx/Makefile b/package/libs/libcxx/Makefile
deleted file mode 100644
index 3809bea651..00
--- a/package/libs/libcxx/Makefile
+++ /dev/null
@@ -1,66 +0,0 @@
-
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=libcxx
-PKG_VERSION:=10.0.0
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.xz
-PKG_SOURCE_URL:=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(PKG_VERSION)
-PKG_HASH:=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION).src
-
-PKG_MAINTAINER:=Rosen Penev 
-PKG_LICENSE:=MIT
-PKG_LICENSE_FILES:=LICENSE.txt
-
-PKG_BUILD_PARALLEL:=1
-PKG_BUILD_DEPENDS:=libcxxabi
-CMAKE_BINARY_SUBDIR:=build
-
-include $(INCLUDE_DIR)/package.mk
-include $(INCLUDE_DIR)/cmake.mk
-
-define Package/libcxx
-  SECTION:=libs
-  CATEGORY:=Libraries
-  TITLE:=LLVM libstdc++
-  URL:=https://libcxx.llvm.org/
-  DEPENDS:=+libatomic +libpthread
-endef
-
-define Package/libcxx/description
-  libc++ is an implementation of the C++ standard library, targeting C++11, 
C++14 and above.
-endef
-
-CMAKE_OPTIONS += \
-   -DLIBCXX_CXX_ABI="libcxxabi" \
-   -DLIBCXX_ENABLE_ASSERTIONS=OFF \
-   -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF \
-   -DLIBCXX_INCLUDE_BENCHMARKS=OFF \
-   -DLIBCXX_INCLUDE_DOCS=OFF \
-   -DLIBCXX_INCLUDE_TESTS=OFF \
-   -DLIBCXX_LIBDIR_SUFFIX="" \
-   -DLIBCXX_STANDALONE_BUILD=ON \
-   -DLIBCXX_HAS_MUSL_LIBC=$(if $(CONFIG_USE_MUSL),ON,OFF)
-
-TARGET_CXXFLAGS += -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -Wno-attributes -flto
-TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
-
-define Build/InstallDev
-   $(call Build/InstallDev/cmake,$(1))
-   $(CP) files/g++-libcxx  $(TOOLCHAIN_DIR)/bin/
-   $(SED) 's,CXX,$(TARGET_CXX),g' $(TOOLCHAIN_DIR)/bin/g++-libcxx
-endef
-
-define Package/libcxx/install
-   $(INSTALL_DIR)  $(1)/usr/lib
-   $(CP) $(PKG_INSTALL_DIR)/usr/lib/libc++.so.*$(1)/usr/lib/
-endef
-
-$(eval $(call BuildPackage,libcxx))
diff --git a/package/libs/libcxx/files/g++-libcxx 
b/package/libs/libcxx/files/g++-libcxx
deleted file mode 100755
index 88b3e7da01..00
--- a/package/libs/libcxx/files/g++-libcxx
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-WRAPPER_INCLUDEDIR="-I$STAGING_DIR/usr/include/c++/v1"
-WRAPPER_LIBDIR="-L$STAGING_DIR/usr/lib"
-WRAPPER_LIBS="-lc -lgcc_s -lssp_nonshared"
-
-WRAPPER_OPTIONS=""

[PATCH] libcxx[abi]: remove

2020-12-05 Thread Rosen Penev
This is a neat project, but offers no benefit to OpenWrt. The initial
reason for it was to be a replacement for libstdcpp as it is smaller
and lacks compatibility for C++98. Unfortunately, compiling several
packages with it results in larger ipk sizes.

While not a member of the packages feed, this will be moved to
packages-abandoned to keep it somewhere.

Signed-off-by: Rosen Penev 
---
 package/libs/libcxx/Makefile | 66 --
 package/libs/libcxx/files/g++-libcxx | 19 --
 package/libs/libcxx/patches/010-ssp.patch| 13 
 package/libs/libcxxabi/Makefile  | 71 
 package/libs/libcxxabi/patches/010-arm.patch | 27 
 5 files changed, 196 deletions(-)
 delete mode 100644 package/libs/libcxx/Makefile
 delete mode 100755 package/libs/libcxx/files/g++-libcxx
 delete mode 100644 package/libs/libcxx/patches/010-ssp.patch
 delete mode 100644 package/libs/libcxxabi/Makefile
 delete mode 100644 package/libs/libcxxabi/patches/010-arm.patch

diff --git a/package/libs/libcxx/Makefile b/package/libs/libcxx/Makefile
deleted file mode 100644
index 3809bea651..00
--- a/package/libs/libcxx/Makefile
+++ /dev/null
@@ -1,66 +0,0 @@
-
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=libcxx
-PKG_VERSION:=10.0.0
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.xz
-PKG_SOURCE_URL:=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(PKG_VERSION)
-PKG_HASH:=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION).src
-
-PKG_MAINTAINER:=Rosen Penev 
-PKG_LICENSE:=MIT
-PKG_LICENSE_FILES:=LICENSE.txt
-
-PKG_BUILD_PARALLEL:=1
-PKG_BUILD_DEPENDS:=libcxxabi
-CMAKE_BINARY_SUBDIR:=build
-
-include $(INCLUDE_DIR)/package.mk
-include $(INCLUDE_DIR)/cmake.mk
-
-define Package/libcxx
-  SECTION:=libs
-  CATEGORY:=Libraries
-  TITLE:=LLVM libstdc++
-  URL:=https://libcxx.llvm.org/
-  DEPENDS:=+libatomic +libpthread
-endef
-
-define Package/libcxx/description
-  libc++ is an implementation of the C++ standard library, targeting C++11, 
C++14 and above.
-endef
-
-CMAKE_OPTIONS += \
-   -DLIBCXX_CXX_ABI="libcxxabi" \
-   -DLIBCXX_ENABLE_ASSERTIONS=OFF \
-   -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF \
-   -DLIBCXX_INCLUDE_BENCHMARKS=OFF \
-   -DLIBCXX_INCLUDE_DOCS=OFF \
-   -DLIBCXX_INCLUDE_TESTS=OFF \
-   -DLIBCXX_LIBDIR_SUFFIX="" \
-   -DLIBCXX_STANDALONE_BUILD=ON \
-   -DLIBCXX_HAS_MUSL_LIBC=$(if $(CONFIG_USE_MUSL),ON,OFF)
-
-TARGET_CXXFLAGS += -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -Wno-attributes -flto
-TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
-
-define Build/InstallDev
-   $(call Build/InstallDev/cmake,$(1))
-   $(CP) files/g++-libcxx  $(TOOLCHAIN_DIR)/bin/
-   $(SED) 's,CXX,$(TARGET_CXX),g' $(TOOLCHAIN_DIR)/bin/g++-libcxx
-endef
-
-define Package/libcxx/install
-   $(INSTALL_DIR)  $(1)/usr/lib
-   $(CP) $(PKG_INSTALL_DIR)/usr/lib/libc++.so.*$(1)/usr/lib/
-endef
-
-$(eval $(call BuildPackage,libcxx))
diff --git a/package/libs/libcxx/files/g++-libcxx 
b/package/libs/libcxx/files/g++-libcxx
deleted file mode 100755
index 88b3e7da01..00
--- a/package/libs/libcxx/files/g++-libcxx
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-WRAPPER_INCLUDEDIR="-I$STAGING_DIR/usr/include/c++/v1"
-WRAPPER_LIBDIR="-L$STAGING_DIR/usr/lib"
-WRAPPER_LIBS="-lc -lgcc_s -lssp_nonshared"
-
-WRAPPER_OPTIONS=""
-WRAPPER_INCLIB="Y"
-for arg
-do
-   case "$arg" in
-   -c|-E|-S) WRAPPER_INCLIB="N" ;;
-   -static) [ "$WRAPPER_LIBS" != "-lc -lgcc_s -lssp_nonshared -lgcc_eh" ] 
&& WRAPPER_LIBS="-lc -lgcc_s -lssp_nonshared -lgcc_eh" ;;
-   esac
-done
-[ "$WRAPPER_INCLIB" = "Y" ] && WRAPPER_OPTIONS="-nodefaultlibs $WRAPPER_LIBDIR 
-lc++ -lc++abi $WRAPPER_LIBS"
-
-exec CXX -nostdinc++ -DGCC_HASCLASSVISIBILITY "$WRAPPER_INCLUDEDIR" "$@" 
$WRAPPER_OPTIONS
-
diff --git a/package/libs/libcxx/patches/010-ssp.patch 
b/package/libs/libcxx/patches/010-ssp.patch
deleted file mode 100644
index f83c7b9b56..00
--- a/package/libs/libcxx/patches/010-ssp.patch
+++ /dev/null
@@ -1,13 +0,0 @@
 a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -760,6 +760,10 @@ function(cxx_link_system_libraries targe
- target_link_libraries(${target} PRIVATE atomic)
-   endif()
- 
-+  if (LIBCXX_HAS_MUSL_LIBC)
-+target_link_libraries(${target} PRIVATE ssp_nonshared)
-+  endif()
-+
-   if (MINGW)
- target_link_libraries(${target} PRIVATE "${MINGW_LIBRARIES}")
-   endif()
diff --git a/package/libs/libcxxabi/Makefile b/package/libs/libcxxabi/Makefile
deleted file mode 100644
index 90547561b2..00
--- a/package/libs/libcxxabi/Makefile
+++ /dev/null
@@ -1,71 +0,0 @@
-
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.