<div dir="auto"><div class="gmail_quote" dir="auto"><div dir="ltr">Commit bc84ba3a inserted a peer version placeholder. Embeddable<br></div>
wireguard did not handle the flag WGPEER_A_PROTOCOL_VERSION and printed<br>
the following warning:<br>
<br>
Warning: one or more unrecognized netlink attributes<br>
<br>
This commit adds the field 'protocol_version' to the structure<br>
'wg_peer'. It is equal to 0 if no protocol version were defined.<br>
---<br>
contrib/examples/embeddable-wg-library/wireguard.c | 5 +++++<br>
contrib/examples/embeddable-wg-library/wireguard.h | 1 +<br>
2 files changed, 6 insertions(+)<br>
<br>
diff --git a/contrib/examples/embeddable-wg-library/wireguard.c<br>
b/contrib/examples/embeddable-wg-library/wireguard.c<br>
index f0bdb5f..9610c50 100644<br>
--- a/contrib/examples/embeddable-wg-library/wireguard.c<br>
+++ b/contrib/examples/embeddable-wg-library/wireguard.c<br>
@@ -66,6 +66,7 @@ enum wgpeer_attribute {<br>
WGPEER_A_RX_BYTES,<br>
WGPEER_A_TX_BYTES,<br>
WGPEER_A_ALLOWEDIPS,<br>
+ WGPEER_A_PROTOCOL_VERSION,<br>
__WGPEER_A_LAST<br>
};<br>
<br>
@@ -1326,6 +1327,10 @@ static int parse_peer(const struct nlattr<br>
*attr, void *data)<br>
break;<br>
case WGPEER_A_ALLOWEDIPS:<br>
return mnl_attr_parse_nested(attr, parse_allowedips, peer);<br>
+ case WGPEER_A_PROTOCOL_VERSION:<br>
+ if (!mnl_attr_validate(attr, MNL_TYPE_U32))<br>
+ peer->protocol_version = mnl_attr_get_u32(attr);<br>
+ break;<br>
default:<br>
warn_unrecognized("netlink");<br>
}<br>
diff --git a/contrib/examples/embeddable-wg-library/wireguard.h<br>
b/contrib/examples/embeddable-wg-library/wireguard.h<br>
index e9210a4..2cee9ac 100644<br>
--- a/contrib/examples/embeddable-wg-library/wireguard.h<br>
+++ b/contrib/examples/embeddable-wg-library/wireguard.h<br>
@@ -49,6 +49,7 @@ typedef struct wg_peer {<br>
struct timespec last_handshake_time;<br>
uint64_t rx_bytes, tx_bytes;<br>
uint16_t persistent_keepalive_interval;<br>
+ uint32_t protocol_version;<br>
<br>
struct wg_allowedip *first_allowedip, *last_allowedip;<br>
struct wg_peer *next_peer;<br>
--<br>
2.19.2<br>
</div></div>