Unable to perform speedtest on pppoe interface

Hello,
if the red interface it’s configured as pppoe we can’t run a speed test from the UI with the following message:

**Warning.** Speedtest failed: please check Internet connection.

Testing from ssh with speedtest-cli binding on the public ip address of the pppoe interface, works without issue:

[root@rt01 ~]# ip a |grep ppp
20: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc pfifo_fast state UNKNOWN group default qlen 3
    link/ppp 
    inet 93.xxx.xxx.x1 peer 79.98.41.5/32 scope global ppp0

[root@rt01 ~]# speedtest-cli --source 93.xxx.xxx.x1
Retrieving speedtest.net configuration...
Testing from Ehinet Srl (93.xxx.xxx.x1)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Telecom Italia S.p.A. (Perugia) [23.00 km]: 23.448 ms
Testing download speed................................................................................
Download: 159.67 Mbit/s
Testing upload speed....................................................................................................
Upload: 18.10 Mbit/s

Thanks

Thank you for reporting, but I do not have a PPPoE connection to test :frowning:

Could you try with the following procedure to gather more info?

  1. Open the browser console with F12
  2. You should find the command launched from the UI, something like:
    API exec: nethserver-firewall-base/wan/read
    $  echo '{"action":"speedtest","interface":"ens34"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/wan/read | jq
    
  3. Just copy&paste the command into the terminal and paste here the output

Sure, here it is:

nethserver.js:41 API exec: nethserver-firewall-base/settings/read$  echo '{"action":"status"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/settings/read | jq
nethserver.js:41 API exec: nethserver-firewall-base/wan/read$  echo '{"action":"speedtest","interface":"ppp0"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/wan/read | jq
app.66277a15.js:1 B {problem: null, exit_status: 1, exit_signal: null, message: "/usr/bin/sudo exited with code 1", toString: ƒ}
(anonymous) @ app.66277a15.js:1
(anonymous) @ nethserver.js:119
s @ cockpit.min.js:963
(anonymous) @ cockpit.min.js:975
n @ cockpit.min.js:881
setTimeout (async)
L @ cockpit.min.js:886
f @ cockpit.min.js:974
u @ cockpit.min.js:1004
e @ cockpit.min.js:1030
(anonymous) @ cockpit.min.js:2071
se @ cockpit.min.js:77
e @ cockpit.min.js:206
p @ cockpit.min.js:591
m @ cockpit.min.js:600
v @ cockpit.min.js:494
a.onmessage.o.dispatch_data @ cockpit.min.js:424

The problem is that we don’t have the ip of pppoe interface. In fact, we call this command:

speedtest-cli --json --source $ip 2>/dev/null;

$ip is null if the interface is pppoe

@giacomo I think we can change line 92 of /usr/libexec/nethserver/api/nethserver-firewall-base/wan/read from:

my $ip = $addr->{'ipaddr'} || '';

to:

my $ip = $addr->{'ipaddr'} || curl --interface $i ifconfig.me 2>/dev/null;
(missing apex due to text formatting)

What do you think?

I think you’ve found the problem, but I do not like to call an external service to find the IP address which should be already available locally.

@francio87 could you please post the output of this command?

ip -o -4 address show ppp0 primary
2 Likes

Sure

[root@rt01 ~]# ip -o -4 address show ppp0 primary
192: ppp0    inet 93.xxx.1xx.x8 peer 79.98.xx.5/32 scope global ppp0\       valid_lft forever preferred_lft forever

If the pppoe is down ( cable disconnected ) the output is empty.

[root@rt01 ~]# ip -o -4 address show ppp0 primary 
[root@rt01 ~]#

Maybe if u just want the ip address you can use:

[root@rt01 ~]# ip -o -4 address show ppp0 primary |awk '{print $4}'
93.xxx.xxx.x8
2 Likes

That’s exactly the command we are using: https://github.com/NethServer/nethserver-firewall-base/blob/master/api/lib/firewall_functions.pl#L51

