Hi,

On Mon, Nov 04, 2019 at 05:10:12AM +0800, Tom Yan wrote:
> So in master, when net_addr_v4_add is called in tun.c, which
> net_addr_v4_add (networking_iproute2.c or networking_sitnl.c) is
> actually used depends on how openvpn is built, right?

Right.  It's either "default options" (-> sitnl.c) or "--with-iproute2"
(->networking_iproute2.c).

2.4 has "ifconfig or iproute2"
2.5 has "direct interface to netlink" (sitnl) or "iproute2"

> I think the `if (broadcast)` condition in the one of
> networking_sitnl.c needs to be changed to `if (broadcast && prefixlen
> < 31)` as well. 

I think this is more something the caller needs to decide "do I want to
set a broadcast address or not" (so, if /31, set broadcast = NULL).

OTOH, I'm still waiting for someone to tell me why we'd want to set
a broadcast address in the first place :-) - Antonio, you know the
kernel side better.  Why would anyone explicitly configure the standard
broadcast address ("all-ones in the host part of the relevant subnet")?

> Also it seems that net_addr_v4_add is called wrongly
> in tun.c with `&tt->remote_netmask` instead of `&tt->broadcast` as the
> last argument.

I tend to agree with you here.

Antonio, yours :-)  (though I ACKed it) - tun.c, line 1092.

We do mix up "remote" and "netmask" in the shared "remote_netmask"
variable, but "broadcast" is independent of that...  and OpenVPN
actually tells us so, in the "topology subnet" case...

   net_addr_v4_add: 10.194.6.2/24 brd 255.255.255.0 dev tun1

Linux seems to accept this, but it has no further consequences ("all
my tests pass")...

$ ip addr show dev tun1
520: tun1: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast 
state UNKNOWN group default qlen 100
    link/none 
    inet 10.194.6.2/24 brd 255.255.255.0 scope global tun1
       valid_lft forever preferred_lft forever

... but it's still not correct.

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