]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/nfs/nfs.h
xnu-3789.41.3.tar.gz
[apple/xnu.git] / bsd / nfs / nfs.h
index 370ddaa832451120255b3d98017eab728a6c2cdf..bb8cf8433ac7871257044588bef53cd0c956669d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2015 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
@@ -106,7 +106,6 @@ extern int nfs_ticks;
 #define        NFS_ASYNCTHREADMAXIDLE  60      /* Seconds before idle nfsiods are reaped */
 #define        NFS_DEFSTATFSRATELIMIT  10      /* Def. max # statfs RPCs per second */
 #define NFS_REQUESTDELAY       10      /* ms interval to check request queue */
-#define NFSRV_DEADSOCKDELAY    5       /* Seconds before dead sockets are reaped */
 #define NFSRV_MAXWGATHERDELAY  100     /* Max. write gather delay (msec) */
 #ifndef NFSRV_WGATHERDELAY
 #define NFSRV_WGATHERDELAY     1       /* Default write gather delay (msec) */
@@ -186,6 +185,8 @@ extern int nfs_ticks;
 #define NFS_MATTR_REALM                        24      /* Realm to authenticate with */
 #define NFS_MATTR_PRINCIPAL            25      /* GSS principal to authenticate with */
 #define NFS_MATTR_SVCPRINCIPAL         26      /* GSS principal to authenticate to, the server principal */
+#define NFS_MATTR_NFS_VERSION_RANGE    27      /* Packed version range to try */
+#define NFS_MATTR_KERB_ETYPE           28      /* Enctype to use for kerberos mounts */
 
 /* NFS mount flags */
 #define NFS_MFLAG_SOFT                 0       /* soft mount (requests fail if unresponsive) */
@@ -207,11 +208,32 @@ extern int nfs_ticks;
 #define NFS_MFLAG_MNTUDP               16      /* MOUNT protocol should use UDP */
 #define NFS_MFLAG_MNTQUICK             17      /* use short timeouts while mounting */
 
+/* Macros for packing and unpacking packed versions */
+#define PVER2MAJOR(M) ((uint32_t)(((M) >> 16) & 0xffff))
+#define PVER2MINOR(m) ((uint32_t)((m) & 0xffff))
+#define VER2PVER(M, m) ((uint32_t)((M) << 16) | ((m) & 0xffff))
+
 /* NFS advisory file locking modes */
 #define NFS_LOCK_MODE_ENABLED          0       /* advisory file locking enabled */
 #define NFS_LOCK_MODE_DISABLED         1       /* do not support advisory file locking */
 #define NFS_LOCK_MODE_LOCAL            2       /* perform advisory file locking locally */
 
+
+/* Supported encryption types for kerberos session keys */
+typedef enum  nfs_supported_kerberos_etypes {
+       NFS_DES3_CBC_SHA1_KD = 16,
+       NFS_AES128_CTS_HMAC_SHA1_96 = 17,
+       NFS_AES256_CTS_HMAC_SHA1_96 = 18
+} nfs_supported_kerberos_etypes;
+
+/* Structure to hold an array of kerberos enctypes to allow on a mount */
+#define NFS_MAX_ETYPES 3
+struct nfs_etype {
+       uint32_t count;
+       uint32_t selected;  /* index in etypes that is being used. Set to count if nothing has been selected */
+       nfs_supported_kerberos_etypes etypes[NFS_MAX_ETYPES];
+};
+
 /*
  * Old-style arguments to mount NFS
  */
@@ -931,8 +953,6 @@ extern lck_grp_t *nfs_request_grp;
 
 #define NFSNOLIST      ((void *)0x0badcafe)    /* sentinel value for nfs lists */
 #define NFSREQNOLIST   NFSNOLIST               /* sentinel value for nfsreq lists */
-#define NFSIODCOMPLETING       ((void *)0x10d) /* sentinel value for iod processing
-                                                  async I/O w/callback being completed */
 
 /* Flag values for r_flags */
 #define R_TIMING       0x00000001      /* timing request (in mntp) */
@@ -952,6 +972,7 @@ extern lck_grp_t *nfs_request_grp;
 #define R_RESENDQ      0x00004000      /* async request currently on resendq */
 #define R_SENDING      0x00008000      /* request currently being sent */
 #define R_SOFT         0x00010000      /* request is soft - don't retry or reconnect */