I do not know why is not working, maybe the interface ppp0 was not ready yet?

We could eventually perform the test without specifying the interface if the IP address is not found.
Of course, the command will give useful information only if there are no other red interfaces.

What do you think?

uhm i’m sure 100% the interface was ready :thinking:

so a test from eth0 :

[root@rt01 ~]# echo '{"action":"speedtest","interface":"eth0"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/wan/read | jq
{
  "download": 177476966.2649079,
  "timestamp": "2020-02-04T17:12:19.380478",
  "ping": 22.88,
  ..... .....
  }
}

And one from ppp0 :

[root@rt01 ~]# echo '{"action":"speedtest","interface":"ppp0"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/wan/read | jq
{
  "type": "GenericError",
  "id": 1580836245,
  "message": "generic_error"
}

also a full log of the chrome console:

App.vue:312 Console was cleared
App.vue:313 ███╗   ██╗███████╗████████╗██╗  ██╗███████╗███████╗██████╗ ██╗   ██╗███████╗██████╗ ████╗  ██║██╔════╝╚══██╔══╝██║  ██║██╔════╝██╔════╝██╔══██╗██║   ██║██╔════╝██╔══██╗██╔██╗ ██║█████╗     ██║   ███████║███████╗█████╗  ██████╔╝██║   ██║█████╗  ██████╔╝██║╚██╗██║██╔══╝     ██║   ██╔══██║╚════██║██╔══╝  ██╔══██╗╚██╗ ██╔╝██╔══╝  ██╔══██╗██║ ╚████║███████╗   ██║   ██║  ██║███████║███████╗██║  ██║ ╚████╔╝ ███████╗██║  ██║╚═╝  ╚═══╝╚══════╝   ╚═╝   ╚═╝  ╚═╝╚══════╝╚══════╝╚═╝  ╚═╝  ╚═══╝  ╚══════╝╚═╝  ╚═╝
nethserver.js:41 API exec: system-authorization/read$ /usr/libexec/nethserver/api/system-authorization/read | jq
nethserver.js:41 API exec: system-task/read$ /usr/bin/setsid /usr/bin/sudo /usr/libexec/nethserver/api/system-task/read | jq
nethserver.js:41 API exec: system-settings/read$  echo '{"action":"hints"}' | /usr/bin/sudo /usr/libexec/nethserver/api/system-settings/read | jq
App.vue:451 tasks undefined
App.vue:451 tasks no running tasks
nethserver.js:41 API exec: system-apps/read$  echo '{"action":"info","name":"nethserver-firewall-base"}' | /usr/libexec/nethserver/api/system-apps/read | jq
nethserver.js:41 API exec: system-network/read$  echo '{"action":"list"}' | /usr/bin/sudo /usr/libexec/nethserver/api/system-network/read | jq
nethserver.js:41 API exec: nethserver-firewall-base/dashboard/read$ /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/dashboard/read | jq
nethserver.js:41 API exec: nethserver-firewall-base/settings/read$  echo '{"action":"status"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/settings/read | jq
nethserver.js:41 API exec: nethserver-firewall-base/wan/read$  echo '{"action":"providers"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/wan/read | jq
nethserver.js:41 API exec: nethserver-firewall-base/wan/read$  echo '{"action":"rules","expand":true}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/wan/read | jq
nethserver.js:41 API exec: nethserver-firewall-base/objects/read$  echo '{"action":"hosts"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/objects/read | jq
nethserver.js:41 API exec: nethserver-firewall-base/objects/read$  echo '{"action":"host-groups"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/objects/read | jq
nethserver.js:41 API exec: nethserver-firewall-base/objects/read$  echo '{"action":"ip-ranges"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/objects/read | jq
nethserver.js:41 API exec: nethserver-firewall-base/objects/read$  echo '{"action":"cidr-subs"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/objects/read | jq
nethserver.js:41 API exec: nethserver-firewall-base/objects/read$  echo '{"action":"zones"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/objects/read | jq
nethserver.js:41 API exec: nethserver-firewall-base/objects/read$  echo '{"action":"time-conditions"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/objects/read | jq
nethserver.js:41 API exec: nethserver-firewall-base/objects/read$  echo '{"action":"services"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/objects/read | jq
nethserver.js:41 API exec: nethserver-firewall-base/rules/read$  echo '{"action":"roles"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/rules/read | jq
nethserver.js:41 API exec: nethserver-firewall-base/settings/read$  echo '{"action":"status"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/settings/read | jq
nethserver.js:41 API exec: nethserver-firewall-base/settings/read$  echo '{"action":"status"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/settings/read | jq
nethserver.js:41 API exec: nethserver-firewall-base/settings/read$  echo '{"action":"status"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/settings/read | jq
Dashboard.vue:554 Uncaught TypeError: Cannot read property 't' of null
    at Dashboard.vue:554
    at Function.<anonymous> (nethserver.js:108)
    at s (cockpit.min.js:963)
    at cockpit.min.js:975
    at n (cockpit.min.js:881)
