Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systemd-network ignores ListenPort in [WIREGUARD] #12377

Closed
MorphBonehunter opened this issue Apr 24, 2019 · 7 comments · Fixed by #12382
Closed

systemd-network ignores ListenPort in [WIREGUARD] #12377

MorphBonehunter opened this issue Apr 24, 2019 · 7 comments · Fixed by #12382

Comments

@MorphBonehunter
Copy link

@MorphBonehunter MorphBonehunter commented Apr 24, 2019

systemd version the issue has been seen with

v242

Used distribution

ArchLinux

Expected behaviour you didn't see

systemd-networkd should honor the ListenPort= in the [WIREGUARD] section

Unexpected behaviour you saw

systemd-networkd ignores the ListenPort= in the [WIREGUARD] section

Steps to reproduce the problem
After upgrading from latest 241 to 242 the ListenPort= seems to be ignored or is set to "auto" in all cases.

  • Prepare an Test netdev File:
cat /etc/systemd/network/02-wg-uv.netdev
[NetDev]
Name = wg-uv
Kind = wireguard

[WireGuard]
PrivateKey = uKHTCAv8+nKh5fmRtE7j/QucwGGPJeZmiU5Vkry/2Fo=
ListenPort = 12345
  • generate an (ugly) systemd-networkd restart and remove WG interface loop:
for i in {1..5}; do ip l d wg-uv && systemctl restart systemd-networkd; sleep 2; wg | grep -E "interface|listening"; done
interface: wg-uv
  listening port: 40243
interface: wg-uv
  listening port: 41474
interface: wg-uv
  listening port: 43267
interface: wg-uv
  listening port: 55313
interface: wg-uv
  listening port: 48652
  • everytime i get an random listen port
@yuwata yuwata added the network label Apr 24, 2019
@yuwata

This comment has been minimized.

Copy link
Member

@yuwata yuwata commented Apr 24, 2019

I think this is a bug in wg command. Please try wg show wg-uv listen-port. I hope the correct port number will shown.
Or, have you confirmed that the correct port number is shown with v241 or earlier version of systemd?

@yuwata yuwata added the not-our-bug label Apr 24, 2019
@MorphBonehunter

This comment has been minimized.

Copy link
Author

@MorphBonehunter MorphBonehunter commented Apr 24, 2019

Hey @yuwata, as i wrote, the behavior ocurred after upgrade systemd on one of my systems today.
Others systems with 241 and the same wireguard Version work without Problem.
As my Produktion environment are based on fixed Ports, i can confirm that the right Port was used before the upgeade.

@yuwata

This comment has been minimized.

Copy link
Member

@yuwata yuwata commented Apr 24, 2019

So, wg show wg-uv listen-port also returns random port number?

@yuwata yuwata removed the not-our-bug label Apr 24, 2019
@yuwata

This comment has been minimized.

Copy link
Member

@yuwata yuwata commented Apr 24, 2019

Ouch. I confirm that...

yuwata added a commit to yuwata/systemd that referenced this issue Apr 24, 2019
@yuwata yuwata added the has-pr label Apr 24, 2019
@yuwata

This comment has been minimized.

Copy link
Member

@yuwata yuwata commented Apr 24, 2019

Fix is waiting in #12382.

yuwata added a commit to yuwata/systemd that referenced this issue Apr 25, 2019
@MorphBonehunter

This comment has been minimized.

Copy link
Author

@MorphBonehunter MorphBonehunter commented Apr 25, 2019

Thanks @yuwata and @keszybz for fast response and fix!
Could this also be backported to systemd-stable please so that distris which based on this repo could upgrade there packages?

@keszybz

This comment has been minimized.

Copy link
Member

@keszybz keszybz commented Apr 25, 2019

Yep, will do.

eworm-de pushed a commit to eworm-de/systemd that referenced this issue Apr 26, 2019
This fixes a bug introduced by f1368a3.

Fixes systemd#12377.

(cherry picked from commit a62b7bb)
sbraz added a commit to sbraz/gentoo that referenced this issue May 23, 2019
This fixes the fact that systemd-network had been ignoring ListenPort=
in [WireGuard] since v242.
See systemd/systemd#12377

Package-Manager: Portage-2.3.66, Repoman-2.3.12
Signed-off-by: Louis Sautier <sbraz@gentoo.org>
pvdabeel pushed a commit to pvdabeel/gentoo that referenced this issue May 23, 2019
This fixes the fact that systemd-network had been ignoring ListenPort=
in [WireGuard] since v242.
See systemd/systemd#12377

Closes: gentoo#12089
Package-Manager: Portage-2.3.66, Repoman-2.3.12
Signed-off-by: Louis Sautier <sbraz@gentoo.org>
edevolder added a commit to edevolder/systemd that referenced this issue Jun 26, 2019
Mic92 added a commit to NixOS/systemd that referenced this issue Jun 29, 2019
This fixes a bug introduced by f1368a3.

Fixes systemd#12377.

(cherry picked from commit a62b7bb)
(cherry picked from commit db466d8)
dsahern pushed a commit to dsahern/systemd that referenced this issue Nov 4, 2019
This fixes a bug introduced by f1368a3.

Fixes systemd#12377.

(cherry picked from commit a62b7bb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.