Re: [OpenWrt-Devel] [PATCH] ath79: add support for gl-e750

2020-05-27 Thread luochong...@gl-inet.com
Hi Koen,

I'm really sorry that I missed your previous email.

Tried sysupgrade --> results in platform_check failure.
In the original device naming convention, E750 was named glinet,gl-e750
However, in today's openwrt, the name of the device is glinet_gl-e750, so 
platform_check failure is prompted.
You'd better use uboot to upgrade your firmware, follow the link below for the 
uboot upgrade steps
https://docs.gl-inet.com/en/3/troubleshooting/debrick/

this device also only has 1 ethernet port exposed on the board.
Yes, the E750 has only one ethernet port,
In E750, we only use GMAC0, but in ATH79 target, I had to initialize P4 via 
GMAC1 connected to the Ethernet switch, so you'll see eth0 and eth1 on your 
system.
I have tried to use GMAC0 to initialize P4 directly, but after initializing P4 
in this way, the speed of P4 can only be 100M, not 100M/10M.



Best Regards
 
Chongjun Luo | Software Engineer
chongjun@gl-inet.com 
GL.iNet  WiFi for Things
Website: www.gl-inet.com   |   LinkedIn: gl-inet.com   |   Tel: 
+86-755-8660-6126
Room 305-306, Skyworth Digital Building , Shiyan Street, Baoan District, 
Shenzhen, China
Email Disclaimer: The content of this email is confidential and intended for 
the recipient specified in message only. It is strictly forbidden to share any 
part of this message with any third party, without a written consent of the 
sender. If you received this message by mistake, please reply to this message 
and follow with its deletion, so that we can ensure such a mistake does not 
occur in the future.
 
From: Koen Vandeputte
Date: 2020-05-27 22:01
To: Luochongjun; openwrt-devel
CC: Gianni Stubbe
Subject: Re: [OpenWrt-Devel] [PATCH] ath79: add support for gl-e750
 
On 27.05.20 15:33, Koen Vandeputte wrote:
>
> On 07.05.20 13:46, Luochongjun wrote:
>> The gl-e750 is a portable travel router that gives you safe access to
>> the internet while traveling.
>>
>> Specifications:
>> - SoC: Qualcomm Atheros AR9531 (650MHz)
>> - RAM: 128 MB DDR2
>> - Flash: 16 MB SPI NOR (W25Q128FVSG) + 128 MB SPI NAND (GD5F1GQ4UFYIG)
>> - Ethernet: 10/100: 1xLAN
>> - Wireless: QCA9531 2.4GHz (bgn) + QCA9887 5GHz (ac)
>> - USB: 1x USB 2.0 port
>> - Switch: 1x switch
>> - Button: 1x reset button
>> - OLED Screen: 128*64 px
>>
>> Flash instruction:
>> Support for sysupgrade directive upgrades, as well as luci upgrades.
>
> Hi,
>
> I retested this patch just to be sure I didn't miss anything before.
>
>
> Did you test this patch on actual hardware before sending this?
>
> I've got 2x e750-Mudi devices which:
>
> - I first flashed to the latest Gl.inet firmware (18.06 based) (works 
> fine)
>
> - Tried sysupgrade --> results in platform_check failure
>
> - Tried forced sysupgrade --> does not boot afterwards
>
> - Tried uboot recovery (both sysupgrade and factory images) --> does 
> not boot
>
>
> Using gl.inet official img, the uboot recovery mode works fine.
>
> Thanks,
>
> Koen
>
>
I just soldered UART to the board.
 
Ethernet is not coming up properly.
 
