negan07 / ancistrus

Netgear's D7000 Nighthawk Router Experience Distributed Project
https://negan07.github.io/ancistrus/
GNU General Public License v2.0
66 stars 17 forks source link

Samba package updated with SMB v2 support missed for USB devices #54

Closed tomtomek9 closed 3 years ago

tomtomek9 commented 5 years ago

Would it be possible to have a look into enabling SMBv2 support for readyshare USB storage option for the Netgear D7000?

negan07 commented 4 years ago

the samba version used is very customized 3.0.22 isn't it already enabled as default ?

tomtomek9 commented 4 years ago

Can you check if you can successfully share an usb storage?

Regards, Tom

Sent from my mobile phone

On 10 Oct 2019, at 22:55, negan07 notifications@github.com wrote:

 the samba version used is very customized 3.0.22 isn't it already enabled as default ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

negan07 commented 4 years ago

I actually have 2 storage usb devices in the 2 usb ports locally shared between win ios android unix systems without any problems

smbv2 should be already enabled (not the same for smbv3 maybe due to the old version)

you could try to enforce the min version editing /etc/samba/smb.conf adding under [global] stage the option: protocol = SMB2

then save the conf kill and re run manually smb daemon:

killall -9 smbd
killall -9 nmbd
smbd -D -P 19
nmbd -D -P 19
tomtomek9 commented 4 years ago

I might be doing something wrong but with Telnet connection I cannot see samba under /etc. When trying to connect via WinSCP I am getting access denied. Maybe I am just doing something 'lame' but please assist if possible.

On Fri, Oct 11, 2019 at 8:56 PM negan07 notifications@github.com wrote:

I actually have 2 storage usb devices in the 2 usb ports locally shared between win ios android unix systems without any problems

smbv2 should be already enabled (not the same for smbv3 maybe due to the old version)

you could try to enforce the min version editing /etc/samba/smb.conf adding under [global] stage the option: min version SMBV2

then save the conf kill and re run manually smb daemon:

killall -9 smbd killall -9 nmbd smbd -D -P 19 nmbd -D -P 19

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/negan07/ancistrus/issues/54?email_source=notifications&email_token=AMNJ5O6IYW5LZQJNRYKKXZTQODK7TA5CNFSM4H2RZTWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBBBVSA#issuecomment-541203144, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMNJ5O2C35V2ENS7KMI24HTQODK7TANCNFSM4H2RZTWA .

negan07 commented 4 years ago

can't telnet with scp, just ssh samba conf is under /tmp/etc/samba/smb.conf /etc is a symlink of /tmp/etc mounted as ramdisk

tomtomek9 commented 4 years ago

When I telnet with putty there is nothing under samba folder. I cannot connect via SSH (putty or WinSCP) as it is giving me access denied.

On Sun, Oct 13, 2019 at 10:11 PM negan07 notifications@github.com wrote:

can't telnet with scp, just ssh samba conf is under /tmp/etc/samba/smb.conf /etc is a symlink of /tmp/etc mounted as ramdisk

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/negan07/ancistrus/issues/54?email_source=notifications&email_token=AMNJ5O2OWVYMV2R6UOML2H3QOOFGVA5CNFSM4H2RZTWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBDANQI#issuecomment-541460161, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMNJ5O7X5ZBTK7WT62EC65TQOOFGVANCNFSM4H2RZTWA .

tomtomek9 commented 4 years ago

Found it under /etc/samba.conf/smb.conf

negan07 commented 4 years ago

/etc/samba.conf/smb.conf is the default one with DG834GVU workgroup name

the one created from the readyshare usb webpage options is under /tmp/etc/samba/smb.conf samba service must be configured and enabled before from the web gui

negan07 commented 4 years ago

any news about ?

tomtomek9 commented 4 years ago

I have made the changes to the config. It still does not work with the suggested amendments. Thing is, my systems have SMBv1 disabled by default. Any other suggestions?

negan07 commented 4 years ago

router's samba should work with v2 without problems

try to setup on router advanced menu readyshare and look if the disk is mounted properly with related shared dirs

besides the first method try also to enable http access and see if it's visible

tomtomek9 commented 4 years ago

I have set this up on the advanced menu and I can browse to the USB through the router interface, when selecting folders to share. I can also access the share via http.

Still, with system with disabled SMBv1 I cannot browse to it.

tomtomek9 commented 4 years ago

I believe on newer routers the SMB v2 is an option to be enabled form the advanced menu. Nevertheless, the issue seems to be with Netbios and Network Discovery. More details here: https://community.netgear.com/t5/Nighthawk-WiFi-Routers/SMB2-Support-for-R7300-Nighthawk-Readyshare/m-p/1659948/highlight/true

