From Todd Sabin: allocate the buffer for the decrypted payload, rather
[obnox/wireshark/wip.git] / packet-mount.c
index 67422dcfc8f612ca820c53b555348fcaa022fa64..8c48f0f9dd4786c0c16190ffe5b6f6369918b808 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-mount.c
  * Routines for mount dissection
  *
- * $Id: packet-mount.c,v 1.29 2002/01/20 22:12:26 guy Exp $
+ * $Id: packet-mount.c,v 1.37 2002/11/14 02:31:26 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
 #endif
 
 
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
 #include <string.h>
 
 #include "packet-rpc.h"
 
 
 static int proto_mount = -1;
+static int proto_sgi_mount = -1;
+static int hf_mount_procedure_v1 = -1;
+static int hf_mount_procedure_v2 = -1;
+static int hf_mount_procedure_v3 = -1;
+static int hf_sgi_mount_procedure_v1 = -1;
 static int hf_mount_path = -1;
 static int hf_mount3_status = -1;
 static int hf_mount_mountlist_hostname = -1;
@@ -50,6 +51,8 @@ static int hf_mount_groups_group = -1;
 static int hf_mount_groups = -1;
 static int hf_mount_exportlist_directory = -1;
 static int hf_mount_exportlist = -1;
+static int hf_mount_has_options = -1;
+static int hf_mount_options = -1;
 static int hf_mount_pathconf_link_max = -1;
 static int hf_mount_pathconf_max_canon = -1;
 static int hf_mount_pathconf_max_input = -1;
@@ -68,6 +71,25 @@ static int hf_mount_pathconf_error_pipe_buf = -1;
 static int hf_mount_pathconf_chown_restricted = -1;
 static int hf_mount_pathconf_no_trunc = -1;
 static int hf_mount_pathconf_error_vdisable = -1;
+static int hf_mount_statvfs_bsize = -1;
+static int hf_mount_statvfs_frsize = -1;
+static int hf_mount_statvfs_blocks = -1;
+static int hf_mount_statvfs_bfree = -1;
+static int hf_mount_statvfs_bavail = -1;
+static int hf_mount_statvfs_files = -1;
+static int hf_mount_statvfs_ffree = -1;
+static int hf_mount_statvfs_favail = -1;
+static int hf_mount_statvfs_fsid = -1;
+static int hf_mount_statvfs_basetype = -1;
+static int hf_mount_statvfs_flag = -1;
+static int hf_mount_statvfs_flag_rdonly = -1;
+static int hf_mount_statvfs_flag_nosuid = -1;
+static int hf_mount_statvfs_flag_notrunc = -1;
+static int hf_mount_statvfs_flag_nodev = -1;
+static int hf_mount_statvfs_flag_grpid = -1;
+static int hf_mount_statvfs_flag_local = -1;
+static int hf_mount_statvfs_namemax = -1;
+static int hf_mount_statvfs_fstr = -1;
 static int hf_mount_flavors = -1;
 static int hf_mount_flavor = -1;
 
@@ -76,6 +98,7 @@ static gint ett_mount_mountlist = -1;
 static gint ett_mount_groups = -1;
 static gint ett_mount_exportlist = -1;
 static gint ett_mount_pathconf_mask = -1;
+static gint ett_mount_statvfs_flag = -1;
 
 #define MAX_GROUP_NAME_LIST 128
 static char group_name_list[MAX_GROUP_NAME_LIST];
@@ -84,9 +107,9 @@ static int  group_names_len;
 /* RFC 1094, Page 24 */
 /* This function dissects fhstatus for v1 and v2 of the mount protocol.
  * Formally, hf_mount3_status only define the status codes returned by version
- * 3 of the protocol. 
- * Though not formally defined in the standard, we use the same 
- * value-to-string mappings as version 3 since we belive that this mapping 
+ * 3 of the protocol.
+ * Though not formally defined in the standard, we use the same
+ * value-to-string mappings as version 3 since we belive that this mapping
  * is consistant with most v1 and v2 implementations.
  */
 static int
