Netgear / wsdd2

WSD/LLMNR Discovery/Name Service Daemon
GNU General Public License v3.0
154 stars 33 forks source link

Windows 11 disappears for a long time Samba #36

Open qiuzi opened 2 years ago

qiuzi commented 2 years ago

On openwrt run /usr/bin/wsdd2 -i br-lan -N Echo -G WORKGROUP -b vendor:to-be-filled-by-oem-to-be-filled-by-oem,model:To_be_filled_by_O.EM _To_be_filled_by_O.EM I use windows 11 to start wsdd2 and can find Samba in win11, after 10 minutes refresh File Explorer will disappear! Restarting win11 also fails to discover Samba. Can only be restored after restarting wsdd2 there is a problem after using this commit

Doosty commented 2 years ago

Same here for windows 10, openwrt samba. Only works for a short time after restarting wsdd2.

qiuzi commented 2 years ago

@Doosty I can use the 2020 source code to use samba normally, and it will not be able to continue to use after 2021

smaller09 commented 2 years ago

same here, I have two system runing wsdd2, one is debian 11 on arm, which did not have any problem, another is openwrt nightly on powerpc, that one had same problem as @qiuze mensioned. The icon of openwrt system would disappered after several minutes. And I google around and found that musl had change time_t to 64 bit. http://musl.libc.org/time64.html. that would be the reason.

qiuzi commented 2 years ago

@smaller09 is there a workable solution?

smaller09 commented 2 years ago

I tried to compile my own openwrt with glibc. the problem was still there. So it had nothing with musl. I will try to find out why.

smaller09 commented 2 years ago

I open wsdd as a single program use this /usr/bin/wsdd2 -i br-lan -N OPENWRT -G WORKGROUP -4 -w -W and when the icon disappear I receive this on console: wsd_recv: wsd_recv_action: connected_if: No error information

pesa1234 commented 2 years ago

OpenWRT 21.02.2 same issue, after some time wsdd2 stop, but process is still present and no log...

pesa1234 commented 2 years ago

same here, I have two system runing wsdd2, one is debian 11 on arm, which did not have any problem, another is openwrt nightly on powerpc, that one had same problem as @qiuze mensioned. The icon of openwrt system would disappered after several minutes. And I google around and found that musl had change time_t to 64 bit. http://musl.libc.org/time64.html. that would be the reason.

Hi, if you have a sqm restart or an openvpn restart the problem happen... This is the message of wsdd2: wsd_recv: wsd_recv_action: connected_if: No error information

levshutov commented 2 years ago

Done some debugging. It looks like "is_new_addr" function changes global "ifindex" variable to newly bridged interface. It should keep index of bridge itself. Edit1: It does the same for interfaces not in bridge.

2K-ZONE commented 2 years ago

I just came here while investigating this problem further I have now on an actual OpenWRT Snapshot. Just wondering on how to start some debugging of this.

Previously I used an OpenWRT Snapshot from last year or so with samba+wsdd2 in a docker container: https://github.com/ServerContainers/samba

In this container an ARCH wsdd2 package is delivered, which yields from source point of view to this repository also. This docker container and its wsdd2 ran for months flawlessly. I wonder, where could be the difference? The container was started in host network mode.

kimboslice99 commented 1 year ago

Same issues here

Sure would be nice to see a solution, but an 11 month old thread is disheartening

Lucky1openwrt commented 1 year ago

in file /etc/init.d/wsdd2 line 56 change from "network_get_device ifname lan" to "network_get_device ifname br-lan"

this seems to make it work corectly for me would love others to test this maybe it will help track down the fault

rikka0w0 commented 10 months ago

This still happens OpenWrt 22.03.5

rikka0w0 commented 10 months ago

Update 2023/12/20: For those who dont want to build their own package, here are my prebuild binaries, do not use if you dont trust me! Ramips (Tested on Netgear R6220, MT7621): wsdd2_2022-04-25-e37443ac-3_mipsel_24kc.zip

Marvell EBU Armada (Tested on Linksys WRT1900AC, Arm Cortex a9): wsdd2_2022-04-25-e37443ac-3_arm_cortex-a9_vfpv3-d16.zip

Original Post:

To fix this problem on OpenWrt, for now, you will need to compile your own wsdd2 opkg package. Here are steps:

# Download and update the sources
git clone https://git.openwrt.org/openwrt/openwrt.git
cd openwrt
git pull

# Select a specific code revision
git branch -a
git tag
git checkout v21.02.3

# Update the feeds
./scripts/feeds update -a
./scripts/feeds install -a

