Skip to content

Commit

Permalink
dco: better naming for function parameters
Browse files Browse the repository at this point in the history
Current naming (remote_in4/6) is confusing, since
those are in fact VPN IPv4/v6 addresses and not
related to remote at all.

Change-Id: I101bbc9f682375ec733bca10b52da82f0abfec27
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Antonio Quartulli <a@unstable.cc>
Message-Id: <20240927093045.22753-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg29460.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
  • Loading branch information
lstipakov authored and cron2 committed Sep 27, 2024
1 parent 2ad9325 commit 95e5a0b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/openvpn/dco_freebsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ sockaddr_to_nvlist(const struct sockaddr *sa)
int
dco_new_peer(dco_context_t *dco, unsigned int peerid, int sd,
struct sockaddr *localaddr, struct sockaddr *remoteaddr,
struct in_addr *remote_in4, struct in6_addr *remote_in6)
struct in_addr *vpn_ipv4, struct in6_addr *vpn_ipv6)
{
struct ifdrv drv;
nvlist_t *nvl;
Expand All @@ -95,15 +95,15 @@ dco_new_peer(dco_context_t *dco, unsigned int peerid, int sd,
nvlist_add_nvlist(nvl, "remote", sockaddr_to_nvlist(remoteaddr));
}

if (remote_in4)
if (vpn_ipv4)
{
nvlist_add_binary(nvl, "vpn_ipv4", &remote_in4->s_addr,
sizeof(remote_in4->s_addr));
nvlist_add_binary(nvl, "vpn_ipv4", &vpn_ipv4->s_addr,
sizeof(vpn_ipv4->s_addr));
}

if (remote_in6)
if (vpn_ipv6)
{
nvlist_add_binary(nvl, "vpn_ipv6", remote_in6, sizeof(*remote_in6));
nvlist_add_binary(nvl, "vpn_ipv6", vpn_ipv6, sizeof(*vpn_ipv6));
}

nvlist_add_number(nvl, "fd", sd);
Expand Down
2 changes: 1 addition & 1 deletion src/openvpn/dco_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ dco_get_cipher(const char *cipher)

int dco_new_peer(dco_context_t *dco, unsigned int peerid, int sd,
struct sockaddr *localaddr, struct sockaddr *remoteaddr,
struct in_addr *remote_in4, struct in6_addr *remote_in6);
struct in_addr *vpn_ipv4, struct in6_addr *vpn_ipv6);

int dco_del_peer(dco_context_t *dco, unsigned int peerid);

Expand Down
10 changes: 5 additions & 5 deletions src/openvpn/dco_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ mapped_v4_to_v6(struct sockaddr *sock, struct gc_arena *gc)
int
dco_new_peer(dco_context_t *dco, unsigned int peerid, int sd,
struct sockaddr *localaddr, struct sockaddr *remoteaddr,
struct in_addr *remote_in4, struct in6_addr *remote_in6)
struct in_addr *vpn_ipv4, struct in6_addr *vpn_ipv6)
{
struct gc_arena gc = gc_new();
const char *remotestr = "[undefined]";
Expand Down Expand Up @@ -263,14 +263,14 @@ dco_new_peer(dco_context_t *dco, unsigned int peerid, int sd,
}

/* Set the primary VPN IP addresses of the peer */
if (remote_in4)
if (vpn_ipv4)
{
NLA_PUT_U32(nl_msg, OVPN_NEW_PEER_ATTR_IPV4, remote_in4->s_addr);
NLA_PUT_U32(nl_msg, OVPN_NEW_PEER_ATTR_IPV4, vpn_ipv4->s_addr);
}
if (remote_in6)
if (vpn_ipv6)
{
NLA_PUT(nl_msg, OVPN_NEW_PEER_ATTR_IPV6, sizeof(struct in6_addr),
remote_in6);
vpn_ipv6);
}
nla_nest_end(nl_msg, attr);

Expand Down
2 changes: 1 addition & 1 deletion src/openvpn/dco_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ dco_create_socket(HANDLE handle, struct addrinfo *remoteaddr, bool bind_local,
int
dco_new_peer(dco_context_t *dco, unsigned int peerid, int sd,
struct sockaddr *localaddr, struct sockaddr *remoteaddr,
struct in_addr *remote_in4, struct in6_addr *remote_in6)
struct in_addr *vpn_ipv4, struct in6_addr *vpn_ipv6)
{
msg(D_DCO_DEBUG, "%s: peer-id %d, fd %d", __func__, peerid, sd);
return 0;
Expand Down

0 comments on commit 95e5a0b

Please sign in to comment.