Hi, On Sat, Sep 13, 2025 at 04:25:25PM +0200, Sebastian Marsching wrote: > @@ -803,6 +804,16 @@ sitnl_addr_set(int cmd, uint32_t flags, int ifindex, > sa_family_t af_family, > SITNL_ADDATTR(&req.n, sizeof(req), IFA_LOCAL, local, size); > } > > + if (af_family == AF_INET && local && !remote && prefixlen <= 30) > + { > + broadcast = *local; > + for (i = 31; i >= prefixlen; i--)
Ah, well, I guess the integer police will come after us... so in modern parts of OpenVPN we go for local C99 declarations, *and* we take extra care to make it all -Wsign-conversion safe, so I think this needs to be + for (unsigned int i = 31; i >= prefixlen; i--) (and no extra "int i" declaration on top) This said, I see we have a "netbits_to_netmask(bits)" function in route.h -> please use that, it should be something like + if (af_family == AF_INET && local && !remote && prefixlen <= 30) + { + inet_address_t broadcast = *local; + broadcast.ipv4 |= ~netbits_to_netmask(prefixlen); + ... (maybe with an htonl() wrapped around) gert -- "If was one thing all people took for granted, was conviction that if you feed honest figures into a computer, honest figures come out. Never doubted it myself till I met a computer with a sense of humor." Robert A. Heinlein, The Moon is a Harsh Mistress Gert Doering - Munich, Germany g...@greenie.muc.de
signature.asc
Description: PGP signature
_______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel