Hi Gert,

> On Sat, Sep 13, 2025 at 04:25:25PM +0200, Sebastian Marsching wrote:
>> This patch fixes this issue both when using iproute (by telling iproute
>> to set the broadcast address based on the local address and prefix) and
>> when using Netlink (by calculating the correct broadcast address and
>> setting it).
>
> Should Linux not be able to auto-calculate that, based on IP address
> and netmask?

You would think so, but it does not…

> No other OS needs explicit setting of broadcast address in 2025...
>
> Can you show the difference in "ip address show" or "ifconfig" output
> before/after your change?  Is this on a client or server?

Output of ifconfig without the change (IPv6 address anonymized by me):

tap0: flagsA63<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       inet 172.22.56.178  netmask 255.255.255.0  broadcast 0.0.0.0
       inet6 xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx  prefixlen 64  scopeid 
0x0<global>
       inet6 fe80::800b:93ff:fe07:a32a  prefixlen 64  scopeid 0x20<link>
       ether f6:f6:91:dc:83:af  txqueuelen 1000  (Ethernet)
       RX packets 108  bytes 32404 (32.4 KB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 14  bytes 1172 (1.1 KB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

With the change:

tap0: flagsA63<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       inet 172.22.56.178  netmask 255.255.255.0  broadcast 172.22.56.255
       inet6 xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx  prefixlen 64  scopeid 
0x0<global>
       inet6 fe80::f0f2:e4ff:fe4f:bfff  prefixlen 64  scopeid 0x20<link>
       ether f2:f2:e4:4f:bf:ff  txqueuelen 1000  (Ethernet)
       RX packets 12  bytes 1200 (1.2 KB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 11  bytes 962 (962.0 B)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

When using ip address show instead, the difference is that without the change

inet 172.22.56.178/24 scope global tap0

is shown, while with the change

inet 172.22.56.178/24 brd 172.22.56.255 scope global tap0

is shown.

In fact, systemd-networkd also does it. When configuring an IP address,

1. it calls the code that calculates the broadcast address at 
https://github.com/systemd/systemd/blob/5bf7438ff025ae05daf1b706f204f31373d5ab82/src/network/networkd-address.c#L1667,
2. it calculates the broadcast address (if not specified explicitly) at 
https://github.com/systemd/systemd/blob/5bf7438ff025ae05daf1b706f204f31373d5ab82/src/network/networkd-address.c#L408,
3. and finally it send the broadcast address to the kernel at 
https://github.com/systemd/systemd/blob/5bf7438ff025ae05daf1b706f204f31373d5ab82/src/network/networkd-address.c#L1555.

It implements the way how the broadcast address is calculated slightly 
differently. For my patch, I took the inspiration from how iproute2 implements 
it instead.

Best regards,
Sebastian

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to