From: "cron2 (Code Review)" Date: Wed, 23 Jul 2025 08:35:15 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., antonio@...2726... Message-ID: <642690e84bcc344ac8889c089fdab814d0e0874b-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="RssiPzsAJ5M="; charset=UTF-8 Subject: [Openvpn-devel] [L] Change in openvpn[master]: dco_linux: rearrange functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --RssiPzsAJ5M= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#3) to the change originally created by= ordex. ( http://gerrit.openvpn.net/c/openvpn/+/1098?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: dco_linux: rearrange functions ...................................................................... dco_linux: rearrange functions In preparation for the implementation of a generic netlink message parser, move all parsing functions above ovpn_handle_msg(). The latter is soon going to become a generic message parser which will invoke specific handlers, thus they are required to be defined earlier in the file. No functional change is intended. This patch is only meant to reduce entropy in the patch which will do the real netlink parser change. Better reviewed with: git show --color-moved Change-Id: I94004579aef4a1ccccdbcf8edd7b722e5a611c72 Signed-off-by: Antonio Quartulli Acked-by: Gert Doering Message-Id: <20250723060747.19524-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32= 263.html Signed-off-by: Gert Doering --- M src/openvpn/dco_linux.c 1 file changed, 144 insertions(+), 144 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/98/1098/3 diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index a04a164..3652a49 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -806,6 +806,150 @@ return false; } +/* libnl < 3.11.0 does not implement nla_get_uint() */ +static uint64_t +ovpn_nla_get_uint(struct nlattr *attr) +{ + if (nla_len(attr) =3D=3D sizeof(uint32_t)) + { + return nla_get_u32(attr); + } + else + { + return nla_get_u64(attr); + } +} + +static void +dco_update_peer_stat(struct context_2 *c2, struct nlattr *tb[], uint32_t i= d) +{ + if (tb[OVPN_A_PEER_LINK_RX_BYTES]) + { + c2->dco_read_bytes =3D ovpn_nla_get_uint(tb[OVPN_A_PEER_LINK_RX_BY= TES]); + msg(D_DCO_DEBUG, "%s / dco_read_bytes: " counter_format, __func__, + c2->dco_read_bytes); + } + else + { + msg(M_WARN, "%s: no link RX bytes provided in reply for peer %u", + __func__, id); + } + + if (tb[OVPN_A_PEER_LINK_TX_BYTES]) + { + c2->dco_write_bytes =3D ovpn_nla_get_uint(tb[OVPN_A_PEER_LINK_TX_B= YTES]); + msg(D_DCO_DEBUG, "%s / dco_write_bytes: " counter_format, __func__, + c2->dco_write_bytes); + } + else + { + msg(M_WARN, "%s: no link TX bytes provided in reply for peer %u", + __func__, id); + } + + if (tb[OVPN_A_PEER_VPN_RX_BYTES]) + { + c2->tun_read_bytes =3D ovpn_nla_get_uint(tb[OVPN_A_PEER_VPN_RX_BYT= ES]); + msg(D_DCO_DEBUG, "%s / tun_read_bytes: " counter_format, __func__, + c2->tun_read_bytes); + } + else + { + msg(M_WARN, "%s: no VPN RX bytes provided in reply for peer %u", + __func__, id); + } + + if (tb[OVPN_A_PEER_VPN_TX_BYTES]) + { + c2->tun_write_bytes =3D ovpn_nla_get_uint(tb[OVPN_A_PEER_VPN_TX_BY= TES]); + msg(D_DCO_DEBUG, "%s / tun_write_bytes: " counter_format, __func__, + c2->tun_write_bytes); + } + else + { + msg(M_WARN, "%s: no VPN TX bytes provided in reply for peer %u", + __func__, id); + } +} + +static int +dco_parse_peer_multi(struct nl_msg *msg, void *arg) +{ + struct nlattr *tb[OVPN_A_MAX + 1]; + struct genlmsghdr *gnlh =3D nlmsg_data(nlmsg_hdr(msg)); + + msg(D_DCO_DEBUG, "%s: parsing message...", __func__); + + nla_parse(tb, OVPN_A_MAX, genlmsg_attrdata(gnlh, 0), + genlmsg_attrlen(gnlh, 0), NULL); + + if (!tb[OVPN_A_PEER]) + { + return NL_SKIP; + } + + struct nlattr *tb_peer[OVPN_A_PEER_MAX + 1]; + nla_parse_nested(tb_peer, OVPN_A_PEER_MAX, tb[OVPN_A_PEER], NULL); + + if (!tb_peer[OVPN_A_PEER_ID]) + { + msg(M_WARN, "%s: no peer-id provided in reply", __func__); + return NL_SKIP; + } + + struct multi_context *m =3D arg; + uint32_t peer_id =3D nla_get_u32(tb_peer[OVPN_A_PEER_ID]); + + if (peer_id >=3D m->max_clients || !m->instances[peer_id]) + { + msg(M_WARN, "%s: cannot store DCO stats for peer %u", __func__, + peer_id); + return NL_SKIP; + } + + dco_update_peer_stat(&m->instances[peer_id]->context.c2, tb_peer, peer= _id); + + return NL_OK; +} + +static int +dco_parse_peer(struct nl_msg *msg, void *arg) +{ + struct context *c =3D arg; + struct nlattr *tb[OVPN_A_MAX + 1]; + struct genlmsghdr *gnlh =3D nlmsg_data(nlmsg_hdr(msg)); + + msg(D_DCO_DEBUG, "%s: parsing message...", __func__); + + nla_parse(tb, OVPN_A_MAX, genlmsg_attrdata(gnlh, 0), + genlmsg_attrlen(gnlh, 0), NULL); + + if (!tb[OVPN_A_PEER]) + { + msg(D_DCO_DEBUG, "%s: malformed reply", __func__); + return NL_SKIP; + } + + struct nlattr *tb_peer[OVPN_A_PEER_MAX + 1]; + nla_parse_nested(tb_peer, OVPN_A_PEER_MAX, tb[OVPN_A_PEER], NULL); + + if (!tb_peer[OVPN_A_PEER_ID]) + { + msg(M_WARN, "%s: no peer-id provided in reply", __func__); + return NL_SKIP; + } + + uint32_t peer_id =3D nla_get_u32(tb_peer[OVPN_A_PEER_ID]); + if (c->c2.tls_multi->dco_peer_id !=3D peer_id) + { + return NL_SKIP; + } + + dco_update_peer_stat(&c->c2, tb_peer, peer_id); + + return NL_OK; +} + /* This function parses any netlink message sent by ovpn-dco to userspace = */ static int ovpn_handle_msg(struct nl_msg *msg, void *arg) @@ -988,112 +1132,6 @@ return ovpn_nl_recvmsgs(dco, __func__); } -/* libnl < 3.11.0 does not implement nla_get_uint() */ -static uint64_t -ovpn_nla_get_uint(struct nlattr *attr) -{ - if (nla_len(attr) =3D=3D sizeof(uint32_t)) - { - return nla_get_u32(attr); - } - else - { - return nla_get_u64(attr); - } -} - -static void -dco_update_peer_stat(struct context_2 *c2, struct nlattr *tb[], uint32_t i= d) -{ - if (tb[OVPN_A_PEER_LINK_RX_BYTES]) - { - c2->dco_read_bytes =3D ovpn_nla_get_uint(tb[OVPN_A_PEER_LINK_RX_BY= TES]); - msg(D_DCO_DEBUG, "%s / dco_read_bytes: " counter_format, __func__, - c2->dco_read_bytes); - } - else - { - msg(M_WARN, "%s: no link RX bytes provided in reply for peer %u", - __func__, id); - } - - if (tb[OVPN_A_PEER_LINK_TX_BYTES]) - { - c2->dco_write_bytes =3D ovpn_nla_get_uint(tb[OVPN_A_PEER_LINK_TX_B= YTES]); - msg(D_DCO_DEBUG, "%s / dco_write_bytes: " counter_format, __func__, - c2->dco_write_bytes); - } - else - { - msg(M_WARN, "%s: no link TX bytes provided in reply for peer %u", - __func__, id); - } - - if (tb[OVPN_A_PEER_VPN_RX_BYTES]) - { - c2->tun_read_bytes =3D ovpn_nla_get_uint(tb[OVPN_A_PEER_VPN_RX_BYT= ES]); - msg(D_DCO_DEBUG, "%s / tun_read_bytes: " counter_format, __func__, - c2->tun_read_bytes); - } - else - { - msg(M_WARN, "%s: no VPN RX bytes provided in reply for peer %u", - __func__, id); - } - - if (tb[OVPN_A_PEER_VPN_TX_BYTES]) - { - c2->tun_write_bytes =3D ovpn_nla_get_uint(tb[OVPN_A_PEER_VPN_TX_BY= TES]); - msg(D_DCO_DEBUG, "%s / tun_write_bytes: " counter_format, __func__, - c2->tun_write_bytes); - } - else - { - msg(M_WARN, "%s: no VPN TX bytes provided in reply for peer %u", - __func__, id); - } -} - -int -dco_parse_peer_multi(struct nl_msg *msg, void *arg) -{ - struct nlattr *tb[OVPN_A_MAX + 1]; - struct genlmsghdr *gnlh =3D nlmsg_data(nlmsg_hdr(msg)); - - msg(D_DCO_DEBUG, "%s: parsing message...", __func__); - - nla_parse(tb, OVPN_A_MAX, genlmsg_attrdata(gnlh, 0), - genlmsg_attrlen(gnlh, 0), NULL); - - if (!tb[OVPN_A_PEER]) - { - return NL_SKIP; - } - - struct nlattr *tb_peer[OVPN_A_PEER_MAX + 1]; - nla_parse_nested(tb_peer, OVPN_A_PEER_MAX, tb[OVPN_A_PEER], NULL); - - if (!tb_peer[OVPN_A_PEER_ID]) - { - msg(M_WARN, "%s: no peer-id provided in reply", __func__); - return NL_SKIP; - } - - struct multi_context *m =3D arg; - uint32_t peer_id =3D nla_get_u32(tb_peer[OVPN_A_PEER_ID]); - - if (peer_id >=3D m->max_clients || !m->instances[peer_id]) - { - msg(M_WARN, "%s: cannot store DCO stats for peer %u", __func__, - peer_id); - return NL_SKIP; - } - - dco_update_peer_stat(&m->instances[peer_id]->context.c2, tb_peer, peer= _id); - - return NL_OK; -} - int dco_get_peer_stats_multi(dco_context_t *dco, struct multi_context *m, const bool raise_sigusr1_on_err) @@ -1118,44 +1156,6 @@ return ret; } -static int -dco_parse_peer(struct nl_msg *msg, void *arg) -{ - struct context *c =3D arg; - struct nlattr *tb[OVPN_A_MAX + 1]; - struct genlmsghdr *gnlh =3D nlmsg_data(nlmsg_hdr(msg)); - - msg(D_DCO_DEBUG, "%s: parsing message...", __func__); - - nla_parse(tb, OVPN_A_MAX, genlmsg_attrdata(gnlh, 0), - genlmsg_attrlen(gnlh, 0), NULL); - - if (!tb[OVPN_A_PEER]) - { - msg(D_DCO_DEBUG, "%s: malformed reply", __func__); - return NL_SKIP; - } - - struct nlattr *tb_peer[OVPN_A_PEER_MAX + 1]; - nla_parse_nested(tb_peer, OVPN_A_PEER_MAX, tb[OVPN_A_PEER], NULL); - - if (!tb_peer[OVPN_A_PEER_ID]) - { - msg(M_WARN, "%s: no peer-id provided in reply", __func__); - return NL_SKIP; - } - - uint32_t peer_id =3D nla_get_u32(tb_peer[OVPN_A_PEER_ID]); - if (c->c2.tls_multi->dco_peer_id !=3D peer_id) - { - return NL_SKIP; - } - - dco_update_peer_stat(&c->c2, tb_peer, peer_id); - - return NL_OK; -} - int dco_get_peer_stats(struct context *c, const bool raise_sigusr1_on_err) { -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1098?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I94004579aef4a1ccccdbcf8edd7b722e5a611c72 Gerrit-Change-Number: 1098 Gerrit-PatchSet: 3 Gerrit-Owner: ordex Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --RssiPzsAJ5M= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #3 to the change originally cr= eated by ordex.

