• Home
  • Raw
  • Download

Lines Matching refs:wg

34 	struct wg_device *wg = netdev_priv(dev);  in wg_open()  local
49 mutex_lock(&wg->device_update_lock); in wg_open()
50 ret = wg_socket_init(wg, wg->incoming_port); in wg_open()
53 list_for_each_entry(peer, &wg->peer_list, peer_list) { in wg_open()
59 mutex_unlock(&wg->device_update_lock); in wg_open()
67 struct wg_device *wg; in wg_pm_notification() local
81 list_for_each_entry(wg, &device_list, device_list) { in wg_pm_notification()
82 mutex_lock(&wg->device_update_lock); in wg_pm_notification()
83 list_for_each_entry(peer, &wg->peer_list, peer_list) { in wg_pm_notification()
88 mutex_unlock(&wg->device_update_lock); in wg_pm_notification()
100 struct wg_device *wg = netdev_priv(dev); in wg_stop() local
104 mutex_lock(&wg->device_update_lock); in wg_stop()
105 list_for_each_entry(peer, &wg->peer_list, peer_list) { in wg_stop()
112 mutex_unlock(&wg->device_update_lock); in wg_stop()
113 while ((skb = ptr_ring_consume(&wg->handshake_queue.ring)) != NULL) in wg_stop()
115 atomic_set(&wg->handshake_queue_len, 0); in wg_stop()
116 wg_socket_reinit(wg, NULL, NULL); in wg_stop()
122 struct wg_device *wg = netdev_priv(dev); in wg_xmit() local
136 peer = wg_allowedips_lookup_dst(&wg->peer_allowedips, skb); in wg_xmit()
228 struct wg_device *wg = netdev_priv(dev); in wg_destruct() local
231 list_del(&wg->device_list); in wg_destruct()
233 mutex_lock(&wg->device_update_lock); in wg_destruct()
234 rcu_assign_pointer(wg->creating_net, NULL); in wg_destruct()
235 wg->incoming_port = 0; in wg_destruct()
236 wg_socket_reinit(wg, NULL, NULL); in wg_destruct()
238 wg_peer_remove_all(wg); in wg_destruct()
239 destroy_workqueue(wg->handshake_receive_wq); in wg_destruct()
240 destroy_workqueue(wg->handshake_send_wq); in wg_destruct()
241 destroy_workqueue(wg->packet_crypt_wq); in wg_destruct()
242 wg_packet_queue_free(&wg->handshake_queue, true); in wg_destruct()
243 wg_packet_queue_free(&wg->decrypt_queue, false); in wg_destruct()
244 wg_packet_queue_free(&wg->encrypt_queue, false); in wg_destruct()
247 memzero_explicit(&wg->static_identity, sizeof(wg->static_identity)); in wg_destruct()
249 kvfree(wg->index_hashtable); in wg_destruct()
250 kvfree(wg->peer_hashtable); in wg_destruct()
251 mutex_unlock(&wg->device_update_lock); in wg_destruct()
261 struct wg_device *wg = netdev_priv(dev); in wg_setup() local
289 memset(wg, 0, sizeof(*wg)); in wg_setup()
290 wg->dev = dev; in wg_setup()
297 struct wg_device *wg = netdev_priv(dev); in wg_newlink() local
300 rcu_assign_pointer(wg->creating_net, src_net); in wg_newlink()
301 init_rwsem(&wg->static_identity.lock); in wg_newlink()
302 mutex_init(&wg->socket_update_lock); in wg_newlink()
303 mutex_init(&wg->device_update_lock); in wg_newlink()
304 wg_allowedips_init(&wg->peer_allowedips); in wg_newlink()
305 wg_cookie_checker_init(&wg->cookie_checker, wg); in wg_newlink()
306 INIT_LIST_HEAD(&wg->peer_list); in wg_newlink()
307 wg->device_update_gen = 1; in wg_newlink()
309 wg->peer_hashtable = wg_pubkey_hashtable_alloc(); in wg_newlink()
310 if (!wg->peer_hashtable) in wg_newlink()
313 wg->index_hashtable = wg_index_hashtable_alloc(); in wg_newlink()
314 if (!wg->index_hashtable) in wg_newlink()
321 wg->handshake_receive_wq = alloc_workqueue("wg-kex-%s", in wg_newlink()
323 if (!wg->handshake_receive_wq) in wg_newlink()
326 wg->handshake_send_wq = alloc_workqueue("wg-kex-%s", in wg_newlink()
328 if (!wg->handshake_send_wq) in wg_newlink()
331 wg->packet_crypt_wq = alloc_workqueue("wg-crypt-%s", in wg_newlink()
333 if (!wg->packet_crypt_wq) in wg_newlink()
336 ret = wg_packet_queue_init(&wg->encrypt_queue, wg_packet_encrypt_worker, in wg_newlink()
341 ret = wg_packet_queue_init(&wg->decrypt_queue, wg_packet_decrypt_worker, in wg_newlink()
346 ret = wg_packet_queue_init(&wg->handshake_queue, wg_packet_handshake_receive_worker, in wg_newlink()
359 list_add(&wg->device_list, &device_list); in wg_newlink()
372 wg_packet_queue_free(&wg->handshake_queue, false); in wg_newlink()
374 wg_packet_queue_free(&wg->decrypt_queue, false); in wg_newlink()
376 wg_packet_queue_free(&wg->encrypt_queue, false); in wg_newlink()
378 destroy_workqueue(wg->packet_crypt_wq); in wg_newlink()
380 destroy_workqueue(wg->handshake_send_wq); in wg_newlink()
382 destroy_workqueue(wg->handshake_receive_wq); in wg_newlink()
386 kvfree(wg->index_hashtable); in wg_newlink()
388 kvfree(wg->peer_hashtable); in wg_newlink()
401 struct wg_device *wg; in wg_netns_pre_exit() local
405 list_for_each_entry(wg, &device_list, device_list) { in wg_netns_pre_exit()
406 if (rcu_access_pointer(wg->creating_net) == net) { in wg_netns_pre_exit()
407 pr_debug("%s: Creating namespace exiting\n", wg->dev->name); in wg_netns_pre_exit()
408 netif_carrier_off(wg->dev); in wg_netns_pre_exit()
409 mutex_lock(&wg->device_update_lock); in wg_netns_pre_exit()
410 rcu_assign_pointer(wg->creating_net, NULL); in wg_netns_pre_exit()
411 wg_socket_reinit(wg, NULL, NULL); in wg_netns_pre_exit()
412 list_for_each_entry(peer, &wg->peer_list, peer_list) in wg_netns_pre_exit()
414 mutex_unlock(&wg->device_update_lock); in wg_netns_pre_exit()