+#define R_IOD          0x00020000      /* request is being managed by an IOD */
 
 #define R_NOINTR       0x20000000      /* request should not be interupted by a signal */
 #define R_RECOVER      0x40000000      /* a state recovery RPC - during NFSSTA_RECOVER */
@@ -966,11 +987,11 @@ extern lck_grp_t *nfs_request_grp;
 extern u_int32_t nfs_xid, nfs_xidwrap;
 extern int nfs_iosize, nfs_allow_async, nfs_statfs_rate_limit;
 extern int nfs_access_cache_timeout, nfs_access_delete, nfs_access_dotzfs, nfs_access_for_getattr;
-extern int nfs_lockd_mounts, nfs_lockd_request_sent, nfs_single_des;
+extern int nfs_lockd_mounts, nfs_lockd_request_sent;
 extern int nfs_tprintf_initial_delay, nfs_tprintf_delay;
 extern int nfsiod_thread_count, nfsiod_thread_max, nfs_max_async_writes;
 extern int nfs_idmap_ctrl, nfs_callback_port;
-extern int nfs_is_mobile, nfs_readlink_nocache;
+extern int nfs_is_mobile, nfs_readlink_nocache, nfs_root_steals_ctx;
 extern uint32_t nfs_squishy_flags;
 extern uint32_t nfs_debug_ctl;
 
@@ -1050,8 +1071,8 @@ extern struct nfsrv_sock *nfsrv_udpsock, *nfsrv_udp6sock;
  * nfsrv_sockwork - sockets being worked on which may have more work to do (ns_svcq)
  * nfsrv_sockwg - sockets with pending write gather input (ns_wgq)
  */
-extern TAILQ_HEAD(nfsrv_sockhead, nfsrv_sock) nfsrv_socklist, nfsrv_deadsocklist,
-                                               nfsrv_sockwg, nfsrv_sockwait, nfsrv_sockwork;
+extern TAILQ_HEAD(nfsrv_sockhead, nfsrv_sock) nfsrv_socklist, nfsrv_sockwg,
+                                               nfsrv_sockwait, nfsrv_sockwork;
 
 /* lock groups for nfsrv_sock's */
 extern lck_grp_t *nfsrv_slp_rwlock_group;
@@ -1123,11 +1144,14 @@ extern in_port_t nfs4_cb_port, nfs4_cb_port6;
 extern thread_call_t   nfs_request_timer_call;
 extern thread_call_t   nfs_buf_timer_call;
 extern thread_call_t   nfs4_callback_timer_call;
-extern thread_call_t   nfsrv_deadsock_timer_call;
+extern thread_call_t   nfsrv_idlesock_timer_call;
 #if CONFIG_FSE
 extern thread_call_t   nfsrv_fmod_timer_call;
 #endif
 
+/* nfs 4 default domain for user mapping */
+extern char nfs4_domain[MAXPATHLEN];
+
 __BEGIN_DECLS
 
 nfstype        vtonfs_type(enum vtype, int);
@@ -1392,13 +1416,14 @@ void    nfsrv_cleancache(void);
 void   nfsrv_cleanup(void);
 int    nfsrv_credcheck(struct nfsrv_descript *, vfs_context_t, struct nfs_export *,
                        struct nfs_export_options *);
-void   nfsrv_deadsock_timer(void *, void *);
+void   nfsrv_idlesock_timer(void *, void *);
 int    nfsrv_dorec(struct nfsrv_sock *, struct nfsd *, struct nfsrv_descript **);
 int    nfsrv_errmap(struct nfsrv_descript *, int);
 int    nfsrv_export(struct user_nfs_export_args *, vfs_context_t);
 int    nfsrv_fhmatch(struct nfs_filehandle *, struct nfs_filehandle *);
 int    nfsrv_fhtovp(struct nfs_filehandle *, struct nfsrv_descript *, vnode_t *,
                        struct nfs_export **, struct nfs_export_options **);
+int    nfsrv_check_exports_allow_address(mbuf_t);
 #if CONFIG_FSE
 void   nfsrv_fmod_timer(void *, void *);
 #endif