@@ -95,7 +118,7 @@ dissect_fhstatus(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree
        gint32 status;
 
        status=tvb_get_ntohl(tvb,offset);
-       offset = dissect_rpc_uint32(tvb,pinfo,tree,hf_mount3_status,offset);
+       offset = dissect_rpc_uint32(tvb,tree,hf_mount3_status,offset);
 
        switch (status) {
                case 0:
@@ -111,31 +134,42 @@ dissect_fhstatus(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree
 
 
 static int
-dissect_mount_dirpath_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_mount_dirpath_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
+               proto_tree *tree)
 {
        if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
                rpc_call_info_value *civ=pinfo->private_data;
 
                if(civ->request && (civ->proc==1)){
                        unsigned char *host, *name;
+                       unsigned const char *dir;
                        int len;
 
                        host=ip_to_str(pinfo->dst.data);
                        len=tvb_get_ntohl(tvb, offset);
-               
-                       name=g_malloc(strlen(host)+1+len+1);
-                       sprintf(name,"%s:%*s", host, len, tvb_get_ptr(tvb, offset+4, len));
 
-                       nfs_name_snoop_add_name(civ->xid, tvb, -1, strlen(name), 0, 0, name);
+                       dir=tvb_get_ptr(tvb, offset+4, len);
+                       if(dir){
+                               unsigned char *ptr;
+                               name=g_malloc(strlen(host)+1+len+1+200);
+                               ptr=name;
+                               memcpy(ptr, host, strlen(host));
+                               ptr+=strlen(host);
+                               *ptr++=':';
+                               memcpy(ptr, dir, len);
+                               ptr+=len;
+                               *ptr=0;
+
+                               nfs_name_snoop_add_name(civ->xid, tvb, -1, strlen(name), 0, 0, name);
+                       }
                }
        }
 
-
        if ( tree )
        {
-               offset = dissect_rpc_string(tvb,pinfo,tree,hf_mount_path,offset,NULL);
+               offset = dissect_rpc_string(tvb,tree,hf_mount_path,offset,NULL);
        }
-       
+
        return offset;
 }
 
@@ -154,7 +188,7 @@ dissect_mount1_mnt_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
 /* RFC 1094, Page 26 */
 /* RFC 1813, Page 110 */
 static int
-dissect_mountlist(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_mountlist(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
 {
        proto_item* lock_item = NULL;
        proto_tree* lock_tree = NULL;
@@ -169,9 +203,9 @@ dissect_mountlist(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tre
                        lock_tree = proto_item_add_subtree(lock_item, ett_mount_mountlist);
        }
 
-       offset = dissect_rpc_string(tvb, pinfo, lock_tree, 
+       offset = dissect_rpc_string(tvb, lock_tree,
                        hf_mount_mountlist_hostname, offset, &hostname);
-       offset = dissect_rpc_string(tvb, pinfo, lock_tree,
+       offset = dissect_rpc_string(tvb, lock_tree,
                        hf_mount_mountlist_directory, offset, &directory);
 
        if (lock_item) {
@@ -202,7 +236,7 @@ dissect_mount_dump_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
 /* RFC 1094, Page 26 */
 /* RFC 1813, Page 110 */
 static int
-dissect_group(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_group(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
 {
        int len,str_len;
        len=tvb_get_ntohl(tvb,offset);
@@ -218,7 +252,7 @@ dissect_group(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
        }
        group_name_list[group_names_len]=0;
 
-       offset = dissect_rpc_string(tvb, pinfo, tree, 
+       offset = dissect_rpc_string(tvb, tree,
                        hf_mount_groups_group, offset, NULL);
 
        return offset;
@@ -247,7 +281,7 @@ dissect_exportlist(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
                        exportlist_tree = proto_item_add_subtree(exportlist_item, ett_mount_exportlist);
        }
 
-       offset = dissect_rpc_string(tvb, pinfo, exportlist_tree,
+       offset = dissect_rpc_string(tvb, exportlist_tree,
                        hf_mount_exportlist_directory, offset, &directory);
        groups_offset = offset;
 
@@ -357,7 +391,7 @@ static const true_false_string tos_error_vdisable = {
 
 
 static int
-dissect_mount_pathconf_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_mount_pathconf_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
 {
        int saved_offset;
        guint32 pc_mask;
@@ -372,14 +406,14 @@ dissect_mount_pathconf_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, prot
        pc_mask = tvb_get_ntohl(tvb, offset+OFFS_MASK) & 0xffff;
        if (!(pc_mask & (PC_ERROR_LINK_MAX|PC_ERROR_ALL))) {
                if (tree) {
-                       dissect_rpc_uint32(tvb,pinfo,tree,hf_mount_pathconf_link_max,offset);
+                       dissect_rpc_uint32(tvb,tree,hf_mount_pathconf_link_max,offset);
                }
        }
        offset += 4;
 
        if (!(pc_mask & (PC_ERROR_MAX_CANON|PC_ERROR_ALL))) {
                if (tree) {
-                       proto_tree_add_item(tree, 
+                       proto_tree_add_item(tree,
                                hf_mount_pathconf_max_canon,tvb,offset+2,2,
                                tvb_get_ntohs(tvb,offset)&0xffff);
                }
@@ -388,7 +422,7 @@ dissect_mount_pathconf_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, prot
 
        if (!(pc_mask & (PC_ERROR_MAX_INPUT|PC_ERROR_ALL))) {
                if (tree) {
-                       proto_tree_add_item(tree, 
+                       proto_tree_add_item(tree,
                                hf_mount_pathconf_max_input,tvb,offset+2,2,
                                tvb_get_ntohs(tvb,offset)&0xffff);
                }
@@ -397,7 +431,7 @@ dissect_mount_pathconf_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, prot
 
        if (!(pc_mask & (PC_ERROR_NAME_MAX|PC_ERROR_ALL))) {
                if (tree) {
-                       proto_tree_add_item(tree, 
+                       proto_tree_add_item(tree,
                                hf_mount_pathconf_name_max,tvb,offset+2,2,
                                tvb_get_ntohs(tvb,offset)&0xffff);
                }
@@ -406,7 +440,7 @@ dissect_mount_pathconf_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, prot
 
        if (!(pc_mask & (PC_ERROR_PATH_MAX|PC_ERROR_ALL))) {
                if (tree) {
-                       proto_tree_add_item(tree, 
+                       proto_tree_add_item(tree,
                                hf_mount_pathconf_path_max,tvb,offset+2,2,
                                tvb_get_ntohs(tvb,offset)&0xffff);
                }
@@ -415,7 +449,7 @@ dissect_mount_pathconf_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, prot
 
        if (!(pc_mask & (PC_ERROR_PIPE_BUF|PC_ERROR_ALL))) {
                if (tree) {
-                       proto_tree_add_item(tree, 
+                       proto_tree_add_item(tree,
                                hf_mount_pathconf_pipe_buf,tvb,offset+2,2,
                                tvb_get_ntohs(tvb,offset)&0xffff);
                }
@@ -426,7 +460,7 @@ dissect_mount_pathconf_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, prot
 
        if (!(pc_mask & (PC_ERROR_VDISABLE|PC_ERROR_ALL))) {
                if (tree) {
-                       proto_tree_add_item(tree, 
+                       proto_tree_add_item(tree,
                                hf_mount_pathconf_vdisable,tvb,offset+3,1,
                                tvb_get_ntohs(tvb,offset)&0xffff);
                }
@@ -467,7 +501,7 @@ dissect_mount_pathconf_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, prot
 }
 
 /* RFC 1813, Page 107 */
-static const value_string mount3_mountstat3[] = 
+static const value_string mount3_mountstat3[] =
 {
        {       0,      "OK" },
        {       1,      "ERR_PERM" },
@@ -485,13 +519,13 @@ static const value_string mount3_mountstat3[] =
 
 /* RFC 1813, Page 107 */
 static int
-dissect_mountstat3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int hfindex, guint32 *status)
+dissect_mountstat3(tvbuff_t *tvb, proto_tree *tree, int offset, int hfindex, guint32 *status)
 {
        guint32 mountstat3;
 
        mountstat3 = tvb_get_ntohl(tvb, offset);
 
-       offset = dissect_rpc_uint32(tvb,pinfo,tree,hfindex,offset);
+       offset = dissect_rpc_uint32(tvb,tree,hfindex,offset);
        *status = mountstat3;
        return offset;
 }
@@ -504,8 +538,8 @@ dissect_mount3_mnt_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
        guint32 auth_flavors;
        guint32 auth_flavor;
        guint32 auth_flavor_i;
-       
-       offset = dissect_mountstat3(tvb,pinfo,tree,offset,hf_mount3_status,&status);
+
+       offset = dissect_mountstat3(tvb,tree,offset,hf_mount3_status,&status);
 
        switch (status) {
                case 0:
@@ -526,10 +560,186 @@ dissect_mount3_mnt_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
                        /* void */
                break;
        }
-       
+
+       return offset;
+}
+
+static int
+dissect_sgi_exportlist(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
+{
+       proto_item* exportlist_item = NULL;
+       proto_tree* exportlist_tree = NULL;
+       int old_offset = offset;
+       int options_offset;
+       char* directory, *options;
+
+       if (tree) {
+               exportlist_item = proto_tree_add_item(tree, hf_mount_exportlist,
+                                       tvb, offset, -1, FALSE);
+               if (exportlist_item)
+                       exportlist_tree = proto_item_add_subtree(exportlist_item,
+                                               ett_mount_exportlist);
+       }
+
+       offset = dissect_rpc_string(tvb, exportlist_tree,
+                       hf_mount_exportlist_directory, offset, &directory);
+
+       offset = dissect_rpc_bool(tvb, exportlist_tree,
+                       hf_mount_has_options, offset);
+       options_offset = offset;
+
+       offset = dissect_rpc_string(tvb, exportlist_tree, hf_mount_options,
+                        offset, &options);
+
+       if (exportlist_item) {
+               /* now we have a nicer string */
+               proto_item_set_text(exportlist_item,
+                       "Export List Entry: %s %s", directory,
+                       options);
+               /* now we know, that exportlist is shorter */
+               proto_item_set_len(exportlist_item, offset - old_offset);
+       }
+       g_free(directory);
+       g_free(options);
+
+       return offset;
+}
+
+static int
+dissect_mount_exportlist_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+{
+       offset = dissect_rpc_list(tvb, pinfo, tree, offset, dissect_sgi_exportlist);
+
        return offset;
 }
 
+#define ST_RDONLY      0x00000001
+#define ST_NOSUID      0x00000002
+#define ST_NOTRUNC     0x00000004
+#define ST_NODEV       0x20000000
+#define ST_GRPID       0x40000000
+#define ST_LOCAL       0x80000000
+
+static const true_false_string tos_st_rdonly = {
+       "Read-only file system",
+       "Read/Write file system"
+};
+
+static const true_false_string tos_st_nosuid = {
+       "Does not support setuid/setgid semantics",
+       "Supports setuid/setgid semantics"
+};
+
+static const true_false_string tos_st_notrunc = {
+       "Does not trunctate filenames longer than NAME_MAX",
+       "Truncates filenames longer than NAME_MAX"
+};
+
+static const true_false_string tos_st_nodev = {
+       "Disallows opening of device files",
+       "Allows opening of device files"
+};
+
+static const true_false_string tos_st_grpid = {
+       "Group ID assigned from directory",
+       "Group ID not assigned from directory"
+};
+
+static const true_false_string tos_st_local = {
+       "File system is local",
+       "File system is not local"
+};
+
+static int
+dissect_mount_statvfs_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
+{
+       proto_item *flag_item;
+       proto_tree *flag_tree;
+       guint32 statvfs_flags;
+
+       statvfs_flags = tvb_get_ntohl(tvb, offset+52);
+       if (tree) {
+               dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_bsize, offset);
+       }
+       offset += 4;
+       if (tree) {
+               dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_frsize, offset);
+       }
+       offset += 4;
+       if (tree) {
+               dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_blocks, offset);
+       }
+       offset += 4;
+       if (tree) {
+               dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_bfree, offset);
+       }
+       offset += 4;
+       if (tree) {
+               dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_bavail, offset);
+       }
+       offset += 4;
+       if (tree) {
+               dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_files, offset);
+       }
+       offset += 4;
+       if (tree) {
+               dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_ffree, offset);
+       }
+       offset += 4;
+       if (tree) {
+               dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_favail, offset);
+       }
+       offset += 4;
+       if (tree) {
+               dissect_rpc_bytes(tvb, tree, hf_mount_statvfs_basetype, offset,
+                       16, TRUE, NULL);
+       }
+       offset += 16;
+       if (tree) {
+               dissect_rpc_bytes(tvb, tree, hf_mount_statvfs_fstr, offset,
+                       32, FALSE, NULL);
+       }
+       offset += 32;
+       if (tree) {
+               dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_fsid, offset);
+       }
+       offset += 4;
+
+       if (tree) {
+               flag_item = proto_tree_add_item(tree, hf_mount_statvfs_flag,
+                               tvb, offset, 4, FALSE);
+               if (flag_item) {
+                       flag_tree = proto_item_add_subtree(flag_item,
+                                       ett_mount_statvfs_flag);
+                       proto_tree_add_boolean(flag_tree,
+                               hf_mount_statvfs_flag_rdonly, tvb, offset, 4,
+                               statvfs_flags);
+                       proto_tree_add_boolean(flag_tree,
+                               hf_mount_statvfs_flag_nosuid, tvb, offset, 4,
+                               statvfs_flags);
+                       proto_tree_add_boolean(flag_tree,
+                               hf_mount_statvfs_flag_notrunc, tvb, offset, 4,
+                               statvfs_flags);
+                       proto_tree_add_boolean(flag_tree,
+                               hf_mount_statvfs_flag_nodev, tvb, offset, 4,
+                               statvfs_flags);
+                       proto_tree_add_boolean(flag_tree,
+                               hf_mount_statvfs_flag_grpid, tvb, offset, 4,
+                               statvfs_flags);
+                       proto_tree_add_boolean(flag_tree,
+                               hf_mount_statvfs_flag_local, tvb, offset, 4,
+                               statvfs_flags);
+               }
+       }
+
+       offset += 4;
+       if (tree) {
+               dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_namemax, offset);
+       }
+       offset += 4;
+
+       return offset;
+}
 
 /* proc number, "proc name", dissect_request, dissect_reply */
 /* NULL as function pointer means: type of arguments is "void". */
@@ -537,11 +747,11 @@ dissect_mount3_mnt_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
 /* Mount protocol version 1, RFC 1094 */
 static const vsff mount1_proc[] = {
     { 0, "NULL", NULL, NULL },
-    { MOUNTPROC_MNT,        "MNT",      
+    { MOUNTPROC_MNT,        "MNT",
                dissect_mount_dirpath_call, dissect_mount1_mnt_reply },
     { MOUNTPROC_DUMP,       "DUMP",
                NULL, dissect_mount_dump_reply },
-    { MOUNTPROC_UMNT,      "UMNT",        
+    { MOUNTPROC_UMNT,      "UMNT",
                dissect_mount_dirpath_call, NULL },
     { MOUNTPROC_UMNTALL,   "UMNTALL",
                NULL, NULL },
@@ -551,6 +761,16 @@ static const vsff mount1_proc[] = {
                NULL, dissect_mount_export_reply },
     { 0, NULL, NULL, NULL }
 };
+static const value_string mount1_proc_vals[] = {
+    { 0, "NULL" },
+    { MOUNTPROC_MNT,       "MNT" },
+    { MOUNTPROC_DUMP,      "DUMP" },
+    { MOUNTPROC_UMNT,      "UMNT" },
+    { MOUNTPROC_UMNTALL,   "UMNTALL" },
+    { MOUNTPROC_EXPORT,    "EXPORT" },
+    { MOUNTPROC_EXPORTALL, "EXPORTALL" },
+    { 0, NULL }
+};
 /* end of mount version 1 */
 
 
@@ -559,11 +779,11 @@ static const vsff mount1_proc[] = {
    POSIX "pathconf()" call. */
 static const vsff mount2_proc[] = {
     { 0, "NULL", NULL, NULL },
-    { MOUNTPROC_MNT,        "MNT",      
+    { MOUNTPROC_MNT,        "MNT",
                dissect_mount_dirpath_call, dissect_mount1_mnt_reply },
     { MOUNTPROC_DUMP,       "DUMP",
                NULL, dissect_mount_dump_reply },
-    { MOUNTPROC_UMNT,      "UMNT",        
+    { MOUNTPROC_UMNT,      "UMNT",
                dissect_mount_dirpath_call, NULL },
     { MOUNTPROC_UMNTALL,   "UMNTALL",
                NULL, NULL },
@@ -575,6 +795,17 @@ static const vsff mount2_proc[] = {
                dissect_mount_dirpath_call, dissect_mount_pathconf_reply },
     { 0, NULL, NULL, NULL }
 };
+static const value_string mount2_proc_vals[] = {
+    { 0, "NULL" },
+    { MOUNTPROC_MNT,       "MNT" },
+    { MOUNTPROC_DUMP,      "DUMP" },
+    { MOUNTPROC_UMNT,      "UMNT" },
+    { MOUNTPROC_UMNTALL,   "UMNTALL" },
+    { MOUNTPROC_EXPORT,    "EXPORT" },
+    { MOUNTPROC_EXPORTALL, "EXPORTALL" },
+    { MOUNTPROC_PATHCONF,  "PATHCONF" },
+    { 0, NULL }
+};
 /* end of mount version 2 */
 
 
@@ -593,13 +824,70 @@ static const vsff mount3_proc[] = {
                NULL, dissect_mount_export_reply },
        { 0, NULL, NULL, NULL }
 };
+static const value_string mount3_proc_vals[] = {
+       { 0, "NULL" },
+       { MOUNTPROC_MNT, "MNT" },
+       { MOUNTPROC_DUMP, "DUMP" },
+       { MOUNTPROC_UMNT, "UMNT" },
+       { MOUNTPROC_UMNTALL, "UMNTALL" },
+       { MOUNTPROC_EXPORT, "EXPORT" },
+       { 0, NULL }
+};
 /* end of Mount protocol version 3 */
 
+/* SGI mount protocol version 1; actually the same as v1 plus
+   MOUNTPROC_EXPORTLIST and MOUNTPROC_STATVFS */
+
+static const vsff sgi_mount1_proc[] = {
+    { 0, "NULL", NULL, NULL },
+    { MOUNTPROC_MNT,        "MNT",      
+               dissect_mount_dirpath_call, dissect_mount1_mnt_reply },
+    { MOUNTPROC_DUMP,       "DUMP",
+               NULL, dissect_mount_dump_reply },
+    { MOUNTPROC_UMNT,      "UMNT",        
+               dissect_mount_dirpath_call, NULL },
+    { MOUNTPROC_UMNTALL,   "UMNTALL",
+               NULL, NULL },
+    { MOUNTPROC_EXPORT,    "EXPORT",
+               NULL, dissect_mount_export_reply },
+    { MOUNTPROC_EXPORTALL, "EXPORTALL",
+               NULL, dissect_mount_export_reply },
+    { MOUNTPROC_EXPORTLIST,"EXPORTLIST",
+               NULL, dissect_mount_exportlist_reply },
+    { MOUNTPROC_STATVFS,   "STATVFS",
+               dissect_mount_dirpath_call, dissect_mount_statvfs_reply },
+    { 0, NULL, NULL, NULL }
+};
+static const value_string sgi_mount1_proc_vals[] = {
+    { 0, "NULL" },
+    { MOUNTPROC_MNT,        "MNT" },
+    { MOUNTPROC_DUMP,       "DUMP" },
+    { MOUNTPROC_UMNT,       "UMNT" },
+    { MOUNTPROC_UMNTALL,    "UMNTALL" },
+    { MOUNTPROC_EXPORT,     "EXPORT" },
+    { MOUNTPROC_EXPORTALL,  "EXPORTALL" },
+    { MOUNTPROC_EXPORTLIST, "EXPORTLIST" },
+    { MOUNTPROC_STATVFS,    "STATVFS" },
+    { 0, NULL }
+};
+/* end of SGI mount protocol version 1 */
 
 void
 proto_register_mount(void)
 {
        static hf_register_info hf[] = {
+               { &hf_mount_procedure_v1, {
+                       "V1 Procedure", "mount.procedure_v1", FT_UINT32, BASE_DEC,
+                       VALS(mount1_proc_vals), 0, "V1 Procedure", HFILL }},
+               { &hf_mount_procedure_v2, {
+                       "V2 Procedure", "mount.procedure_v2", FT_UINT32, BASE_DEC,
+                       VALS(mount2_proc_vals), 0, "V2 Procedure", HFILL }},
+               { &hf_mount_procedure_v3, {
+                       "V3 Procedure", "mount.procedure_v3", FT_UINT32, BASE_DEC,
+                       VALS(mount3_proc_vals), 0, "V3 Procedure", HFILL }},
+               { &hf_sgi_mount_procedure_v1, {
+                       "SGI V1 procedure", "mount.procedure_sgi_v1", FT_UINT32, BASE_DEC,
+                       VALS(sgi_mount1_proc_vals), 0, "SGI V1 Procedure", HFILL }},
                { &hf_mount_path, {
                        "Path", "mount.path", FT_STRING, BASE_DEC,
                        NULL, 0, "Path", HFILL }},
@@ -621,6 +909,12 @@ proto_register_mount(void)
                { &hf_mount_groups, {
                        "Groups", "mount.export.groups", FT_NONE, 0,
                        NULL, 0, "Groups", HFILL }},
+               { &hf_mount_has_options, {
+                       "Has options", "mount.export.has_options", FT_UINT32,
+                        BASE_DEC, NULL, 0, "Has options", HFILL }},
+               { &hf_mount_options, {
+                       "Options", "mount.export.options", FT_STRING, BASE_DEC,
+                       NULL, 0, "Options", HFILL }},
                { &hf_mount_exportlist_directory, {
                        "Directory", "mount.export.directory", FT_STRING, BASE_DEC,
                        NULL, 0, "Directory", HFILL }},
@@ -699,6 +993,82 @@ proto_register_mount(void)
                        "ERROR_VDISABLE", "mount.pathconf.mask.error_vdisable",
                        FT_BOOLEAN, 16, TFS(&tos_error_vdisable),
                        PC_ERROR_VDISABLE, "", HFILL }},
+               { &hf_mount_statvfs_bsize, {
+                       "Block size", "mount.statvfs.f_bsize",
+                       FT_UINT32, BASE_DEC, NULL, 0,
+                       "File system block size", HFILL }},
+               { &hf_mount_statvfs_frsize, {
+                       "Fragment size", "mount.statvfs.f_frsize",
+                       FT_UINT32, BASE_DEC, NULL, 0,
+                       "File system fragment size", HFILL }},
+               { &hf_mount_statvfs_blocks, {
+                       "Blocks", "mount.statvfs.f_blocks",
+                       FT_UINT32, BASE_DEC, NULL, 0,
+                       "Total fragment sized blocks", HFILL }},
+               { &hf_mount_statvfs_bfree, {
+                       "Blocks Free", "mount.statvfs.f_bfree",
+                       FT_UINT32, BASE_DEC, NULL, 0,
+                       "Free fragment sized blocks", HFILL }},
+               { &hf_mount_statvfs_bavail, {
+                       "Blocks Available", "mount.statvfs.f_bavail",
+                       FT_UINT32, BASE_DEC, NULL, 0,
+                       "Available fragment sized blocks", HFILL }},
+               { &hf_mount_statvfs_files, {
+                       "Files", "mount.statvfs.f_files",
+                       FT_UINT32, BASE_DEC, NULL, 0,
+                       "Total files/inodes", HFILL }},
+               { &hf_mount_statvfs_ffree, {
+                       "Files Free", "mount.statvfs.f_ffree",
+                       FT_UINT32, BASE_DEC, NULL, 0,
+                       "Free files/inodes", HFILL }},
+               { &hf_mount_statvfs_favail, {
+                       "Files Available", "mount.statvfs.f_favail",
+                       FT_UINT32, BASE_DEC, NULL, 0,
+                       "Available files/inodes",  HFILL }},
+               { &hf_mount_statvfs_fsid, {
+                       "File system ID", "mount.statvfs.f_fsid",
+                       FT_UINT32, BASE_DEC, NULL, 0,
+                       "File system identifier", HFILL }},
+               { &hf_mount_statvfs_basetype, {
+                       "Type", "mount.statvfs.f_basetype",
+                       FT_STRING, BASE_DEC, NULL, 0,
+                       "File system type", HFILL }},
+               { &hf_mount_statvfs_flag, {
+                       "Flags", "mount.statvfs.f_flag",
+                       FT_UINT32, BASE_HEX, NULL, 0,
+                       "Flags bit-mask", HFILL }},
+               { &hf_mount_statvfs_flag_rdonly, {
+                       "ST_RDONLY", "mount.statvfs.f_flag.st_rdonly",
+                       FT_BOOLEAN, 32, TFS(&tos_st_rdonly), ST_RDONLY,
+                       "", HFILL }},
+               { &hf_mount_statvfs_flag_nosuid, {
+                       "ST_NOSUID", "mount.statvfs.f_flag.st_nosuid",
+                       FT_BOOLEAN, 32, TFS(&tos_st_nosuid), ST_NOSUID,
+                       "", HFILL }},
+               { &hf_mount_statvfs_flag_notrunc, {
+                       "ST_NOTRUNC", "mount.statvfs.f_flag.st_notrunc",
+                       FT_BOOLEAN, 32, TFS(&tos_st_notrunc), ST_NOTRUNC,
+                       "", HFILL }},
+               { &hf_mount_statvfs_flag_nodev, {
+                       "ST_NODEV", "mount.statvfs.f_flag.st_nodev",
+                        FT_BOOLEAN, 32, TFS(&tos_st_nodev), ST_NODEV,
+                       "", HFILL }},
+               { &hf_mount_statvfs_flag_grpid, {
+                       "ST_GRPID", "mount.statvfs.f_flag.st_grpid",
+                       FT_BOOLEAN, 32, TFS(&tos_st_grpid), ST_GRPID,
+                       "", HFILL }},
+               { &hf_mount_statvfs_flag_local, {
+                       "ST_LOCAL", "mount.statvfs.f_flag.st_local",
+                       FT_BOOLEAN, 32, TFS(&tos_st_local), ST_LOCAL,
+                       "", HFILL }},
+               { &hf_mount_statvfs_namemax, {
+                       "Maximum file name length", "mount.statvfs.f_namemax",
+                       FT_UINT32, BASE_DEC, NULL, 0,
+                       "Maximum file name length", HFILL }},
+               { &hf_mount_statvfs_fstr, {
+                       "File system specific string", "mount.statvfs.f_fstr",
+                       FT_BYTES, BASE_HEX, NULL, 0,
+                       "File system specific string", HFILL }},
                { &hf_mount_flavors, {
                        "Flavors", "mount.flavors", FT_UINT32, BASE_DEC,
                        NULL, 0, "Flavors", HFILL }},
@@ -712,9 +1082,13 @@ proto_register_mount(void)
                &ett_mount_groups,
                &ett_mount_exportlist,
                &ett_mount_pathconf_mask,
+               &ett_mount_statvfs_flag,
        };
 
-       proto_mount = proto_register_protocol("Mount Service", "MOUNT", "mount");
+       proto_mount = proto_register_protocol("Mount Service", "MOUNT",
+           "mount");
+       proto_sgi_mount = proto_register_protocol("SGI Mount Service",
+           "SGI MOUNT", "sgimount");
        proto_register_field_array(proto_mount, hf, array_length(hf));
        proto_register_subtree_array(ett, array_length(ett));
 }
@@ -724,8 +1098,10 @@ proto_reg_handoff_mount(void)
 {
        /* Register the protocol as RPC */
        rpc_init_prog(proto_mount, MOUNT_PROGRAM, ett_mount);
+       rpc_init_prog(proto_sgi_mount, SGI_MOUNT_PROGRAM, ett_mount);
        /* Register the procedure tables */
-       rpc_init_proc_table(MOUNT_PROGRAM, 1, mount1_proc);
-       rpc_init_proc_table(MOUNT_PROGRAM, 2, mount2_proc);
-       rpc_init_proc_table(MOUNT_PROGRAM, 3, mount3_proc);
+       rpc_init_proc_table(MOUNT_PROGRAM, 1, mount1_proc, hf_mount_procedure_v1);
+       rpc_init_proc_table(MOUNT_PROGRAM, 2, mount2_proc, hf_mount_procedure_v2);
+       rpc_init_proc_table(MOUNT_PROGRAM, 3, mount3_proc, hf_mount_procedure_v3);
+       rpc_init_proc_table(SGI_MOUNT_PROGRAM, 1, sgi_mount1_proc, hf_sgi_mount_procedure_v1);
 }