negan07 commented 4 years ago

upgrading/changing samba inside the router will bring non desirable effects (web gui, genie, cloud, etc strictly depend on it)

the safest thing to do is: running smbd & nmbd manually with different configuration like protocol = SMB2

or trying temporary to run an updated recompiled version to test the differences

tomtomek9 commented 4 years ago

Min version does not resolve this issue, as I have already stated earlier. Would there be a chance to have the image built with samba code of another router that has had it updated as this is visible here: image https://community.netgear.com/t5/General-WiFi-Routers-Non/ReadyShare-SMB1-Error/m-p/1484250/highlight/true

negan07 commented 4 years ago

R9000 has samba branch version 4 installed while D7000 has branch version 3 this is probably the difference

last fw source are available if it shares the same genie interface maybe samba could have a chance to be exported without losing compatibility, but I don't believe it..

can try to compile a 3.6.25 (lede patch fixes) and running manually to see if it fixes the issues related the same for 4.9.13 from openwrt

tomtomek9 commented 4 years ago

If you could implement the newer samba version for testing that would be great!

Regards, Tom

Sent from my mobile phone

On 1 Nov 2019, at 23:39, negan07 notifications@github.com wrote:

 R9000 has samba branch version 4 installed while D7000 has branch version 3 this is probably the difference

last fw source are available if it shares the same genie interface maybe samba could have a chance to be exported without losing compatibility, but I don't believe it..

can try to compile a 3.6.25 (lede patch fixes) and running manually to see if it fixes the issues related the same for 4.9.13 from openwrt

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

negan07 commented 4 years ago

to mantain retrocompatibility with sercomm/netgear devs specifics the newest possible version is 3.6.25 moving to 4 means to break this compatibility hoping this to be enough to fix the problem

samba-3.0.22-ng-diff.zip here's the diff code between orig samba 3.0.22 and netgear 3.0.22

tomtomek9 commented 4 years ago

According to release notes, 3.6.25 supports SMB v2 so that should be sufficient. Do you think you will be able to compile the image with the new version?

negan07 commented 4 years ago

yes it requires some work & test but it should

strange is that 3.0.22 actually doesn't..

negan07 commented 4 years ago

The above updated samba version 3.6.25 looking good

Setting up protocol = SMB2 on smb config, samba Dialect has moved from 1.5 of original 3.0.22 to 2.0.2 satisfying the SMB version upgrade request.

So the problem seems to be fixed: now smbd code needs required adaptations to match netgear's specs like lower cpu priority, passwd & directories, ...

Moreover a way must be found to reduce very huge binary code size (10-12Mb)...

tomtomek9 commented 4 years ago

Do you think you will be able to compile it with the firmware?

negan07 commented 4 years ago

using samba_multicall binary (embedding nmbd smbd smbpasswd ) size is 7.3mb, removing about 1,5mb of libntpass and 1,6mb of old samba binaries (smbstatus seems to be orphan), and all the smb conf bak & templates (some clusters saved):

7,3mb-3,1mb~=4,2mb of overhead

as monolithic, rootfs partition space could be enough but it could give some troubles with subsequent package upgrades or modifications

tomtomek9 commented 4 years ago

Hi negan07. Do you think you will be able to compile a new firmware with the updated samba or will that be a manual process of replacing the old version?

negan07 commented 3 years ago

package created

samba_3.6.25_armD7000.zip extract from .zip & install the ipk

or from repo: opkg update && opkg install samba

samba-3.6.25 recompiled & adapted for retrocompatibility added some tune settings on smb.conf: SMB2 protocol, enlarged send/receive buffers, optimization for small files, sendfile() func enabled

not tiny in size so test them carefully only with at least 80% of free root space remaining

/etc/samba/smb.conf has been edited with some modifications: dos charset = cp866 in place of dos charset = utf8 socket options = TCP_NODELAY SO_KEEPALIVE SO_SNDBUF=131072 SO_RCVBUF=131072 in place of socket options = TCP_NODELAY SO_KEEPALIVE SO_SNDBUF=65535 SO_RCVBUF=65535 and adding:

protocol = SMB2
min receivefile size = 16384
use sendfile = yes

console debug:

rc_smb stop && killall -9 nmbd
nmbd -F -S -d 99
smbd -F -S -d 99

each nmbd & smbdmust be run on separated console monitors

revert back to original with samba_3.0.22_armD7000.ipk (extract & install it) samba_ng_3.0.22_armD7000.zip