-static int vxlan_rtnl_call(struct nl_msg *msg)
-{
- int ret;
-
- ret = nl_send_auto_complete(rtnl, msg);
- nlmsg_free(msg);
-
- if (ret < 0)
- return ret;
-
- return nl_wait_for_ack(rtnl);
-}
-
-static int
-vxlan_rtnl_init(void)
-{
- int fd, opt;
-
- if (rtnl)
- return 0;
-
- rtnl = nl_socket_alloc();
- if (!rtnl)
- return -1;
-
- if (nl_connect(rtnl, NETLINK_ROUTE))
- goto free;
-
- nl_socket_disable_seq_check(rtnl);
- nl_socket_set_buffer_size(rtnl, 65536, 0);
- nl_cb_err(nl_socket_get_cb(rtnl), NL_CB_CUSTOM, unetd_nl_error_cb, NULL);
-
- fd = nl_socket_get_fd(rtnl);
-
- opt = 1;
- setsockopt(fd, SOL_NETLINK, NETLINK_EXT_ACK, &opt, sizeof(opt));
-
- opt = 1;
- setsockopt(fd, SOL_NETLINK, NETLINK_CAP_ACK, &opt, sizeof(opt));
-
- return 0;
-
-free:
- nl_socket_free(rtnl);
- rtnl = NULL;
- return -1;
-}
-
-static uint32_t
-vxlan_tunnel_id(struct vxlan_tunnel *vt)
-{
- siphash_key_t key = {};
- const char *name = network_service_name(vt->s);
- uint64_t val;
-
- if (vt->vni != ~0)
- return vt->vni;
-
- siphash_to_le64(&val, name, strlen(name), &key);
-
- return val & 0x00ffffff;
-}
-