nfs: Fix NFSv2 STATFS procedure parsing

Ticket: #5140
pull/14398/head
Jhonny Sousa 11 months ago committed by Victor Julien
parent 15b1bf4865
commit 257ed82dbd

@ -82,12 +82,18 @@ fn nfs_common_header(
state: &NFSState, tx: &NFSTransaction, js: &mut JsonBuilder,
) -> Result<(), JsonError> {
js.set_uint("version", state.nfs_version as u64)?;
if state.nfs_version < 4 {
if state.nfs_version == 3 {
if let Some(proc) = NfsProc3::from_u(tx.procedure) {
js.set_string("procedure", &proc.to_str().to_uppercase())?;
} else {
js.set_string("procedure", &format!("{}", tx.procedure))?;
}
} else if state.nfs_version <= 2 {
if let Some(proc) = NfsProc2::from_u(tx.procedure) {
js.set_string("procedure", &proc.to_str().to_uppercase())?;
} else {
js.set_string("procedure", &format!("{}", tx.procedure))?;
}
} else if let Some(proc) = NfsProc4::from_u(tx.procedure) {
js.set_string("procedure", &proc.to_str().to_uppercase())?;
} else {

@ -15,6 +15,31 @@
* 02110-1301, USA.
*/
/* RFC 1094, section '2.2 Server Procedures' */
#[repr(u32)]
#[derive(EnumStringU32)]
#[allow(non_camel_case_types)]
pub enum NfsProc2 {
NULL = 0,
GETATTR = 1,
SETATTR = 2,
ROOT = 3,
LOOKUP = 4,
READLINK = 5,
READ = 6,
WRITECACHE = 7,
WRITE = 8,
CREATE = 9,
REMOVE = 10,
RENAME = 11,
LINK = 12,
SYMLINK = 13,
MKDIR = 14,
RMDIR = 15,
READDIR = 16,
STATFS = 17,
}
/* RFC 1813, section '3. Server Procedures' */
pub const NFSPROC3_NULL: u32 = 0;
pub const NFSPROC3_GETATTR: u32 = 1;

Loading…
Cancel
Save