From: "cron2 (Code Review)" Date: Wed, 23 Jul 2025 08:35:18 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., antonio@...2726... Message-ID: <642690e84bcc344ac8889c089fdab814d0e0874b-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="vF/T+TfwphU="; 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: , Cc: plaisthos , flichtenheld , openvpn-devel --vF/T+TfwphU= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/10= 98?usp=3Demail ) 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(-) 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: merged --vF/T+TfwphU= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

dco_linux: rearrange functions

In prep= aration for the implementation of a generic netlink
message parser, move= all parsing functions above ovpn_handle_msg().

The latter is soon g= oing to become a generic message parser which
will invoke specific handl= ers, thus they are required to be defined
earlier in the file.

No= functional change is intended.

This patch is only meant to reduce e= ntropy in the patch which will do
the real netlink parser change.
Better reviewed with: git show --color-moved

Change-Id: I94004579ae= f4a1ccccdbcf8edd7b722e5a611c72
Signed-off-by: Antonio Quartulli <anto= nio@...2726...>
Acked-by: Gert Doering <gert@...1296...>
Mes= sage-Id: <20250723060747.19524-1-gert@...1296...>
URL: https://www= .mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32263.html
Sign= ed-off-by: Gert Doering <gert@...1296...>
---
M src/openvpn/dco= _linux.c
1 file changed, 144 insertions(+), 144 deletions(-)

diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.cindex a04a164..3652a49 100644
--- a/src/openvpn/dco_= linux.c
+++ b/src/openvpn/dco_linux.c
@@ -8= 06,6 +806,150 @@
return false;
}

+/* lib= nl < 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= ))
+ {
<= span style=3D"color: hsl(120, 100%, 40%);">+ return nla_get_u32(attr= );

+ }
<= span style=3D"color: hsl(120, 100%, 40%);">+ else
+ {
+ return nla_get_u64(attr);
+ }
+}
+
+static void
+dco_update_peer_stat(stru= ct 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: " counte= r_format, __func__,
+= c2->dco_read_bytes);
+ }
+ else
+ {

+ msg(M_WARN, &qu= ot;%s: no link RX bytes provided in reply for peer %u",
+ __func__, id);<= br>+ }
+
+ if (tb[OVPN_A_PEER_LINK_TX_BYTES])
+ {
+ c2->dco_write_bytes =3D ovpn_nla_get_uint(tb= [OVPN_A_PEER_LINK_TX_BYTES]);
+ msg(D_DCO_DEBUG, "%s / dco_write_bytes: " count= er_format, __func__,
= + c2->dco_write_bytes);
+ }
+ else
+ {
+ msg(M_WARN, &= quot;%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, __func__,
+ = c2->tun_read_bytes);
+ }
= + else
+ {

+ msg(M_WARN, &quo= t;%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_BYTES]);
+ msg(D_DCO_DEBUG, "%s / tun_write_bytes: " counte= r_format, __func__,
+= c2->tun_write_bytes);
+ }
+ {
+ msg(M_WARN, &q= uot;%s: no VPN TX bytes provided in reply for peer %u",
+ __func__, id);
<= br>+ }
+}
+
+sta= tic int
+dco_parse_pe= er_multi(struct nl_msg *msg, void *arg)
+{
+ struct nlattr *tb[OVPN_A_MAX + 1];
+ struct genlmsghdr *gnlh =3D nlmsg_data(nlmsg_hdr(m= sg));
+
+ msg(D_DCO_DEBUG, "%s: pa= rsing message...", __func__);
+
+ = nla_parse(tb, OVPN_A_MAX, genlmsg_attrdata(gnlh, 0),
+ genlmsg_attrlen(gnlh, 0), N= ULL);
+
+ if (!tb[OVPN_A_PEER])<= br>+ {
+ 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])
+ {
+ m= sg(M_WARN, "%s: no peer-id provided in reply", __func__);<= br>+ 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_pe= er_stat(&m->instances[peer_id]->context.c2, tb_peer, peer_id);
+
+ return NL_OK;
+}
+
+sta= tic int
+dco_parse_pe= er(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: ma= lformed 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);
+
<= span style=3D"color: hsl(120, 100%, 40%);">+ if (!tb_peer[OVPN_A_PEER_ID= ])
+ {
<= span style=3D"color: hsl(120, 100%, 40%);">+ msg(M_WARN, "%s: n= o 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)
+ {
+ retu= rn NL_SKIP;
+ }
+
+ dco_update_peer_stat(&c->c2, t= b_peer, peer_id);
+
+ return NL_OK;
+}
+
/* This function parses= any netlink message sent by ovpn-dco to userspace */
stat= ic int
ovpn_handle_msg(struct nl_msg *msg, void *arg)
@@ -988,112 +1132,6 @@
return ovpn_nl_recv= msgs(dco, __func__);
}