relevant prints:
 
 
[0.551090] libphy: Fixed MDIO Bus: probed
[0.872975] ag71xx 1900.eth: Could not connect to PHY device. 
Deferring probe.
[0.881098] ag71xx 1a00.eth: invalid MAC address, using random 
address
[1.139873] random: fast init done
[1.520295] libphy: ag71xx_mdio: probed
[1.525811] libphy: ar8xxx-mdio: probed
[1.538905] switch0: Atheros AR8229 rev. 1 switch registered on mdio.0
[1.587451] ag71xx 1a00.eth: connected to PHY at fixed-0:00 
[uid=, driver=Generic PHY]
[1.597499] eth0: Atheros AG71xx at 0xba00, irq 5, mode: gmii
[1.605610] NET: Registered protocol family 10
[1.614929] Segment Routing with IPv6
[1.618900] NET: Registered protocol family 17
[1.623601] 8021q: 802.1Q VLAN Support v1.8
[1.631247] PCI host bridge /ahb/pcie-controller@180c ranges:
[1.637642]  MEM 0x1000..0x13ff
[1.643057]   IO 0x..0x
[1.648655] PCI host bridge to bus :00
[1.652937] pci_bus :00: root bus resource [mem 
0x1000-0x13ff]
[1.660051] pci_bus :00: root bus resource [io  0x]
[1.665824] pci_bus :00: root bus resource [??? 0x flags 0x0]
[1.672845] pci_bus :00: No busn resource found for root bus, 
will use [bus 00-ff]
[1.682374] pci :00:00.0: BAR 0: assigned [mem 
0x1000-0x101f 64bit]
[1.690010] pci :00:00.0: BAR 6: assigned [mem 
0x1020-0x1020 pref]
[2.013961] ag71xx 1900.eth: connected to PHY at mdio.0:1f:04 
[uid=004dd042, driver=Generic PHY]
[2.024473] eth1: Atheros AG71xx at 0xb900, irq 4, mode: mii
 
[   10.293731] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   11.325088] eth0: link up (1000Mbps/Full duplex)
 
[   11.329934] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
 
[   17.716093] eth0: link down
 
 
this device also only has 1 ethernet port exposed on the board.
 
Regards,
 
Koen
 
 

Re: [OpenWrt-Devel] [PATCH v2] package/base-files: caldata: work around dd's limitation

2020-05-27 Thread Thibaut
Ping?
What’s the stance on this patch?

Should I rebase before resubmitting following package version bump or is this 
NACKd as is?

This patch (or a solution fixing this issue) is necessary to support mikrotik 
ipq40xx devices, see for instance PR #3037

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


[OpenWrt-Devel] [PATCH v2 1/1] firewall3: harden string functions that might overflow

2020-05-27 Thread Philip Prindeville
From: Philip Prindeville 

Make sure no buffer overruns present a vulnerability in the firewall.

Get rid of unsafe string functions: strcpy, strncpy, strcat, strncat,
sprintf, etc.  Doing pointer arithemetic with the return value of
sprintf() is inherently unsound.  Per the sprintf() man page:

The functions snprintf() and vsnprintf() do not write  more  than  size
bytes  (including the terminating null byte ('\0')).  If the output was
truncated due to this limit, then the return value  is  the  number  of
characters  (excluding the terminating null byte) which would have been
written to the final string if enough space had been available.   Thus,
a  return  value  of  size or more means that the output was truncated.

Thus the construct:

   p += sprintf(p, ...);

is unsafe as the return value could put you well beyond the end of
whatever buffer p points to.

Signed-off-by: Philip Prindeville 
---
 defaults.c   |  2 +-
 iptables.c   | 65 ++--
 options.c| 24 +++
 redirects.c  | 16 -
 rules.c  |  4 ++--
 snats.c  | 16 -
 utils.c  | 17 +++---
 utils.h  |  6 +
 xtables-10.h |  8 +++
 xtables-5.h  |  4 ++--
 10 files changed, 95 insertions(+), 67 deletions(-)

diff --git a/defaults.c b/defaults.c
index 
60a4c81f773bf9527407ac61b0731e940f9c5463..bd69e6b2f765058755daabb3dde8f89f19238622
 100644
--- a/defaults.c
+++ b/defaults.c
@@ -236,7 +236,7 @@ fw3_print_default_head_rules(struct fw3_ipt_handle *handle,
{
case FW3_TABLE_FILTER:
 
-   sprintf(lodev.name, "lo");
+   strlcpy(lodev.name, "lo", sizeof(lodev.name));
 
r = fw3_ipt_rule_create(handle, NULL, , NULL, NULL, NULL);
fw3_ipt_rule_target(r, "ACCEPT");
diff --git a/iptables.c b/iptables.c
index 
559fe7defef3be85c4eb2934884caf549f932bc5..dcf8e23fbd9845e6be4a8bc072f70d9238ebab51
 100644
--- a/iptables.c
+++ b/iptables.c
@@ -144,7 +144,7 @@ get_kernel_version(void)
int x = 0, y = 0, z = 0;
 
if (uname() == -1)
-   sprintf(uts.release, "3.0.0");
+   strlcpy(uts.release, "3.0.0", sizeof(uts.release));
 
sscanf(uts.release, "%d.%d.%d", , , );
kernel_version = 0x1 * x + 0x100 * y + z;
@@ -906,7 +906,7 @@ fw3_ipt_rule_sport_dport(struct fw3_ipt_rule *r,
if (sp && sp->set)
{
if (sp->port_min == sp->port_max)
-   sprintf(buf, "%u", sp->port_min);
+   snprintf(buf, sizeof(buf), "%u", sp->port_min);
else
snprintf(buf, sizeof(buf), "%u:%u", sp->port_min, 
sp->port_max);
 
@@ -916,7 +916,7 @@ fw3_ipt_rule_sport_dport(struct fw3_ipt_rule *r,
if (dp && dp->set)
{
if (dp->port_min == dp->port_max)
-   sprintf(buf, "%u", dp->port_min);
+   snprintf(buf, sizeof(buf), "%u", dp->port_min);
else
snprintf(buf, sizeof(buf), "%u:%u", dp->port_min, 
dp->port_max);
 
@@ -929,7 +929,8 @@ fw3_ipt_rule_device(struct fw3_ipt_rule *r, const char 
*device, bool out)
 {
if (device) {
struct fw3_device dev = { .any = false };
-   strncpy(dev.name, device, sizeof(dev.name) - 1);
+
+   strlcpy(dev.name, device, sizeof(dev.name));
fw3_ipt_rule_in_out(r, (out) ? NULL : , (out) ?  : 
NULL);
}
 }
@@ -943,7 +944,7 @@ fw3_ipt_rule_mac(struct fw3_ipt_rule *r, struct fw3_mac 
*mac)
if (!mac)
return;
 
-   sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x",
+   snprintf(buf, sizeof(buf), "%02x:%02x:%02x:%02x:%02x:%02x",
addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
 
fw3_ipt_rule_addarg(r, false, "-m", "mac");
@@ -962,7 +963,7 @@ fw3_ipt_rule_icmptype(struct fw3_ipt_rule *r, struct 
fw3_icmptype *icmp)
if (r->h->family == FW3_FAMILY_V6)
{
if (icmp->code6_min == 0 && icmp->code6_max == 0xFF)
-   sprintf(buf, "%u", icmp->type6);
+   snprintf(buf, sizeof(buf), "%u", icmp->type6);
else
snprintf(buf, sizeof(buf), "%u/%u", icmp->type6, 
icmp->code6_min);
 
@@ -972,7 +973,7 @@ fw3_ipt_rule_icmptype(struct fw3_ipt_rule *r, struct 
fw3_icmptype *icmp)
 #endif
{
if (icmp->code_min == 0 && icmp->code_max == 0xFF)
-   sprintf(buf, "%u", icmp->type);
+   snprintf(buf, sizeof(buf), "%u", icmp->type);
else
snprintf(buf, sizeof(buf), "%u/%u", icmp->type, 
icmp->code_min);
 
@@ -990,12 +991,12 @@ fw3_ipt_rule_limit(struct fw3_ipt_rule *r, struct 
fw3_limit *limit)
 
fw3_ipt_rule_addarg(r, false, "-m", "limit");
 
-   sprintf(buf, "%u/%s", limit->rate, 

Re: [OpenWrt-Devel] Issue connecting with Quectel EM20-G modem on openwrt

2020-05-27 Thread Alex Ballmer
I am also running on the appropriate master branches of libqmi and 
modemmanager, so I am not sure what I am doing wrong. My guess is I 
backported support for the EM20-G to the qmi_wwan driver wrong.


I couldn't find a commit in linux master that explicitly supported the 
EM20-G, so I copied the changes in the commits for RM500Q support, which 
I hear has the same controller as the EM20-G.


Is there a better way to add support for this modem on an older (4.14) 
kernel?


On 2020-05-25 00:55, Nick via openwrt-devel wrote:

FWIW, I’m able to use this modem just fine on a USB3.0 M.2 slot with the 
current version of MM and libqmi.  Let me know if you need any details.


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


Re: [OpenWrt-Devel] [PATCH] ath79: add support for gl-e750

2020-05-27 Thread Koen Vandeputte


On 27.05.20 15:33, Koen Vandeputte wrote:


On 07.05.20 13:46, Luochongjun wrote:

The gl-e750 is a portable travel router that gives you safe access to
the internet while traveling.

Specifications:
- SoC: Qualcomm Atheros AR9531 (650MHz)
- RAM: 128 MB DDR2
- Flash: 16 MB SPI NOR (W25Q128FVSG) + 128 MB SPI NAND (GD5F1GQ4UFYIG)
- Ethernet: 10/100: 1xLAN
- Wireless: QCA9531 2.4GHz (bgn) + QCA9887 5GHz (ac)
- USB: 1x USB 2.0 port
- Switch: 1x switch
- Button: 1x reset button
- OLED Screen: 128*64 px

Flash instruction:
Support for sysupgrade directive upgrades, as well as luci upgrades.


Hi,

I retested this patch just to be sure I didn't miss anything before.


Did you test this patch on actual hardware before sending this?

I've got 2x e750-Mudi devices which:

- I first flashed to the latest Gl.inet firmware (18.06 based) (works 
fine)


- Tried sysupgrade --> results in platform_check failure

- Tried forced sysupgrade --> does not boot afterwards

- Tried uboot recovery (both sysupgrade and factory images) --> does 
not boot



Using gl.inet official img, the uboot recovery mode works fine.

Thanks,

Koen



I just soldered UART to the board.

Ethernet is not coming up properly.

relevant prints:


[    0.551090] libphy: Fixed MDIO Bus: probed
[    0.872975] ag71xx 1900.eth: Could not connect to PHY device. 
Deferring probe.
[    0.881098] ag71xx 1a00.eth: invalid MAC address, using random 
address

[    1.139873] random: fast init done
[    1.520295] libphy: ag71xx_mdio: probed
[    1.525811] libphy: ar8xxx-mdio: probed
[    1.538905] switch0: Atheros AR8229 rev. 1 switch registered on mdio.0
[    1.587451] ag71xx 1a00.eth: connected to PHY at fixed-0:00 
[uid=, driver=Generic PHY]

[    1.597499] eth0: Atheros AG71xx at 0xba00, irq 5, mode: gmii
[    1.605610] NET: Registered protocol family 10
[    1.614929] Segment Routing with IPv6
[    1.618900] NET: Registered protocol family 17
[    1.623601] 8021q: 802.1Q VLAN Support v1.8
[    1.631247] PCI host bridge /ahb/pcie-controller@180c ranges:
[    1.637642]  MEM 0x1000..0x13ff
[    1.643057]   IO 0x..0x
[    1.648655] PCI host bridge to bus :00
[    1.652937] pci_bus :00: root bus resource [mem 
0x1000-0x13ff]

[    1.660051] pci_bus :00: root bus resource [io  0x]
[    1.665824] pci_bus :00: root bus resource [??? 0x flags 0x0]
[    1.672845] pci_bus :00: No busn resource found for root bus, 
will use [bus 00-ff]
[    1.682374] pci :00:00.0: BAR 0: assigned [mem 
0x1000-0x101f 64bit]
[    1.690010] pci :00:00.0: BAR 6: assigned [mem 
0x1020-0x1020 pref]
[    2.013961] ag71xx 1900.eth: connected to PHY at mdio.0:1f:04 
[uid=004dd042, driver=Generic PHY]

[    2.024473] eth1: Atheros AG71xx at 0xb900, irq 4, mode: mii

[   10.293731] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   11.325088] eth0: link up (1000Mbps/Full duplex)

[   11.329934] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

[   17.716093] eth0: link down


this device also only has 1 ethernet port exposed on the board.

Regards,

Koen


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


Re: [OpenWrt-Devel] [PATCH] ath79: add support for gl-e750

2020-05-27 Thread Koen Vandeputte



On 07.05.20 13:46, Luochongjun wrote:

The gl-e750 is a portable travel router that gives you safe access to
the internet while traveling.

Specifications:
- SoC: Qualcomm Atheros AR9531 (650MHz)
- RAM: 128 MB DDR2
- Flash: 16 MB SPI NOR (W25Q128FVSG) + 128 MB SPI NAND (GD5F1GQ4UFYIG)
- Ethernet: 10/100: 1xLAN
- Wireless: QCA9531 2.4GHz (bgn) + QCA9887 5GHz (ac)
- USB: 1x USB 2.0 port
- Switch: 1x switch
- Button: 1x reset button
- OLED Screen: 128*64 px

Flash instruction:
Support for sysupgrade directive upgrades, as well as luci upgrades.


Hi,

I retested this patch just to be sure I didn't miss anything before.


Did you test this patch on actual hardware before sending this?

I've got 2x e750-Mudi devices which:

- I first flashed to the latest Gl.inet firmware (18.06 based) (works fine)

- Tried sysupgrade --> results in platform_check failure

- Tried forced sysupgrade --> does not boot afterwards

- Tried uboot recovery (both sysupgrade and factory images) --> does not 
boot



Using gl.inet official img, the uboot recovery mode works fine.

Thanks,

Koen



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