View Change

The following approvals got outdated an= d were removed: Code-Review+2 by cron2

dco_linux: rearrange functions

In preparation= for the implementation of a generic netlink
message parser, move all pa= rsing functions above ovpn_handle_msg().

The latter is soon going to= become a generic message parser which
will invoke specific handlers, th= us they are required to be defined
earlier in the file.

No functi= onal change is intended.

This patch is only meant to reduce entropy = in the patch which will do
the real netlink parser change.

Better= reviewed with: git show --color-moved

Change-Id: I94004579aef4a1ccc= cdbcf8edd7b722e5a611c72
Signed-off-by: Antonio Quartulli <antonio@...493...= 2726...>
Acked-by: Gert Doering <gert@...1296...>
Message-Id= : <20250723060747.19524-1-gert@...1296...>
URL: https://www.mail-a= rchive.com/openvpn-devel@lists.sourceforge.net/msg32263.html
Signed-off-= by: Gert Doering <gert@...1296...>
---
M src/openvpn/dco_linux.= c
1 file changed, 144 insertions(+), 144 deletions(-)

git pull=
 ssh://gerrit.openvpn.net:29418/openvpn refs/changes/98/1098/3
diff=
 --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c
= index a04a164..3652a49 100644
--- a/src/openvpn/dco_linux.c=
+++ b/src/openvpn/dco_linux.c
@@ -806,6 +8= 06,150 @@
return false;
}
<= span>
+/* libnl <= 3.11.0 does not implement nla_get_uint() */
+static uint64_t
+ovpn_nla_get_uint(struct nlattr *attr)
+{
+ if (nla_len(attr) =3D=3D sizeof(uint32_t))=
+ {
+ return nla_get_u32(attr);=
+ }
+ else
+ {
+ return nla_get_u64(attr);
+ }
+}
+<= br>+static void
+dco_update_peer_stat(struct context= _2 *c2, struct nlattr *tb[], uint32_t id)
+{
+ if (tb[OVPN_A_PEER_LINK_RX_BYTES])
+ {
+ c2->dco_read_bytes =3D ovpn_nla_get_uint(tb[OVPN_A_PEER= _LINK_RX_BYTES]);
+ = msg(D_DCO_DEBUG, "%s / dco_read_bytes: " counter_format, __= func__,
+ = c2->dco_read_bytes);
+ }
+ else
+ {
+ msg(M_WARN, "%s: no li= nk RX bytes provided in reply for peer %u",

+ __func__, id);
+ }
+
+ {
+ c2->dco_write_bytes =3D ovpn_nla_get_uint(tb[OVPN_A_PEER= _LINK_TX_BYTES]);
+ = msg(D_DCO_DEBUG, "%s / dco_write_bytes: " counter_format, _= _func__,
+ = c2->dco_write_bytes);
+ }
+ else=
+ {
+ msg(M_WARN, "%s: no = link TX bytes provided in reply for peer %u",
+ __func__, id);
+ }
+
+ if (tb[OVPN_A_PEER_VPN_RX_BYTES])
+ {
+ c2->tun_read_bytes =3D ovpn_nla_get_uint(tb[OVPN_A_PEER= _VPN_RX_BYTES]);
+ = msg(D_DCO_DEBUG, "%s / tun_read_bytes: " counter_format, __f= unc__,
+ c= 2->tun_read_bytes);
+ else
+ {
+ msg(M_WARN, "%s: no VPN= RX bytes provided in reply for peer %u",
+ __func__, id);
+ }
+
= + if (tb[OVPN_A_PEER_VPN_TX_BYTES])
+ {
+ c2->tun_write_bytes =3D ovpn_nla_get_uint(tb[OVPN_A_PEER_VP= N_TX_BYTES]);
+ = msg(D_DCO_DEBUG, "%s / tun_write_bytes: " counter_format, __fun= c__,
+ c2-= >tun_write_bytes);
+ }
+ else

+ {
+ msg(M_WARN, "%s: no VPN = TX bytes provided in reply for peer %u",
+ __func__, id);
+ }
+}
+
+static int=
+dco_parse_peer_multi(struc= t nl_msg *msg, void *arg)
+{
+ struct n= lattr *tb[OVPN_A_MAX + 1];
+ struct genlmsghdr *gnlh =3D nlmsg_data(nlmsg_hdr(msg));+
+ msg(D_DCO_DEBUG, "%s: parsing message.= ..", __func__);
= +
+ nla_parse(tb, = OVPN_A_MAX, genlmsg_attrdata(gnlh, 0),
+ genlmsg_attrlen(gnlh, 0), NULL);+
+ if (!tb[OVPN_A_PEER])
+ {
+ return NL_SKIP;
+ }
+
+ struc= t nlattr *tb_peer[OVPN_A_PEER_MAX + 1];
+ nla_parse_nested(tb_peer, OVPN_A_PEER_MAX, tb[OVPN_= A_PEER], NULL);
+
+ if (!tb_peer[OVPN_A= _PEER_ID])
+ {
+ msg(M_WARN, &qu= ot;%s: no peer-id provided in reply", __func__);
+ return NL_SKIP;
+ }
+
+ struct multi_context *m =3D arg;
+ uint32_t peer_id =3D nla_get_u32(tb_peer[OVPN_A_P= EER_ID]);
++ if (peer_id >=3D m->= ;max_clients || !m->instances[peer_id])
+ {
+ msg(M_WARN, "%s: cannot store DCO stats for peer %u&q= uot;, __func__,
+ = peer_id);
+ = return NL_SKIP;
+ }
+
<= span style=3D"color: hsl(120, 100%, 40%);">+ dco_update_peer_stat(&m= ->instances[peer_id]->context.c2, tb_peer, peer_id);

+
+ return NL_OK;
+}
+=
+static int+dco_parse_peer(struct nl_msg= *msg, void *arg)
+{<= /span>
+ struct context *= c =3D arg;
+ struc= t nlattr *tb[OVPN_A_MAX + 1];
+ struct genlmsghdr *gnlh =3D nlmsg_data(nlmsg_hdr(msg));

+
+ msg(D_DCO_DEBUG, "%s: parsing messa= ge...", __func__);
+
+ nla_parse(t= b, OVPN_A_MAX, genlmsg_attrdata(gnlh, 0),
+ genlmsg_attrlen(gnlh, 0), NULL);=
+
+ if (!tb[OVPN_A_PEER])
+ {
+ msg(D_DCO_DEBUG, "%s: malformed reply&qu= ot;, __func__);
+ = return NL_SKIP;
+= }
+
+ struct nlattr *tb_peer[OVPN_A= _PEER_MAX + 1];
+ = nla_parse_nested(tb_peer, OVPN_A_PEER_MAX, tb[OVPN_A_PEER], NULL);+
+ if (!tb_peer[OVPN_A_PEER_ID])
+ {
+ msg(M_WARN, "%s: no peer-id provid= ed in reply", __func__);
+ return NL_SKIP;
+ }
+=
+ uint32_t peer_i= d =3D nla_get_u32(tb_peer[OVPN_A_PEER_ID]);
+ if (c->c2.tls_multi->dco_peer_id !=3D pee= r_id)
+ {+ return NL_SKIP;
+ }
+
+ dco_update_peer_stat(&c->c2, tb_peer, peer_id)= ;
+
+ return NL_OK;
+}
+
/* This function parses any netlink mes= sage sent by ovpn-dco to userspace */
static int ovpn_handle_msg(struct nl_msg *msg, void *arg)
@@ -= 988,112 +1132,6 @@
return ovpn_nl_recvmsgs(dco, __func= __);
}

-/* libnl < 3.11.0 does not implement nla_get_uint() = */
-static uint64_t

-ovpn_nla_get_uint(struct = nlattr *attr)
-{=
- if (nla_len(attr) =3D=3D= sizeof(uint32_t))
- = {
- return nla_= get_u32(attr);
- }
- else
- {

- return nla_get_u64(attr);
- }
-}
-<= /span>
-static void
= -dco_update_peer_stat(struct cont= ext_2 *c2, struct nlattr *tb[], uint32_t id)
-{
- {
- c2->dco_read_bytes =3D ovpn_nla_get_uint(tb[OVPN_A_PEER_LINK= _RX_BYTES]);
- m= sg(D_DCO_DEBUG, "%s / dco_read_bytes: " counter_format, __func__,=
- c2->dc= o_read_bytes);
- }
- else
- {

- msg(M_WARN, "%s: no link RX bytes provi= ded in reply for peer %u",
- __func__, id);
- }
-<= /span>
- if (tb[OVPN_A_PEER= _LINK_TX_BYTES])
- {=
- c2->dco_wr= ite_bytes =3D ovpn_nla_get_uint(tb[OVPN_A_PEER_LINK_TX_BYTES]);
<= span style=3D"color: hsl(0, 100%, 40%);">- msg(D_DCO_DEBUG, "%s= / dco_write_bytes: " counter_format, __func__,

- c2->dco_write_bytes);=
- }
- else
- {
- = __func__, id);
- }=
-
- if (tb[OVPN_A_PEER_VPN_RX_BYTES])
- {
- c2->tun_read_bytes =3D ovpn_nla= _get_uint(tb[OVPN_A_PEER_VPN_RX_BYTES]);
- msg(D_DCO_DEBUG, "%s / tun_read_bytes: &quo= t; counter_format, __func__,
- c2->tun_read_bytes);
- }
- else
- {
- msg(M_WARN, &quo= t;%s: no VPN RX bytes provided in reply for peer %u",
- __func__, id);
<= span style=3D"color: hsl(0, 100%, 40%);">- }

-
- if (tb[OVPN_A_PEER_VPN_TX_BYTES])
- {
- c2->tun_write_bytes =3D ovpn_nla_get_uint(tb[OVPN_A_PEER_VP= N_TX_BYTES]);
- = msg(D_DCO_DEBUG, "%s / tun_write_bytes: " counter_format, __func_= _,
- c2->= tun_write_bytes);
- = }
- else
<= span style=3D"color: hsl(0, 100%, 40%);">- {

- msg(M_WARN, "%s: no VPN TX bytes pro= vided in reply for peer %u",
- __func__, id);
- }
= -}
-
-int
-dco_parse_peer_multi(struct nl_msg *msg, void *arg)=
-{
- struct nlattr *tb[OVPN_A_MAX + 1];- struct genlmsghdr *gnlh =3D= nlmsg_data(nlmsg_hdr(msg));
-
- msg(D_DCO_= DEBUG, "%s: parsing message...", __func__);
-
- nla_parse(tb, OVPN_A_MAX, genlmsg_attrdata(gnlh, 0),<= br>- genlmsg_attrlen= (gnlh, 0), NULL);
-

- if (!tb[OVPN_A_PEER])=
- {
- return NL_SKIP;
- }
-
- nla_parse_nested(tb_peer, OVPN_A_PEER_M= AX, tb[OVPN_A_PEER], NULL);
-
- if (!tb_pee= r[OVPN_A_PEER_ID])
- = {
- msg(M_WARN,= "%s: no peer-id provided in reply", __func__);
- return NL_SKIP;
- }
-
= - struct multi_context *m =3D arg;
- uint32_t peer_id =3D nla_get_u32(tb_peer[OVPN_A_PEER_ID= ]);
-
- if (peer_id >=3D m->max_clien= ts || !m->instances[peer_id])
- {
- = msg(M_WARN, "%s: cannot store DCO stats for peer %u", __func__= ,
- peer_id)= ;
- return NL_SK= IP;
- }
-
- dco_update_peer_stat(&m->instances[peer_id]-= >context.c2, tb_peer, peer_id);
-
- retu= rn NL_OK;
-}
= -
int
= dco_get_peer_stats_multi(dco_context_t *dco, struct multi_context *m= ,
const bool raise_sigusr1_on_err= )
@@ -1118,44 +1156,6 @@
return ret;
}

