From 16cfec8b37de56c8f24d0a87e2149e645da3785e Mon Sep 17 00:00:00 2001 From: Denis Ovsienko Date: Sat, 12 Oct 2013 13:36:02 +0400 Subject: NFS: replace ino_t with u_int32_t (GH #335 pt. 1) NFS file handle is an opaque server-issued sequence of bytes. Parse_fh() function implements heuristics to decode file handles generated by some NFS servers, among other information extracting the node (inode) number. It decodes only 32-bit node numbers. NFS implementations use ino_t C type to represent the node number. The type size may vary across implementations/encodings and may be missing during compile time. Tcpdump used to have its own typedef for ino_t. Gisle Vanem points that it caused a problem with MSVC v.16.00.40219.01 for 80x86, which defines the same type in . This change fixes tcpdump code to use u_int32_t and removes the typedef. --- parsenfsfh.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'parsenfsfh.c') diff --git a/parsenfsfh.c b/parsenfsfh.c index d5f877d8..5ee7e68e 100644 --- a/parsenfsfh.c +++ b/parsenfsfh.c @@ -114,7 +114,7 @@ Parse_fh(fh, len, fsidp, inop, osnamep, fsnamep, ourself) register const unsigned char *fh; int len _U_; my_fsid *fsidp; -ino_t *inop; +u_int32_t *inop; const char **osnamep; /* if non-NULL, return OS name here */ const char **fsnamep; /* if non-NULL, return server fs name here (for VMS) */ int ourself; /* true if file handle was generated on this host */ @@ -264,8 +264,7 @@ int ourself; /* true if file handle was generated on this host */ fsidp->Fsid_dev.Major = fhp[6]; fsidp->fsid_code = 0; - temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); - *inop = temp; + *inop = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); if (osnamep) *osnamep = "Auspex"; @@ -276,8 +275,7 @@ int ourself; /* true if file handle was generated on this host */ fsidp->Fsid_dev.Major = fhp[1]; fsidp->fsid_code = 0; - temp = make_uint32(fhp[15], fhp[14], fhp[13], fhp[12]); - *inop = temp; + *inop = make_uint32(fhp[15], fhp[14], fhp[13], fhp[12]); if (osnamep) *osnamep = "BSD 4.4"; @@ -291,8 +289,7 @@ int ourself; /* true if file handle was generated on this host */ fsidp->Fsid_dev.Minor = temp & 0xFFFFF; fsidp->Fsid_dev.Major = (temp>>20) & 0xFFF; - temp = make_uint32(fhp[15], fhp[14], fhp[13], fhp[12]); - *inop = temp; + *inop = make_uint32(fhp[15], fhp[14], fhp[13], fhp[12]); if (osnamep) *osnamep = "OSF"; break; @@ -302,8 +299,7 @@ int ourself; /* true if file handle was generated on this host */ fsidp->Fsid_dev.Major = fhp[2]; fsidp->fsid_code = 0; - temp = make_uint32(fhp[8], fhp[9], fhp[10], fhp[11]); - *inop = temp; + *inop = make_uint32(fhp[8], fhp[9], fhp[10], fhp[11]); if (osnamep) *osnamep = "IRIX4"; @@ -314,8 +310,7 @@ int ourself; /* true if file handle was generated on this host */ fsidp->Fsid_dev.Major = make_uint16(fhp[0], fhp[1]); fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]); - temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); - *inop = temp; + *inop = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); if (osnamep) *osnamep = "IRIX5"; @@ -337,8 +332,7 @@ int ourself; /* true if file handle was generated on this host */ fsidp->Fsid_dev.Major = fhp[2]; fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]); - temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); - *inop = temp; + *inop = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); if (osnamep) *osnamep = "SUNOS4"; @@ -351,8 +345,7 @@ int ourself; /* true if file handle was generated on this host */ fsidp->Fsid_dev.Minor = temp & 0x3FFFF; fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]); - temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); - *inop = temp; + *inop = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); if (osnamep) *osnamep = "SUNOS5"; @@ -403,8 +396,7 @@ int ourself; /* true if file handle was generated on this host */ fsidp->Fsid_dev.Major = make_uint16(fhp[0], fhp[1]); fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]); - temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); - *inop = temp; + *inop = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); if (osnamep) *osnamep = "AIX32"; @@ -416,8 +408,7 @@ int ourself; /* true if file handle was generated on this host */ fsidp->Fsid_dev.Minor = temp; fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]); - temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); - *inop = temp; + *inop = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); if (osnamep) *osnamep = "HPUX9"; -- cgit v1.2.1