我试图将远程桌面设置成一个Debian扩展发行版,我设置了文件/etc/gdm3/daemon.conf。
[daemon]
WaylandEnable = false
[security]
DisallowTCP = false
[xdmcp]
Enable = true
Port = 177
[chooser]
[debug]
# Uncomment the line below to turn on debugging
# More verbose logs
# Additionally lets the X server dump core if it crashes
Enable = true但是,当我重新启动debian系统时,我在netstat上看到了以下输出:
udp6 0 0 :::177 :::* 11059/gdm3 这是使用udp6而不是udp4。
我尝试将inet6禁用到系统中,并将以下行设置为/etc/sysctl.conf:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1我用sysctl -p刷新设置,用sudo init 3; sudo unit 5重新启动服务,但是没有什么变化。我甚至重新启动了VM,并且仍然是一样的。
你知道我怎么能强迫xdcmp去监听UDP v4而不是udp6吗??提前谢谢。
我这样做是为了找出另一台具有相同linux发行版的机器所需的设置,在该计算机中,我希望设置对桌面的远程访问(因此,我将得到相同的问题)。实际上,我可以使用xvnc访问另一个主机,但我希望设置xdmcp,以便在远程访问时请求登录。
我正在运行的系统是:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.4 (stretch)
Release: 9.4
Codename: stretch
$ apt-cache show gdm3
Package: gdm3
Version: 3.22.3-3+deb9u1
. . .发布于 2018-06-02 14:22:44
我想我已经找到了对我的问题的答复。我已经下载了gdm3的源代码,我已经找到了为xdmcp设置套接字的位置。
static gboolean
open_port (GdmXdmcpDisplayFactory *factory)
{
struct sockaddr_storage serv_sa = { 0 };
g_debug ("GdmXdmcpDisplayFactory: Start up on host %s, port %d",
factory->priv->hostname ? factory->priv->hostname : "(null)",
factory->priv->port);
/* Open socket for communications */
#ifdef ENABLE_IPV6
factory->priv->socket_fd = do_bind (factory->priv->port, AF_INET6, &serv_sa);
if (factory->priv->socket_fd < 0)
#endif
factory->priv->socket_fd = do_bind (factory->priv->port, AF_INET, &serv_sa);
if G_UNLIKELY (factory->priv->socket_fd < 0) {
g_warning (_("Could not create socket!"));
return FALSE;
}
fd_set_close_on_exec (factory->priv->socket_fd);
if (factory->priv->use_multicast) {
setup_multicast (factory);
}
return TRUE;
}这里可以看到,如果包是为支持IP6而构建的,并且绑定操作正确完成,则套接字将只侦听UDP6,而不是UDP4。
解决方案应该是在没有IP6支持的情况下重新构建包,或者修改源代码,以便包含一个新的参数来启用/禁用文件/etc/gdm3/daemon.conf中的IP6。
更新了评论中的更多信息。
static int
create_socket (struct addrinfo *ai)
{
int sock;
sock = socket (ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (sock < 0) {
g_warning ("socket: %s", g_strerror (errno));
return sock;
}
#if defined(ENABLE_IPV6) && defined(IPV6_V6ONLY)
if (ai->ai_family == AF_INET6) {
int zero = 0;
if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &zero, sizeof(zero)) < 0)
g_warning("setsockopt(IPV6_V6ONLY): %s", g_strerror(errno));
}
#endif
if (bind (sock, ai->ai_addr, ai->ai_addrlen) < 0) {
g_warning ("bind: %s", g_strerror (errno));
close (sock);
return -1;
}
return sock;
}我们可以在proc文件系统中看到以下内容:
$ cat /proc/sys/net/ipv6/bindv6only
0因此,它看上去没有双重绑定。这应该是因为定义了IPV6_V6ONLY。
在没有ip6支持的情况下重新构建包之后:
udp 0 0 0.0.0.0:177 0.0.0.0:* - https://unix.stackexchange.com/questions/447487
复制相似问题