Lines Matching refs:peer
31 struct wgpeer *peer; in userspace_set_device() local
55 for_each_wgpeer(dev, peer) { in userspace_set_device()
56 key_to_hex(hex, peer->public_key); in userspace_set_device()
58 if (peer->flags & WGPEER_REMOVE_ME) { in userspace_set_device()
62 if (peer->flags & WGPEER_HAS_PRESHARED_KEY) { in userspace_set_device()
63 key_to_hex(hex, peer->preshared_key); in userspace_set_device()
66 if (peer->endpoint.addr.sa_family == AF_INET || peer->endpoint.addr.sa_family == AF_INET6) { in userspace_set_device()
68 if (peer->endpoint.addr.sa_family == AF_INET) in userspace_set_device()
70 else if (peer->endpoint.addr.sa_family == AF_INET6) in userspace_set_device()
72 …if (!getnameinfo(&peer->endpoint.addr, addr_len, host, sizeof(host), service, sizeof(service), NI_… in userspace_set_device()
73 if (peer->endpoint.addr.sa_family == AF_INET6 && strchr(host, ':')) in userspace_set_device()
79 if (peer->flags & WGPEER_HAS_PERSISTENT_KEEPALIVE_INTERVAL) in userspace_set_device()
80 fprintf(f, "persistent_keepalive_interval=%u\n", peer->persistent_keepalive_interval); in userspace_set_device()
81 if (peer->flags & WGPEER_REPLACE_ALLOWEDIPS) in userspace_set_device()
83 for_each_wgallowedip(peer, allowedip) { in userspace_set_device()
141 struct wgpeer *peer = NULL; in userspace_get_device() local
175 if (!peer && !strcmp(key, "private_key")) { in userspace_get_device()
180 } else if (!peer && !strcmp(key, "listen_port")) { in userspace_get_device()
183 } else if (!peer && !strcmp(key, "fwmark")) { in userspace_get_device()
194 if (peer) in userspace_get_device()
195 peer->next_peer = new_peer; in userspace_get_device()
198 peer = new_peer; in userspace_get_device()
199 if (!key_from_hex(peer->public_key, value)) in userspace_get_device()
201 peer->flags |= WGPEER_HAS_PUBLIC_KEY; in userspace_get_device()
202 } else if (peer && !strcmp(key, "preshared_key")) { in userspace_get_device()
203 if (!key_from_hex(peer->preshared_key, value)) in userspace_get_device()
205 if (!key_is_zero(peer->preshared_key)) in userspace_get_device()
206 peer->flags |= WGPEER_HAS_PRESHARED_KEY; in userspace_get_device()
207 } else if (peer && !strcmp(key, "endpoint")) { in userspace_get_device()
238 memcpy(&peer->endpoint.addr, resolved->ai_addr, resolved->ai_addrlen); in userspace_get_device()
244 } else if (peer && !strcmp(key, "persistent_keepalive_interval")) { in userspace_get_device()
245 peer->persistent_keepalive_interval = NUM(0xffffU); in userspace_get_device()
246 peer->flags |= WGPEER_HAS_PERSISTENT_KEEPALIVE_INTERVAL; in userspace_get_device()
247 } else if (peer && !strcmp(key, "allowed_ip")) { in userspace_get_device()
261 peer->first_allowedip = new_allowedip; in userspace_get_device()
274 } else if (peer && !strcmp(key, "last_handshake_time_sec")) in userspace_get_device()
275 peer->last_handshake_time.tv_sec = NUM(0x7fffffffffffffffULL); in userspace_get_device()
276 else if (peer && !strcmp(key, "last_handshake_time_nsec")) in userspace_get_device()
277 peer->last_handshake_time.tv_nsec = NUM(0x7fffffffffffffffULL); in userspace_get_device()
278 else if (peer && !strcmp(key, "rx_bytes")) in userspace_get_device()
279 peer->rx_bytes = NUM(0xffffffffffffffffULL); in userspace_get_device()
280 else if (peer && !strcmp(key, "tx_bytes")) in userspace_get_device()
281 peer->tx_bytes = NUM(0xffffffffffffffffULL); in userspace_get_device()