(anonymous) @ Dashboard.vue:554
(anonymous) @ nethserver.js:108
s @ cockpit.min.js:963
(anonymous) @ cockpit.min.js:975
n @ cockpit.min.js:881
setTimeout (async)
L @ cockpit.min.js:886
f @ cockpit.min.js:974
l @ cockpit.min.js:998
e @ cockpit.min.js:1025
(anonymous) @ cockpit.min.js:2071
se @ cockpit.min.js:77
e @ cockpit.min.js:206
p @ cockpit.min.js:591
m @ cockpit.min.js:600
v @ cockpit.min.js:494
a.onmessage.o.dispatch_data @ cockpit.min.js:424
nethserver.js:41 API exec: nethserver-firewall-base/wan/read$  echo '{"action":"speedtest","interface":"ppp0"}' | /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-firewall-base/wan/read | jq
WAN.vue:2224 B {problem: null, exit_status: 1, exit_signal: null, message: "/usr/bin/sudo exited with code 1", toString: ƒ}
(anonymous) @ WAN.vue:2224
(anonymous) @ nethserver.js:119
s @ cockpit.min.js:963
(anonymous) @ cockpit.min.js:975
n @ cockpit.min.js:881
setTimeout (async)
L @ cockpit.min.js:886
f @ cockpit.min.js:974
u @ cockpit.min.js:1004
e @ cockpit.min.js:1030
(anonymous) @ cockpit.min.js:2071
se @ cockpit.min.js:77
e @ cockpit.min.js:206
p @ cockpit.min.js:591
m @ cockpit.min.js:600
v @ cockpit.min.js:494
a.onmessage.o.dispatch_data @ cockpit.min.js:424 

Well i think, it won’t be very usefull, like in my example if i have 2 wan 1 eth and 1 pppoe, you will have the value of the eth instead of the pppoe one :thinking:

btw, how the ui fetch the ip here since it’s the correct one…?

We can change line 92 of wan/read file as follow:

my $ip = $addr->{'ipaddr'} || $addr->{'cidr'};
I don’t know if we should add also || ‘’ at the end and it will become: my $ip = $addr->{'ipaddr'} || $addr->{'cidr'} || '';

With pppoe interfaces cidr is initialized and ipaddr not.

/cc: @giacomo

It uses the same function, maybe is something related to speed test cli itself?

That may be the point: ppp has different output in ip utility? So how the address is shown inside the UI?

I need access to a machine with PPPoE for more info.
Let’s see if @davide_marini can find one for me.

@giacomo i can spin up another NS instance, and give you access, just let me know :wink:

Thanks both to @francio87 and @federico.ballarini who gave me access to a test machine!

You were both right: the address of the ppp0 was in a different position inside the ip command output.
I’ve created a new issue: https://github.com/NethServer/dev/issues/6048

The fix should be already correct, I’m waiting for a review before merging the code. I will let you know as the issue is ready for QA.

2 Likes

Good job @giacomo and @francio87!

1 Like