-/* libnl < 3.11.0 does not implement= nla_get_uint() */
-sta= tic uint64_t
-ovpn_nla_= get_uint(struct nlattr *attr)
-{
- if (nla_= len(attr) =3D=3D sizeof(uint32_t))
- {
- = return nla_get_u32(attr);
- }
- els= e
- {
- return nla_get_u64(attr);
- }
-}
-
-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_f= ormat, __func__,
- = c2->dco_read_bytes);
- }
- els= e
- {
- msg(M_WARN, "%s: no lin= k RX bytes provided in reply for peer %u",

- __func__, id);
- }
-
- i= f (tb[OVPN_A_PEER_LINK_TX_BYTES])
- {
- = c2->dco_write_bytes =3D ovpn_nla_get_uint(tb[OVPN_A_PEER_LINK_TX_BYT= ES]);
- msg(D_DC= O_DEBUG, "%s / dco_write_bytes: " counter_format, __func__,

- c2->dco_writ= e_bytes);
- }=
- else
- {
- msg(M_WARN, "%s: no link TX bytes provided i= n reply for peer %u",
- __func__, id);
- }
-
- if (tb[OVPN_A_PEER_VPN_= RX_BYTES])
- {
- c2->tun_read_byt= es =3D ovpn_nla_get_uint(tb[OVPN_A_PEER_VPN_RX_BYTES]);
- msg(D_DCO_DEBUG, "%s / tun_r= ead_bytes: " counter_format, __func__,
- c2->tun_read_bytes);
- }
- else
- {
- m= sg(M_WARN, "%s: no VPN RX bytes provided in reply for peer %u",
- __func__, i= d);
- }
-

- if (tb[OVPN_A_PEER_VPN_TX_BYTES])
- {
- c2->tun_write_bytes =3D ovpn_nla_get_uint(tb= [OVPN_A_PEER_VPN_TX_BYTES]);
- msg(D_DCO_DEBUG, "%s / tun_write_bytes: " counter_= format, __func__,
- = c2->tun_write_bytes);
- }
- e= lse
- {
- msg(M_WARN, "%s: no V= PN TX bytes provided in reply for peer %u",

- __func__, id);
- }
-}
-
-int
-dco_parse_peer_multi(struct nl_msg *msg, vo= id *arg)
-{
<= span style=3D"color: hsl(0, 100%, 40%);">- struct nlattr *tb[OVPN_A_MAX = + 1];

- struct genlm= sghdr *gnlh =3D nlmsg_data(nlmsg_hdr(msg));
-
= - msg(D_DCO_DEBUG, "%s: parsing message...", __func__);=
-
- nla_parse(tb, OVPN_A_MAX, genlmsg_attrdata(gn= lh, 0),
- = genlmsg_attrlen(gnlh, 0), NULL);
-
- if (!t= b[OVPN_A_PEER])
- {<= /span>
- 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[O= VPN_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&qu= ot;, __func__,
- = peer_id);
- = return NL_SKIP;
- }=
-
- dco_update_peer_stat(&m->instan= ces[peer_id]->context.c2, tb_peer, peer_id);
-
- return NL_OK;
= -}
-
i= nt
dco_get_peer_stats_multi(dco_context_t *dco, struct mul= ti_context *m,
const bool raise_s= igusr1_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];<= br>- struct genlmsghdr *gnlh = =3D nlmsg_data(nlmsg_hdr(msg));
-
- msg(D_D= CO_DEBUG, "%s: parsing message...", __func__);
-
- nla_parse(tb, OVPN_A_MAX, genlmsg_attrdata(gnlh, 0),
- genlmsg_attr= len(gnlh, 0), NULL);
-<= /span>
- if (!tb[OVPN_A_PEE= R])
- {
- msg(D_DCO_DEBUG, "%s:= malformed reply", __func__);

- return NL_SKIP;
- }
-<= /span>
- 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 provi= ded in reply", __func__);
- return NL_SKIP;
- }
-
- uint32_t peer_id =3D n= la_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 b= ool raise_sigusr1_on_err)
{

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

=
<= meta itemprop=3D"name" content=3D"View Change"/>
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: merged
--vF/T+TfwphU=--