Hi,
On Sat, Feb 01, 2025 at 02:24:37PM +0800, Qingfang Deng wrote:
> #endif
> + if (sock->bind_local && sock->info.lsa->bind_local) {
> + localaddr = sock->info.lsa->bind_local->ai_addr;
> + }
> +
This is still not correct style - the opening "{" needs to go on its own
line. Also see below on whether this is necessary at all.
> int ret = dco_new_peer(&c->c1.tuntap->dco, multi->peer_id,
> - c->c2.link_sockets[0]->sd, NULL, remoteaddr,
> NULL, NULL);
> + c->c2.link_sockets[0]->sd, localaddr, remoteaddr,
> NULL, NULL);
> if (ret < 0)
> {
> return ret;
> @@ -550,7 +555,7 @@ dco_multi_get_localaddr(struct multi_context *m, struct
> multi_instance *mi,
> {
> struct sockaddr_in *sock_in4 = (struct sockaddr_in *)local;
> #if defined(HAVE_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST)
> - sock_in4->sin_addr = actual->pi.in4.ipi_addr;
> + sock_in4->sin_addr = actual->pi.in4.ipi_spec_dst;
> #elif defined(IP_RECVDSTADDR)
> sock_in4->sin_addr = actual->pi.in4;
Well spotted.
> #else
> @@ -616,10 +621,15 @@ dco_multi_add_new_peer(struct multi_context *m, struct
> multi_instance *mi)
> vpn_addr6 = &c->c2.push_ifconfig_ipv6_local;
> }
>
> + struct link_socket *ls = c->c2.link_sockets[0];
> if (dco_multi_get_localaddr(m, mi, &local))
> {
> localaddr = (struct sockaddr *)&local;
> }
> + else if (ls->bind_local && ls->info.lsa->bind_local)
> + {
> + localaddr = ls->info.lsa->bind_local->ai_addr;
> + }
Not sure about that. If the socket is bound, the kernel knows about
the binding (because we pass the socket to the kernel). You're sure this
is needed?
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 [email protected]
signature.asc
Description: PGP signature
_______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
