mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 09:38:06 +02:00
platform/wireguard: fix WGPEER_A_LAST_HANDSHAKE_TIME to use int64 typed timespec structure
The netlink API changed for WireGuard. Adjust for that. https://git.zx2c4.com/WireGuard/commit/?id=c870c7af53f44a37814dfc76ceb8ad88e290fcd8
This commit is contained in:
parent
7451a6a649
commit
4e399d82ac
2 changed files with 18 additions and 3 deletions
|
|
@ -2019,8 +2019,10 @@ _wireguard_update_from_peers_nla (CList *peers,
|
||||||
|
|
||||||
if (tb[WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL])
|
if (tb[WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL])
|
||||||
peer_c->data.persistent_keepalive_interval = nla_get_u16 (tb[WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL]);
|
peer_c->data.persistent_keepalive_interval = nla_get_u16 (tb[WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL]);
|
||||||
if (tb[WGPEER_A_LAST_HANDSHAKE_TIME])
|
if (tb[WGPEER_A_LAST_HANDSHAKE_TIME]) {
|
||||||
nla_memcpy (&peer_c->data.last_handshake_time, tb[WGPEER_A_LAST_HANDSHAKE_TIME], sizeof (peer_c->data.last_handshake_time));
|
if (nla_len (tb[WGPEER_A_LAST_HANDSHAKE_TIME]) >= sizeof (peer_c->data.last_handshake_time))
|
||||||
|
nla_memcpy (&peer_c->data.last_handshake_time, tb[WGPEER_A_LAST_HANDSHAKE_TIME], sizeof (peer_c->data.last_handshake_time));
|
||||||
|
}
|
||||||
if (tb[WGPEER_A_RX_BYTES])
|
if (tb[WGPEER_A_RX_BYTES])
|
||||||
peer_c->data.rx_bytes = nla_get_u64 (tb[WGPEER_A_RX_BYTES]);
|
peer_c->data.rx_bytes = nla_get_u64 (tb[WGPEER_A_RX_BYTES]);
|
||||||
if (tb[WGPEER_A_TX_BYTES])
|
if (tb[WGPEER_A_TX_BYTES])
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,18 @@ struct udev_device;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/* "struct __kernel_timespec" uses "long long", but we use gint64. In practice,
|
||||||
|
* these are the same types. */
|
||||||
|
G_STATIC_ASSERT (sizeof (long long) == sizeof (gint64));
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/* like "struct __kernel_timespec". */
|
||||||
|
gint64 tv_sec;
|
||||||
|
gint64 tv_nsec;
|
||||||
|
} NMPTimespec64;
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
struct sockaddr sa;
|
struct sockaddr sa;
|
||||||
struct sockaddr_in in;
|
struct sockaddr_in in;
|
||||||
|
|
@ -72,7 +84,8 @@ typedef struct {
|
||||||
typedef struct _NMPWireGuardPeer {
|
typedef struct _NMPWireGuardPeer {
|
||||||
NMSockAddrUnion endpoint;
|
NMSockAddrUnion endpoint;
|
||||||
|
|
||||||
struct timespec last_handshake_time;
|
NMPTimespec64 last_handshake_time;
|
||||||
|
|
||||||
guint64 rx_bytes;
|
guint64 rx_bytes;
|
||||||
guint64 tx_bytes;
|
guint64 tx_bytes;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue