>Synopsis: wgaip address is ignored on ARM architecture
>Category: ifconfig
>Environment:
System      : OpenBSD 6.8
Details     : OpenBSD 6.8-current (GENERIC) #361: Fri Jan  1 00:06:44 MST
2021
dera...@armv7.openbsd.org:/usr/src/sys/arch/armv7/compile/GENERIC

Architecture: OpenBSD.armv7
Machine     : armv7
>Description:
wgaip address are ignored by ifconfig on ARM architecture and only the CIDR
is stored.
Upon handshake the missing address is replaced by the client's public IP
with CIDR still intact!
So for example if wgaip is set to 10.0.0.2/32 it will result in /32 and
then <public ip>/32 upon handshake.
This is not just a status display error by ifconfig, the actual network
configuration is broken since all the traffic sent by the client is dropped.
I tried to investigate further by looking at ifconfig.c and can confirm
that setwgpeeraip() seems to be working as expected so I assume the issue
is probably in the kernel.

Also I was not able to reproduce this issue on amd64 architecture.

>How-To-Repeat:
# Create wg0
ifconfig wg0 create wgkey "$(openssl rand -base64 32)" wgport 51820
ifconfig wg0 10.0.0.1/24

# Add a peer
ifconfig wg0 wgpeer <pubkey> wgaip 10.0.0.2/32

# Run ifconfig to confirm the peer settings were applied
ifconfig wg0
...
wgpeer <pubkey>
wgaip /32 <== IPv4 must be 10.0.0.2 but is missing!
...

# Configure the connection on the peer side and connect, then check the
connection status on server side again

ifconfig wg0
...
wgpeer <pubkey>
wgaip 1.2.3.4/32 <== IPv4 must be 10.0.0.2 but is set to client's public IP!
# Try to send traffic from the client side and monitor the traffic using
tcpdum, all packets are dropped.


dmesg:
OpenBSD 6.8-current (GENERIC) #361: Fri Jan  1 00:06:44 MST 2021
    dera...@armv7.openbsd.org:/usr/src/sys/arch/armv7/compile/GENERIC
real mem  = 2094546944 (1997MB)
avail mem = 2043539456 (1948MB)
random: good seed from bootblocks
mainbus0 at root: SolidRun Cubox-i Dual/Quad (1.5som)
cpu0 at mainbus0 mpidr 0: ARM Cortex-A9 r2p10
cpu0: 32KB 32b/line 4-way L1 VIPT I-cache, 32KB 32b/line 4-way L1 D-cache
cortex0 at mainbus0
amptimer0 at cortex0: tick rate 396000 KHz
armliicc0 at cortex0: rtl 7 waymask: 0x0000000f
imxtemp0 at mainbus0simplebus0 at mainbus0: "soc"
ampintc0 at simplebus0 nirq 160, ncpu 4: "interrupt-controller"
"dma-apbh" at simplebus0 not configured
"hdmi" at simplebus0 not configured
"gpu" at simplebus0 not configured
"gpu" at simplebus0 not configured
"timer" at simplebus0 not configured
"l2-cache" at simplebus0 not configured
simplebus1 at simplebus0: "bus"
imxccm0 at simplebus1
imxanatop0 at simplebus1
syscon0 at simplebus1: "snvs"
imxrtc0 at syscon0
"snvs-lpgpr" at syscon0 not configured
imxsrc0 at simplebus1
syscon1 at simplebus1: "iomuxc-gpr"
"mux-controller" at syscon1 not configured
"ipu1_csi0_mux" at syscon1 not configured
"ipu2_csi1_mux" at syscon1 not configured
imxiomuxc0 at simplebus1
simplebus2 at simplebus1: "spba-bus"
"spdif" at simplebus2 not configured
imxuart0 at simplebus2: console
"asrc" at simplebus2 not configured
"vpu" at simplebus1 not configured
"pwm" at simplebus1 not configured
"timer" at simplebus1 not configured
imxgpio0 at simplebus1
imxgpio1 at simplebus1
imxgpio2 at simplebus1
imxgpio3 at simplebus1
imxgpio4 at simplebus1
imxgpio5 at simplebus1
imxgpio6 at simplebus1
imxdog0 at simplebus1
"usbphy" at simplebus1 not configured
"usbphy" at simplebus1 not configured
imxgpc0 at simplebus1
"sdma" at simplebus1 not configured
simplebus3 at simplebus0: "bus"
syscon2 at simplebus3: "ocotp-ctrl"
"crypto" at simplebus3 not configured
imxehci0 at simplebus3
usb0 at imxehci0: USB revision 2.0
uhub0 at usb0 configuration 1 interface 0 "i.MX EHCI root hub" rev
2.00/1.00 addr 1
imxehci1 at simplebus3
usb1 at imxehci1: USB revision 2.0
uhub1 at usb1 configuration 1 interface 0 "i.MX EHCI root hub" rev
2.00/1.00 addr 1
"usbmisc" at simplebus3 not configured
fec0 at simplebus3
fec0: address 00:00:00:00:00:00
atphy0 at fec0 phy 4: AR8035 10/100/1000 PHY, rev. 2
imxesdhc0 at simplebus3
imxesdhc0: 198 MHz base clock
sdmmc0 at imxesdhc0: 4-bit, sd high-speed, mmc high-speed, dma
imxesdhc1 at simplebus3
imxesdhc1: 198 MHz base clock
sdmmc1 at imxesdhc1: 4-bit, sd high-speed, mmc high-speed, dma
imxiic0 at simplebus3
iic0 at imxiic0
imxiic1 at simplebus3
iic1 at imxiic1
pcfrtc0 at iic1 addr 0x68: battery ok
"memory-controller" at simplebus3 not configured
"vdoa" at simplebus3 not configured
imxuart1 at simplebus3
"ipu" at simplebus0 not configured
"sram" at simplebus0 not configured
imxahci0 at simplebus0: AHCI 1.3
imxahci0: port 0: 3.0Gb/s
scsibus0 at imxahci0: 32 targets
sd0 at scsibus0 targ 0 lun 0: <ATA, CT240BX500SSD1, M6C>
naa.0000000000000000
sd0: 228936MB, 512 bytes/sector, 468862128 sectors, thin
"gpu" at simplebus0 not configured
"ipu" at simplebus0 not configured
scsibus1 at sdmmc1: 2 targets, initiator 0
sd1 at scsibus1 targ 1 lun 0: <SD/MMC, 00000, 0010> removable
sd1: 29939MB, 512 bytes/sector, 61315072 sectors
bwfm0 at sdmmc0 function 1
bwfm0: SoC interconnect SB not implemented
bwfm0: cannot attach chip
manufacturer 0x02d0, product 0x4329 at sdmmc0 function 2 not configured
manufacturer 0x02d0, product 0x4329 at sdmmc0 function 3 not configured
uftdi0 at uhub1 port 1 configuration 1 interface 0 "FTDI FT230X Basic UART"
rev 2.00/10.00 addr 2
ucom0 at uftdi0 portno 1
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
bootfile: sd0a:/bsd
boot device: sd0
root on sd0a (94ae9aec9a91eaa7.a) swap on sd0b dump on sd0b

usbdevs:
Controller /dev/usb0:
addr 01: 0000:0000 i.MX, EHCI root hub
high speed, self powered, config 1, rev 1.00
driver: uhub0
Controller /dev/usb1:
addr 01: 0000:0000 i.MX, EHCI root hub
high speed, self powered, config 1, rev 1.00
driver: uhub1
addr 02: 0403:6015 FTDI, FT230X Basic UART
high speed, power 90 mA, config 1, rev 10.00, iSerial DN001U4C
driver: uftdi0
cp: /var/db/acpi/*: No such file or directory
b64encode: *: No such file or directory

pcidump:

acpidump:

Reply via email to