- From 2dcf3e2806282633000d55e626ba4526c86dc077 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Thu, 27 Feb 2025 13:13:50 +0100
- Subject: [PATCH 1/2] sys: Implement |FileNormalizedNameInformation|
- Implement support for |FileNormalizedNameInformation|, assuming we do
- not build 8.3 filename support (which we do not have) and the exported
- NFS filesystem is case-sensitive.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41sys_fileinfo.c | 60 +++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 60 insertions(+)
- diff --git a/sys/nfs41sys_fileinfo.c b/sys/nfs41sys_fileinfo.c
- index 5f59d7d..c8ae273 100644
- --- a/sys/nfs41sys_fileinfo.c
- +++ b/sys/nfs41sys_fileinfo.c
- @@ -220,6 +220,66 @@ NTSTATUS nfs41_QueryFileInformation(
- #endif
- switch (InfoClass) {
- +#ifdef NFS41_DRIVER_DISABLE_8DOT3_SHORTNAME_GENERATION
- + /*
- + * |FileNormalizedNameInformation| is specified to return an
- + * absolute pathname where each short name component (e.g. 8.3
- + * file name) has been replaced with the corresponding long
- + * name component, and each name component uses the exact
- + * letter casing stored on disk.
- + *
- + * So if we do not support 8.3 names (i.e.
- + * |NFS41_DRIVER_DISABLE_8DOT3_SHORTNAME_GENERATION| being
- + * defined) and the exported NFS filesystem is case-sensitive,
- + * then just handle |FileNormalizedNameInformation| like
- + * |FileNameInformation|.
- + */
- + case FileNormalizedNameInformation:
- + {
- + ULONG fsattrs = pVNetRootContext->FsAttrs.FileSystemAttributes;
- +
- + /*
- + * FIXME: If the underlying filesystem is case-insensitive we
- + * would have to make an upcall to fetch the exact casing
- + * from our namecache or the NFS server.
- + */
- + if ((fsattrs & FILE_CASE_SENSITIVE_SEARCH) == 0) {
- + print_error("nfs41_QueryFileInformation: "
- + "FileNormalizedNameInformation not supported for "
- + "case-insensitive filesystems\n");
- + status = STATUS_NOT_SUPPORTED;
- + goto out;
- + }
- +
- + if (RxContext->Info.LengthRemaining <
- + FIELD_OFFSET(FILE_NAME_INFORMATION, FileName)) {
- + RxContext->Info.Length = 0;
- + status = STATUS_BUFFER_OVERFLOW;
- + goto out;
- + }
- +
- + PFILE_NAME_INFORMATION nameinfo =
- + (PFILE_NAME_INFORMATION)RxContext->Info.Buffer;
- + RxContext->Info.LengthRemaining -=
- + FIELD_OFFSET(FILE_NAME_INFORMATION, FileName);
- +
- + RxConjureOriginalName((PFCB)RxContext->pFcb,
- + (PFOBX)RxContext->pFobx,
- + &nameinfo->FileNameLength,
- + &nameinfo->FileName[0],
- + &RxContext->Info.Length,
- + VNetRoot_As_UNC_Name);
- +
- + if (RxContext->Info.LengthRemaining < 0) {
- + RxContext->Info.Length = 0;
- + status = STATUS_BUFFER_OVERFLOW;
- + goto out;
- + }
- +
- + status = STATUS_SUCCESS;
- + goto out;
- + }
- +#endif /* NFS41_DRIVER_DISABLE_8DOT3_SHORTNAME_GENERATION */
- case FileEaInformation:
- {
- if (RxContext->Info.LengthRemaining <
- --
- 2.45.1
- From a8c2d216b63d80e03c76d5f957716cb4f40ae385 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Thu, 27 Feb 2025 14:28:39 +0100
- Subject: [PATCH 2/2] cygwin: Add msnfs41client subcmd "watch_nfs_traffic" to
- watch NFS traffic
- Add msnfs41client.bash subcmd "watch_nfs_traffic" to watch NFS network
- traffic.
- Requires "tshark" utility from WireShark.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/README.bintarball.txt | 11 ++++++----
- cygwin/devel/msnfs41client.bash | 39 +++++++++++++++++++++++++++++++++
- 2 files changed, 46 insertions(+), 4 deletions(-)
- diff --git a/cygwin/README.bintarball.txt b/cygwin/README.bintarball.txt
- index 76ec183..407576a 100644
- --- a/cygwin/README.bintarball.txt
- +++ b/cygwin/README.bintarball.txt
- @@ -680,10 +680,13 @@ $ mount -t drvfs '\0.49.202.230@2049\nfs4\bigdisk' /mnt/bigdisk
- to be installed.
- - Watching network traffic:
- - WireShark has a command line tool called "tshark", which can be used
- - to see NFSv4 traffic. As NFSv4 uses RPC you have to filter for RPC,
- - and the RPC filter automatically identifies NFSv4 traffic on it's RPC
- - id.
- + - Use $ /sbin/msnfs41client watch_nfs_traffic # to watch the
- + NFS network traffic
- +
- + - WireShark has a command line tool called "tshark", which can be
- + used to see NFSv4 traffic. As NFSv4 uses RPC you have to filter for
- + RPC, and the RPC filter automatically identifies NFSv4 traffic on
- + it's RPC id.
- Example for Windows:
- (for NFSv4 default TCP port "2049", replace "2049" with the
- desired port if you use a custom port ; use "ipconfig" to find the
- diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
- index b12eb1e..42b4a86 100755
- --- a/cygwin/devel/msnfs41client.bash
- +++ b/cygwin/devel/msnfs41client.bash
- @@ -726,6 +726,35 @@ function watch_kernel_debuglog
- return 0
- }
- +function watch_nfs_traffic
- +{
- + typeset -i nfsv4port=2049
- + typeset s
- + typeset -a eth_interface_list=()
- +
- + printf '# %s: Reading ethernet interface list\n' "$0"
- + while read s ; do
- + eth_interface_list+=( "${s/$'\r'/}" )
- + done < <(powershell -Command 'Get-NetAdapter -Physical | Where-Object { $_.Status -eq "Up"} | ForEach-Object {$_.Name}')
- +
- + printf '# Found interface %q\n' "${eth_interface_list[@]}"
- +
- + # args to watch NFSv4.x RFC traffic
- + typeset -a tshark_args=(
- + '-f' "port $nfsv4port"
- + '-d' "tcp.port==${nfsv4port},rpc"
- + )
- +
- + # add ethernet interface names
- + for s in "${eth_interface_list[@]}" ; do
- + tshark_args+=( '-i' "$s" )
- + done
- +
- + '/cygdrive/c/Program Files/Wireshark/tshark' "${tshark_args[@]}"
- +
- + return 0
- +}
- +
- function nfsclient_system_mount_globaldirs
- {
- set -o xtrace
- @@ -1024,6 +1053,16 @@ function main
- watch_kernel_debuglog
- return $?
- ;;
- + 'watch_nfs_traffic')
- + check_machine_arch || (( numerr++ ))
- + require_cmd 'powershell' || (( numerr++ ))
- + require_cmd '/cygdrive/c/Program Files/Wireshark/tshark' || (( numerr++ ))
- +
- + (( numerr > 0 )) && return 1
- +
- + watch_nfs_traffic
- + return $?
- + ;;
- 'sys_terminal')
- check_machine_arch || (( numerr++ ))
- require_cmd 'mintty.exe' || (( numerr++ ))
- --
- 2.45.1
msnfs41client: Patches to implement |FileNormalizedNameInformation| support+NFS traffic watcher script subcmd, 2025-02-27
Posted by Anonymous on Thu 27th Feb 2025 13:45
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.