-static int
-{
- struct context *c =3D arg;
- struct nlattr *tb[OVPN_A_MAX + 1];
- struct genlmsghdr *gnlh =3D nlmsg_data= (nlmsg_hdr(msg));
-

- msg(D_DCO_DEBUG, &quo= t;%s: parsing message...", __func__);
-
-= nla_parse(tb, OVPN_A_MAX, genlmsg_attrdata(gnlh, 0),
- genlmsg_attrlen(gnlh, 0), = NULL);
-
- if (!tb[OVPN_A_PEER])
= - {
- msg(D_DCO_DEBUG, "%s: malformed rep= ly", __func__);
- = return NL_SKIP;
= - }
-
- struct nlattr *tb_peer[OVPN_A_PE= ER_MAX + 1];
- nla_p= arse_nested(tb_peer, OVPN_A_PEER_MAX, tb[OVPN_A_PEER], NULL);
-
- if (!tb_peer[OVPN_A_PEER_ID])
- {
- msg(M_WARN, "%s: no peer-id provided in reply&= quot;, __func__);
- = return NL_SKIP;
- = }
-
- uint32_t peer_id =3D nla_get_u32(tb= _peer[OVPN_A_PEER_ID]);
- if (c->c2.tls_multi->dco_peer_id !=3D peer_id)
- {
- return NL_SKIP;
- }
-
- dco_update= _peer_stat(&c->c2, tb_peer, peer_id);
-
- return NL_OK;
-}<= /span>
-
int<= /span>
dco_get_peer_stats(struct context *c, const bool raise_sig= usr1_on_err)
{

To view= , visit = change 1098. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I94004579aef4a1ccccdbcf8edd7= b722e5a611c72
Gerrit-Change-Number: 1098
Gerrit-PatchSet: 3
Gerrit-Owner: ordex <antonio@...2726...>=
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--RssiPzsAJ5M=--