Hi,

On Sat, Sep 13, 2025 at 10:10:41PM +0200, Sebastian Marsching wrote:
> Thanks for pointing me to the netbits_to_netmask function. Using this 
> function, the code looks so much cleaner. See the updated patch below.

Close...

> @@ -760,6 +761,7 @@ sitnl_addr_set(int cmd, uint32_t flags, int ifindex, 
> sa_family_t af_family,
>  {
>      struct sitnl_addr_req req;
>      uint32_t size;
> +    inet_address_t broadcast;
>      int ret = -EINVAL;
>  
>      CLEAR(req);
> @@ -803,6 +805,13 @@ 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;
> +        broadcast.ipv4 |= htonl(~netbits_to_netmask(prefixlen));
> +        SITNL_ADDATTR(&req.n, sizeof(req), IFA_BROADCAST, &broadcast, size);

... but we do want local-scoped things to be declared locally (C99), so

  +        inet_address_t broadcast = *local;

here (SITNL_ADDATTR() will copy the struct content, not the reference).

When sending a v3, can you send that with "git send-email -v3" in
its own mail, "--in-reply-to <this_thread>"?  This makes it easy to
see which version is the latest.

thanks,

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

Attachment: signature.asc
Description: PGP signature

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

Reply via email to