Lines Matching refs:netdev

34 static void wireguard_resolve_endpoints(NetDev *netdev);
110 static int wireguard_set_ipmask_one(NetDev *netdev, sd_netlink_message *message, const WireguardIPm… in wireguard_set_ipmask_one() argument
137 return log_netdev_error_errno(netdev, r, "Could not add wireguard allowed ip: %m"); in wireguard_set_ipmask_one()
144 …return log_netdev_error_errno(netdev, r, "Could not cancel wireguard allowed ip message attribute:… in wireguard_set_ipmask_one()
149 static int wireguard_set_peer_one(NetDev *netdev, sd_netlink_message *message, const WireguardPeer … in wireguard_set_peer_one() argument
196 r = wireguard_set_ipmask_one(netdev, message, mask, ++j); in wireguard_set_peer_one()
207 return log_netdev_error_errno(netdev, r, "Could not add wireguard allowed ip: %m"); in wireguard_set_peer_one()
211 return log_netdev_error_errno(netdev, r, "Could not add wireguard peer: %m"); in wireguard_set_peer_one()
219 return log_netdev_error_errno(netdev, r, "Could not cancel wireguard peers: %m"); in wireguard_set_peer_one()
224 static int wireguard_set_interface(NetDev *netdev) { in wireguard_set_interface() argument
233 assert(netdev); in wireguard_set_interface()
234 w = WIREGUARD(netdev); in wireguard_set_interface()
242 … r = sd_genl_message_new(netdev->manager->genl, WG_GENL_NAME, WG_CMD_SET_DEVICE, &message); in wireguard_set_interface()
244 … return log_netdev_error_errno(netdev, r, "Failed to allocate generic netlink message: %m"); in wireguard_set_interface()
246 r = sd_netlink_message_append_string(message, WGDEVICE_A_IFNAME, netdev->ifname); in wireguard_set_interface()
248 … return log_netdev_error_errno(netdev, r, "Could not append wireguard interface name: %m"); in wireguard_set_interface()
253 … return log_netdev_error_errno(netdev, r, "Could not append wireguard private key: %m"); in wireguard_set_interface()
257 … return log_netdev_error_errno(netdev, r, "Could not append wireguard port: %m"); in wireguard_set_interface()
261 … return log_netdev_error_errno(netdev, r, "Could not append wireguard fwmark: %m"); in wireguard_set_interface()
265 … return log_netdev_error_errno(netdev, r, "Could not append wireguard flags: %m"); in wireguard_set_interface()
270 … return log_netdev_error_errno(netdev, r, "Could not append wireguard peer attributes: %m"); in wireguard_set_interface()
274 r = wireguard_set_peer_one(netdev, message, peer, ++i, &mask_start); in wireguard_set_interface()
286 … return log_netdev_error_errno(netdev, r, "Could not close wireguard container: %m"); in wireguard_set_interface()
288 r = sd_netlink_send(netdev->manager->genl, message, &serial); in wireguard_set_interface()
290 … return log_netdev_error_errno(netdev, r, "Could not set wireguard device: %m"); in wireguard_set_interface()
300 NetDev *netdev; in on_resolve_retry() local
305 netdev = NETDEV(peer->wireguard); in on_resolve_retry()
307 if (!netdev_is_managed(netdev)) in on_resolve_retry()
336 NetDev *netdev; in wireguard_peer_resolve_handler() local
342 netdev = NETDEV(peer->wireguard); in wireguard_peer_resolve_handler()
344 if (!netdev_is_managed(netdev)) in wireguard_peer_resolve_handler()
348 log_netdev_warning(netdev, "Failed to resolve host '%s:%s', ignoring: %s", in wireguard_peer_resolve_handler()
362 (void) wireguard_set_interface(netdev); in wireguard_peer_resolve_handler()
369 …log_netdev_warning(netdev, "Neither IPv4 nor IPv6 address found for peer endpoint %s:%s, ignoring … in wireguard_peer_resolve_handler()
376 r = event_reset_time_relative(netdev->manager->event, in wireguard_peer_resolve_handler()
382 …log_netdev_warning_errno(netdev, r, "Could not arm resolve retry handler for endpoint %s:%s, ignor… in wireguard_peer_resolve_handler()
386 wireguard_resolve_endpoints(netdev); in wireguard_peer_resolve_handler()
396 NetDev *netdev; in peer_resolve_endpoint() local
402 netdev = NETDEV(peer->wireguard); in peer_resolve_endpoint()
416 r = sd_resolve_getaddrinfo(netdev->manager->resolve, in peer_resolve_endpoint()
424 return log_netdev_full_errno(netdev, r == -ENOBUFS ? LOG_DEBUG : LOG_WARNING, r, in peer_resolve_endpoint()
431 static void wireguard_resolve_endpoints(NetDev *netdev) { in wireguard_resolve_endpoints() argument
434 assert(netdev); in wireguard_resolve_endpoints()
435 w = WIREGUARD(netdev); in wireguard_resolve_endpoints()
444 static int netdev_wireguard_post_create(NetDev *netdev, Link *link) { in netdev_wireguard_post_create() argument
445 assert(netdev); in netdev_wireguard_post_create()
446 assert(WIREGUARD(netdev)); in netdev_wireguard_post_create()
448 (void) wireguard_set_interface(netdev); in netdev_wireguard_post_create()
449 wireguard_resolve_endpoints(netdev); in netdev_wireguard_post_create()
892 NetDev *netdev = userdata; in config_parse_wireguard_route_table() local
907 r = manager_get_route_table_from_string(netdev->manager, rvalue, table); in config_parse_wireguard_route_table()
931 NetDev *netdev = userdata; in config_parse_wireguard_peer_route_table() local
938 assert(netdev); in config_parse_wireguard_peer_route_table()
939 assert(netdev->manager); in config_parse_wireguard_peer_route_table()
941 w = WIREGUARD(netdev); in config_parse_wireguard_peer_route_table()
961 r = manager_get_route_table_from_string(netdev->manager, rvalue, &peer->route_table); in config_parse_wireguard_peer_route_table()
1055 static void wireguard_init(NetDev *netdev) { in wireguard_init() argument
1058 assert(netdev); in wireguard_init()
1059 w = WIREGUARD(netdev); in wireguard_init()
1065 static void wireguard_done(NetDev *netdev) { in wireguard_done() argument
1068 assert(netdev); in wireguard_done()
1069 w = WIREGUARD(netdev); in wireguard_done()
1107 NetDev *netdev = NETDEV(peer->wireguard); in wireguard_peer_verify() local
1114 return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL), in wireguard_peer_verify()
1121 return log_netdev_error_errno(netdev, r, in wireguard_peer_verify()
1130 static int wireguard_verify(NetDev *netdev, const char *filename) { in wireguard_verify() argument
1134 assert(netdev); in wireguard_verify()
1135 w = WIREGUARD(netdev); in wireguard_verify()
1140 return log_netdev_error_errno(netdev, r, in wireguard_verify()
1145 return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL), in wireguard_verify()