Skip to content

WireGuard examples not working any longer #888

Closed
@lmm-git

Description

@lmm-git

Hi,

probably due to #882 the examples for WireGuard interfaces are no longer working.

If I try to:

from pyroute2 import IPDB, WireGuard

def main():
    IFNAME = 'wg1test'
    # Create a WireGuard interface
    with IPDB() as ip:
        wg1 = ip.create(kind='wireguard', ifname=IFNAME)
        wg1.add_ip('10.0.0.1/24')
        wg1.up()
        wg1.commit()
    # Create WireGuard object
    wg = WireGuard()
    # Add a WireGuard configuration + first peer
    peer = {'public_key': 'TGFHcm9zc2VCaWNoZV9DJ2VzdExhUGx1c0JlbGxlPDM=',
            'endpoint_addr': '8.8.8.8',
            'endpoint_port': 8888,
            'persistent_keepalive': 15,
            'allowed_ips': ['10.0.0.0/24', '8.8.8.8/32']}
    wg.set(IFNAME, private_key='RCdhcHJlc0JpY2hlLEplU2VyYWlzTGFQbHVzQm9ubmU=',
           fwmark=0x1337, listen_port=2525, peer=peer)

if __name__ == '__main__':
    main()

With version 0.6.8 wg outputs

interface: wg1test
  public key: FZ8nQlgAg7JIViZTAarlvMb9/e89jLdZ+mc3LBqAOmI=
  private key: (hidden)
  listening port: 2525
  fwmark: 0x1337

peer: TGFHcm9zc2VCaWNoZV9DJ2VzdExhUGx1c0JlbGxlPDM=
  allowed ips: 10.0.0.0/24, 8.8.8.8/32
  persistent keepalive: every 15 seconds

With version 0.6.7 it outputs correctly

interface: wg1test
  public key: FZ8nQlgAg7JIViZTAarlvMb9/e89jLdZ+mc3LBqAOmI=
  private key: (hidden)
  listening port: 2525
  fwmark: 0x1337

peer: TGFHcm9zc2VCaWNoZV9DJ2VzdExhUGx1c0JlbGxlPDM=
  endpoint: 8.8.8.8:8888
  allowed ips: 10.0.0.0/24, 8.8.8.8/32
  transfer: 0 B received, 148 B sent
  persistent keepalive: every 15 seconds

There is no error message or something. In another software, we get with version 0.6.8 the following messages:

unsupported event ignored: <class 'pr2modules.netlink.nlmsg'>

as well as

exception <(22, 'Invalid argument')> in source localhost

/cc @inemajo

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions