Page MenuHomeVyOS Platform

show interfaces wireguard wg0 - doesn't work
Closed, WontfixPublicBUG

Description

show interfaces wireguard wg0

Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/wireguard.py", line 154, in <module>
    intf.op_show_interface()
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/wireguard.py", line 101, in op_show_interface
    wgdump = vyos.interfaces.wireguard_dump().get(
NameError: name 'vyos' is not defined

Details

Difficulty level
Unknown (require assessment)
Version
1.3-rolling-202003151839
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

hagbard changed the task status from Open to Needs testing.Mar 16 2020, 3:34 PM

https://github.com/vyos/vyos-1x/commit/5cb0059353e94dc11aa116e4aa8ce0422c4f3534 should fix the issue. The op-mode commands may need to be refactored in general and split into it's own structures.

@alien Can you please test the issue with the latest rolling release?

@hagbard
Another bug:

 show interfaces wireguard wg0
interface: wg0
  address: XX
  public key: XXX
  private key: (hidden)
  listening port: 51280

  peer: alien
    public key: XXX
    allowed ips: Xx

  peer: anna
    public key: X
Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/wireguard.py", line 154, in <module>
    intf.op_show_interface()
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/wireguard.py", line 137, in op_show_interface
    delta = timedelta(seconds=int(
NameError: name 'timedelta' is not defined
hagbard changed the task status from Needs testing to In progress.Mar 21 2020, 4:09 PM
hagbard moved this task from Need Triage to In Progress on the VyOS 1.3 Equuleus board.

@alien Can you please share your config, I can't reproduce it. The op function will be moved into the the ops script out of the ifconfig class, which caused the issue due to restructuring out internal class architecture.

 sh int wiregu wg0
interface: wg0
  address: 10.0.0.1/32
  public key: bHSC4OLXJD3OyoKhgdPPlGmx0YxrBKEGZ3MBrWdXATw=
  private key: (hidden)
  listening port: 12345

  peer: vyos-latest
    public key: 9wKaDx4rJYRZ6CuJS8Eh4BMXD9Mes5O/bKbtW6STfTg=
    latest handshake: 0:00:44
    status: active
    endpoint: 10.100.100.1:60222
    allowed ips: 10.0.0.0/24
    transfer: 4 KB received, 7 KB sent

  RX: 
    bytes    packets    errors    dropped    overrun    mcast
     4372         34         0          0          0        0
  
  TX: 
    bytes    packets    errors    dropped    carrier    collisions
     7604         57         0         11          0             0

Same issue for me (1.3-rolling-202003221506). I needed to add this to the script "/usr/lib/python3/dist-packages/vyos/ifconfig/wireguard.py":

from datetime import timedelta
import time

When that is added, I then get complaints about a size()-function that isn't defined:

vyos@vyos1:~$ sh int wireg wg0
Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/wireguard.py", line 154, in <module>
interface: wg0
  address: bbbbbbbbbbbbbbbb
  public key: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  private key: (hidden)
  listening port: 5643

  peer: kjartan
    public key: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    allowed ips: bbbbbbbbbbbbbbbbbb
    persistent keepalive: every 20 seconds

  peer: trond
    public key: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    latest handshake: 0:01:24
    status: active
    endpoint: bbbbbbbbbbbbbbbbbbbbbbb
    allowed ips: bbbbbbbbbbbbbbbbbbbbbb
    intf.op_show_interface()
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/wireguard.py", line 161, in op_show_interface
    rx_size = size(
NameError: name 'size' is not defined

1.3-rolling-202003230217

Another bug:

Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/wireguard.py", line 154, in <module>
    intf.op_show_interface()
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/wireguard.py", line 134, in op_show_interface
    delta = timedelta(seconds=int(
NameError: name 'timedelta' is not defined

The code should be in the op-mode script rather than the class.But the PR was merged in, so I suppose it's ok.

erkin set Issue type to Bug (incorrect behavior).Aug 31 2021, 5:19 PM