# Configure the firmware image
make menuconfig

Choose the arch and target, then select wsdd (Under Network -> IP Addresses and Names).

make -j$(nproc) tools/install
make -j$(nproc) toolchain/install

mkdir feeds/packages/net/wsdd2/patches/
wget https://raw.githubusercontent.com/openwrt/packages/3818766a2eff5ee05251e0ed9159536e1cf1c08a/net/wsdd2/patches/010-wsdd-upstream-pr46.patch

make -j$(nproc) package/wsdd2/{clean,compile}
make package/index V=s

Ignore the error thrown by make package/index V=s. Now you can find the patched wsdd2 opkg package at bin/packages/<arch>/packages/wsdd2_2022-04-25-e37443ac-3_arm_cortex-a9_vfpv3-d16.ipk, where is your target arch, and the ipk file name can vary.

Before installing this new package, make sure you uninstall the stock wsdd2 from OpenWrt. Then, use sftp or whatever you like to upload the file to OpenWrt (e.g. /tmp). Finally, use opkg install /tmp/wsdd2_2022-04-25-e37443ac-3_arm_cortex-a9_vfpv3-d16.ipk to install the package, and you are good to go!

This patch will no longer be needed once #46 is merged by WSDD2 or OpenWrt.

See also: https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem https://openwrt.org/docs/guide-developer/toolchain/single.package https://openwrt.org/docs/guide-developer/toolchain/use-patches-with-buildsystem https://openwrt.org/docs/guide-developer/helloworld/chapter7 https://openwrt.org/submitting-patches

sppmasterspp commented 10 months ago

To fix this problem on OpenWrt, for now, you will need to compile your own wsdd2 opkg package.

I've used the instructions from the post to compile the wsdd2 package (wsdd2_2022-04-25-e37443ac-3_aarch64_cortex-a53.ipk) with the new patch and installed it on the router. It was working for several hours till the Windows 11 went to sleep. Unfortunately upon waking up there are no ksmbd shares in Windows 11->File Explorer->Network. I've restarted wsdd2 and will try to watch when exactly it disappears from File Explorer but most probably the reason is wsdd2 itself, not the sleeping state of Windows. Is any more info needed to investigate this further?

sppmasterspp commented 10 months ago

I've just turned on my Win 11 Laptop and what I see is that I cannot see any shares from the router (wsdd2) but I see all other network shares from a Win 11 Desktop PC. At the same time router USB shares are available in Network of the Win 11 Desktop PC. Really weird.

rikka0w0 commented 10 months ago

I've used the instructions from the post to compile the wsdd2 package (wsdd2_2022-04-25-e37443ac-3_aarch64_cortex-a53.ipk) with the new patch and installed it on the router. It was working for several hours till the Windows 11 went to sleep.

46 fixed my problem, and I haven't seen this problem for a week, even after several restarts, shutdowns, sleep, and lost of network connections. I'm also running the latest Windows 11. Here is my ipk package:

wsdd2_2022-04-25-e37443ac-3_arm_cortex-a9_vfpv3-d16.zip

sppmasterspp commented 10 months ago

To fix this problem on OpenWrt, for now, you will need to compile your own wsdd2 opkg package.

I've used the instructions from the post to compile the wsdd2 package (wsdd2_2022-04-25-e37443ac-3_aarch64_cortex-a53.ipk) with the new patch and installed it on the router. It was working for several hours till the Windows 11 went to sleep. Unfortunately upon waking up there are no ksmbd shares in Windows 11->File Explorer->Network. I've restarted wsdd2 and will try to watch when exactly it disappears from File Explorer but most probably the reason is wsdd2 itself, not the sleeping state of Windows. Is any more info needed to investigate this further?

New update. I've recompiled my firmware, then installed the patched wsdd2 package, rebooted the router and now 48 hours later it is still working. All Windows machines can access the shares and they don't disappear.

One glitch still remains though. I had to restart the WAN6 interface (because of IPv6 issue) and the shares disappeared. Restarting wsdd2 recovered them. So for now I continue watching and will report if I find anything else.

sppmasterspp commented 10 months ago

Now I've simply compiled this OpenWrt PR from GitHub. I've applied it as a patch to my local repository before compiling the firmware for my QNAP. This way the patch fixed wsdd2 package is built-in into the firmware image. Finally It's working as it should right from the boot. Running for 80+ hours. It's fully operational (nothing disappears anymore) on all Windows PCs and even on Android phones (I use Total Commander for Android with its LAN plugin to access SMB Windows shares).