From: "ordex (Code Review)" Date: Tue, 22 Jul 2025 20:22:22 +0000 References: Reply-To: antonio@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="PzsQWWitjAA="; 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 --PzsQWWitjAA= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1098?usp=3Demail to review the following change. 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 --- 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/1 diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index 13506a1..ec6efaa 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -812,6 +812,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) @@ -994,112 +1138,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) @@ -1124,44 +1162,6 @@ return ret; } =20 -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: 1 Gerrit-Owner: ordex Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --PzsQWWitjAA= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

ordex would like plaisthos and flichtenheld to review t= his change.

V= iew Change

dco_linux: rearrange functions

In preparation for the= implementation of a generic netlink
message parser, move all parsing fu= nctions 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 cha= nge is intended.

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

Better reviewe= d with: git show --color-moved

Change-Id: I94004579aef4a1ccccdbcf8ed= d7b722e5a611c72
Signed-off-by: Antonio Quartulli <antonio@...2726...&= gt;
---
M src/openvpn/dco_linux.c
1 file changed, 144 insertions(+= ), 144 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openv=
pn refs/changes/98/1098/1
diff --git a/src/openvpn/dco_linux.c b/sr=
c/openvpn/dco_linux.c
index 13506a1..ec6efaa 100644<= br>--- a/src/openvpn/dco_linux.c
+++ b/src/openvpn/dc= o_linux.c
@@ -812,6 +812,150 @@
return= false;
}

+/* libnl < 3.11.0 does not implement nla_get_ui= nt() */
+static uint6= 4_t
+ovpn_nla_get_uin= t(struct nlattr *attr)
+ if (nla_len= (attr) =3D=3D sizeof(uint32_t))
+ {
+ = return nla_get_u32(attr);
+ }
+ = else
+ {<= br>+ return nla_get_u64(= attr);
+ }<= br>+}
+
+static void
+{
+ if (tb[OVPN_A_PEER_LINK_RX_BY= TES])
+ {+ c2->dco_read_byte= s =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
+ {
+ = __func__, id);
+ = }
+
+ if (tb[OVPN_A_PEER_LINK_TX_BYT= ES])
+ {+ c2->dco_write_byte= s =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);
<= span style=3D"color: hsl(120, 100%, 40%);">+ }
+ else
+ {
+ msg(M_WARN, "%s: no link TX bytes provided in reply for p= eer %u",
+ = __func__, id);
= + }
+
+ if (tb[OVPN_A_PEER_VPN_RX_BY= TES])
+ {+ c2->tun_read_byte= s =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, "%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_w= rite_bytes: " counter_format, __func__,
+ c2->tun_write_bytes);
+ }
+ else
+ {
+ = __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),
+ ge= nlmsg_attrlen(gnlh, 0), NULL);
+
+ if (= !tb[OVPN_A_PEER])
+ = {
+ return N= L_SKIP;
+ }=
+
+ struct nlattr *tb_peer[OVPN_A_PEER_MAX + = 1];
+ nla_parse_ne= sted(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;
+ }
+
<= span style=3D"color: hsl(120, 100%, 40%);">+ struct multi_context *m =3D= arg;
+ uint32_t p= eer_id =3D nla_get_u32(tb_peer[OVPN_A_PEER_ID]);
+
+ if (peer_id >=3D m->max_clients || !m->instances[pee= r_id])
+ {<= br>+ 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 *gnl= h =3D nlmsg_data(nlmsg_hdr(msg));
+
+ m= sg(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_PEE= R_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_PEE= R_ID]);
+ if (c-&g= t;c2.tls_multi->dco_peer_id !=3D peer_id)
+ {
+ return NL_SKIP;
+ }
= +
+ dco_update_pee= r_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_ms= g *msg, void *arg)
@@ -994,112 +1138,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
- {
- retu= rn nla_get_u64(attr);
-= }
-}
-
-static void
-dco_update_peer_stat(struct context_2 *c2, struct nlattr *tb[], uin= t32_t id)
-{
= - if (tb[OVPN_A_PEER_LINK_RX_B= YTES])
- {- c2->dco_read_bytes = =3D ovpn_nla_get_uint(tb[OVPN_A_PEER_LINK_RX_BYTES]);
- msg(D_DCO_DEBUG, "%s / dco_rea= d_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_BYTES]);
- msg(D_DCO_DEBUG, "%s / dco_write_bytes: " counter= _format, __func__,
- = c2->dco_write_bytes);
- }
- = else
- {
<= span style=3D"color: hsl(0, 100%, 40%);">- 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_BYTE= S]);
- msg(D_DCO= _DEBUG, "%s / tun_read_bytes: " counter_format, __func__,<= br>- c2->tun_read_b= ytes);
- }- else
- {
- msg(M_WARN, "%s: no VPN RX bytes provided in r= eply 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_wri= te_bytes: " counter_format, __func__,
- c2->tun_write_bytes);
- }
- else
- {
- m= sg(M_WARN, "%s: no VPN TX bytes provided in reply for peer %u",
- __func__, i= d);
- }
-}

-
-= int
-dco_parse_peer_mul= ti(struct nl_msg *msg, void *arg)
-{
- stru= ct 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])
- {
- }
-
= - struct nlattr *tb_peer[OVPN_= A_PEER_MAX + 1];
- n= la_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 rep= ly", __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_pe= er_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)
@@ -1124,44 +1162= ,6 @@
return ret;
}
=
-static int
= -dco_parse_peer(struct nl_msg *ms= g, void *arg)
-{=
- struct context *c =3D ar= g;
- struct nlattr *= tb[OVPN_A_MAX + 1];
- = struct genlmsghdr *gnlh =3D nlmsg_data(nlmsg_hdr(msg));
-
- msg(D_DCO_DEBUG, "%s: parsing message...", __f= unc__);
-
- nla_parse(tb, OVPN_A_MAX, genlm= sg_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_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;
- }
-
= - uint32_t peer_id =3D nla_get_u32(tb_peer[OVPN_A_PEER_ID]);
<= span style=3D"color: hsl(0, 100%, 40%);">- if (c->c2.tls_multi->dc= o_peer_id !=3D peer_id)
- {
- return= NL_SKIP;
- }=
-
- dco_update_peer_stat(&c->c2, tb_peer, = peer_id);
-
<= span style=3D"color: hsl(0, 100%, 40%);">- return NL_OK;
-}
-
int
dco_get_peer_stats= (struct context *c, const bool raise_sigusr1_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: 1
Gerrit-Owner: ordex <antonio@...2726...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--PzsQWWitjAA=--