Page MenuHomeVyOS Platform

Commit crash when adding the second mGRE tunnel with the same key
Closed, ResolvedPublicBUG

Description

We need to prevent using the same key for mGRE tunnels, otherwise, we get error

set interfaces tunnel tun1 encapsulation gre
set interfaces tunnel tun1 local-ip '0.0.0.0'
set interfaces tunnel tun1 address 10.10.10.1/30
set interfaces tunnel tun1 parameters ip key '1'
set interfaces tunnel tun1 multicast 'enable'

set interfaces tunnel tun2 encapsulation gre
set interfaces tunnel tun2 local-ip '0.0.0.0'
set interfaces tunnel tun2 address 10.255.10.1/30
set interfaces tunnel tun2 parameters ip key '1'
set interfaces tunnel tun2 multicast 'enable'

On commit

vyos@R2# commit
[ interfaces tunnel tun2 ]
VyOS had an issue completing a command.

We are sorry that you encountered a problem while using VyOS.
There are a few things you can do to help us (and yourself):
- Make sure you are running the latest version of the code available at
  https://downloads.vyos.io/rolling/current/amd64/vyos-rolling-latest.iso
- Consult the forum to see how to handle this issue
  https://forum.vyos.io
- Join our community on slack where our users exchange help and advice
  https://vyos.slack.com

When reporting problems, please include as much information as possible:
- do not obfuscate any data (feel free to contact us privately if your 
  business policy requires it)
- and include all the information presented below

Report Time:      2020-09-24 12:46:35
Image Version:    VyOS 1.3-rolling-202009210118
Release Train:    equuleus

Built by:         [email protected]
Built on:         Mon 21 Sep 2020 01:18 UTC
Build UUID:       80edfc66-86d4-46ad-b93a-dbebe39040a8
Build Commit ID:  d571b383797719

Architecture:     x86_64
Boot via:         installed image
System type:      KVM guest

Hardware vendor:  QEMU
Hardware model:   Standard PC (i440FX + PIIX, 1996)
Hardware S/N:     
Hardware UUID:    32e90bec-c310-4ae1-b9b4-2791db77df95

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/interfaces-tunnel.py", line 719, in <module>
    apply(c)
  File "/usr/libexec/vyos/conf_mode/interfaces-tunnel.py", line 669, in apply
    tunnel = kls(ifname, **config)
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/tunnel.py", line 93, in __init__
    super().__init__(ifname, **config)
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 235, in __init__
    self._create()
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/tunnel.py", line 99, in _create
    self._cmd('{} {}'.format(self.create.format(**self.config), options))
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/control.py", line 51, in _cmd
    return cmd(command, self.debug)
  File "/usr/lib/python3/dist-packages/vyos/util.py", line 179, in cmd
    raise OSError(code, feedback)
PermissionError: [Errno 1] failed to run command: ip tunnel add tun2 mode gre local 0.0.0.0 ttl 255 tos inherit key 1
returned: 
exit code: 1

noteworthy:
cmd 'ip tunnel add tun2 mode gre local 0.0.0.0 ttl 255 tos inherit key 1'
returned (out):

returned (err):
add tunnel "gre0" failed: File exists

[[interfaces tunnel tun2]] failed
Commit failed
[edit]

Details

Difficulty level
Unknown (require assessment)
Version
1.3-rolling-202009210118
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

Unknown Object (User) created this task.Sep 24 2020, 12:47 PM
Unknown Object (User) updated the task description. (Show Details)Sep 24 2020, 2:43 PM
erkin set Issue type to Bug (incorrect behavior).Aug 29 2021, 12:55 PM
erkin removed a subscriber: Active contributors.

PR https://github.com/vyos/vyos-1x/pull/986

set interfaces tunnel tun1 encapsulation gre
set interfaces tunnel tun1 source-address '0.0.0.0'
set interfaces tunnel tun1 address 10.10.10.1/30
set interfaces tunnel tun1 parameters ip key '1'
set interfaces tunnel tun1 multicast 'enable'

set interfaces tunnel tun2 encapsulation gre
set interfaces tunnel tun2 source-address '0.0.0.0'
set interfaces tunnel tun2 address 10.255.10.1/30
set interfaces tunnel tun2 parameters ip key '1'
set interfaces tunnel tun2 multicast 'enable'

commit:

vyos@r1-roll# commit
[ interfaces tunnel tun2 ]
Key "1" for source-address "0.0.0.0" is already used for tunnel "tun1"!

[[interfaces tunnel tun2]] failed
Commit failed
[edit]
vyos@r1-roll#
Viacheslav moved this task from Backport Candidates to Finished on the VyOS 1.4 Sagitta board.
Viacheslav moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus (1.3.0-epa1) board.