diff options
Diffstat (limited to 'include/linux/lockd')
-rw-r--r-- | include/linux/lockd/bind.h | 1 | ||||
-rw-r--r-- | include/linux/lockd/lockd.h | 72 | ||||
-rw-r--r-- | include/linux/lockd/sm_inter.h | 48 | ||||
-rw-r--r-- | include/linux/lockd/xdr.h | 15 |
4 files changed, 58 insertions, 78 deletions
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h index e5872dc994c0..fbc48f898521 100644 --- a/include/linux/lockd/bind.h +++ b/include/linux/lockd/bind.h | |||
@@ -41,6 +41,7 @@ struct nlmclnt_initdata { | |||
41 | size_t addrlen; | 41 | size_t addrlen; |
42 | unsigned short protocol; | 42 | unsigned short protocol; |
43 | u32 nfs_version; | 43 | u32 nfs_version; |
44 | int noresvport; | ||
44 | }; | 45 | }; |
45 | 46 | ||
46 | /* | 47 | /* |
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index b56d5aa9b194..aa6fe7026de7 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h | |||
@@ -43,12 +43,13 @@ struct nlm_host { | |||
43 | struct sockaddr_storage h_addr; /* peer address */ | 43 | struct sockaddr_storage h_addr; /* peer address */ |
44 | size_t h_addrlen; | 44 | size_t h_addrlen; |
45 | struct sockaddr_storage h_srcaddr; /* our address (optional) */ | 45 | struct sockaddr_storage h_srcaddr; /* our address (optional) */ |
46 | struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */ | 46 | struct rpc_clnt *h_rpcclnt; /* RPC client to talk to peer */ |
47 | char * h_name; /* remote hostname */ | 47 | char *h_name; /* remote hostname */ |
48 | u32 h_version; /* interface version */ | 48 | u32 h_version; /* interface version */ |
49 | unsigned short h_proto; /* transport proto */ | 49 | unsigned short h_proto; /* transport proto */ |
50 | unsigned short h_reclaiming : 1, | 50 | unsigned short h_reclaiming : 1, |
51 | h_server : 1, /* server side, not client side */ | 51 | h_server : 1, /* server side, not client side */ |
52 | h_noresvport : 1, | ||
52 | h_inuse : 1; | 53 | h_inuse : 1; |
53 | wait_queue_head_t h_gracewait; /* wait while reclaiming */ | 54 | wait_queue_head_t h_gracewait; /* wait while reclaiming */ |
54 | struct rw_semaphore h_rwsem; /* Reboot recovery lock */ | 55 | struct rw_semaphore h_rwsem; /* Reboot recovery lock */ |
@@ -63,21 +64,29 @@ struct nlm_host { | |||
63 | spinlock_t h_lock; | 64 | spinlock_t h_lock; |
64 | struct list_head h_granted; /* Locks in GRANTED state */ | 65 | struct list_head h_granted; /* Locks in GRANTED state */ |
65 | struct list_head h_reclaim; /* Locks in RECLAIM state */ | 66 | struct list_head h_reclaim; /* Locks in RECLAIM state */ |
66 | struct nsm_handle * h_nsmhandle; /* NSM status handle */ | 67 | struct nsm_handle *h_nsmhandle; /* NSM status handle */ |
67 | 68 | char *h_addrbuf; /* address eyecatcher */ | |
68 | char h_addrbuf[48], /* address eyecatchers */ | ||
69 | h_srcaddrbuf[48]; | ||
70 | }; | 69 | }; |
71 | 70 | ||
71 | /* | ||
72 | * The largest string sm_addrbuf should hold is a full-size IPv6 address | ||
73 | * (no "::" anywhere) with a scope ID. The buffer size is computed to | ||
74 | * hold eight groups of colon-separated four-hex-digit numbers, a | ||
75 | * percent sign, a scope id (at most 32 bits, in decimal), and NUL. | ||
76 | */ | ||
77 | #define NSM_ADDRBUF ((8 * 4 + 7) + (1 + 10) + 1) | ||
78 | |||
72 | struct nsm_handle { | 79 | struct nsm_handle { |
73 | struct list_head sm_link; | 80 | struct list_head sm_link; |
74 | atomic_t sm_count; | 81 | atomic_t sm_count; |
75 | char * sm_name; | 82 | char *sm_mon_name; |
83 | char *sm_name; | ||
76 | struct sockaddr_storage sm_addr; | 84 | struct sockaddr_storage sm_addr; |
77 | size_t sm_addrlen; | 85 | size_t sm_addrlen; |
78 | unsigned int sm_monitored : 1, | 86 | unsigned int sm_monitored : 1, |
79 | sm_sticky : 1; /* don't unmonitor */ | 87 | sm_sticky : 1; /* don't unmonitor */ |
80 | char sm_addrbuf[48]; /* address eyecatcher */ | 88 | struct nsm_private sm_priv; |
89 | char sm_addrbuf[NSM_ADDRBUF]; | ||
81 | }; | 90 | }; |
82 | 91 | ||
83 | /* | 92 | /* |
@@ -103,16 +112,6 @@ static inline struct sockaddr *nlm_srcaddr(const struct nlm_host *host) | |||
103 | return (struct sockaddr *)&host->h_srcaddr; | 112 | return (struct sockaddr *)&host->h_srcaddr; |
104 | } | 113 | } |
105 | 114 | ||
106 | static inline struct sockaddr_in *nsm_addr_in(const struct nsm_handle *handle) | ||
107 | { | ||
108 | return (struct sockaddr_in *)&handle->sm_addr; | ||
109 | } | ||
110 | |||
111 | static inline struct sockaddr *nsm_addr(const struct nsm_handle *handle) | ||
112 | { | ||
113 | return (struct sockaddr *)&handle->sm_addr; | ||
114 | } | ||
115 | |||
116 | /* | 115 | /* |
117 | * Map an fl_owner_t into a unique 32-bit "pid" | 116 | * Map an fl_owner_t into a unique 32-bit "pid" |
118 | */ | 117 | */ |
@@ -196,6 +195,7 @@ extern struct svc_procedure nlmsvc_procedures4[]; | |||
196 | extern int nlmsvc_grace_period; | 195 | extern int nlmsvc_grace_period; |
197 | extern unsigned long nlmsvc_timeout; | 196 | extern unsigned long nlmsvc_timeout; |
198 | extern int nsm_use_hostnames; | 197 | extern int nsm_use_hostnames; |
198 | extern int nsm_local_state; | ||
199 | 199 | ||
200 | /* | 200 | /* |
201 | * Lockd client functions | 201 | * Lockd client functions |
@@ -220,7 +220,8 @@ struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap, | |||
220 | const size_t salen, | 220 | const size_t salen, |
221 | const unsigned short protocol, | 221 | const unsigned short protocol, |
222 | const u32 version, | 222 | const u32 version, |
223 | const char *hostname); | 223 | const char *hostname, |
224 | int noresvport); | ||
224 | struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, | 225 | struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, |
225 | const char *hostname, | 226 | const char *hostname, |
226 | const size_t hostname_len); | 227 | const size_t hostname_len); |
@@ -229,10 +230,20 @@ void nlm_rebind_host(struct nlm_host *); | |||
229 | struct nlm_host * nlm_get_host(struct nlm_host *); | 230 | struct nlm_host * nlm_get_host(struct nlm_host *); |
230 | void nlm_release_host(struct nlm_host *); | 231 | void nlm_release_host(struct nlm_host *); |
231 | void nlm_shutdown_hosts(void); | 232 | void nlm_shutdown_hosts(void); |
232 | extern void nlm_host_rebooted(const struct sockaddr_in *, const char *, | 233 | void nlm_host_rebooted(const struct nlm_reboot *); |
233 | unsigned int, u32); | 234 | |
234 | void nsm_release(struct nsm_handle *); | 235 | /* |
236 | * Host monitoring | ||
237 | */ | ||
238 | int nsm_monitor(const struct nlm_host *host); | ||
239 | void nsm_unmonitor(const struct nlm_host *host); | ||
235 | 240 | ||
241 | struct nsm_handle *nsm_get_handle(const struct sockaddr *sap, | ||
242 | const size_t salen, | ||
243 | const char *hostname, | ||
244 | const size_t hostname_len); | ||
245 | struct nsm_handle *nsm_reboot_lookup(const struct nlm_reboot *info); | ||
246 | void nsm_release(struct nsm_handle *nsm); | ||
236 | 247 | ||
237 | /* | 248 | /* |
238 | * This is used in garbage collection and resource reclaim | 249 | * This is used in garbage collection and resource reclaim |
@@ -280,16 +291,25 @@ static inline struct inode *nlmsvc_file_inode(struct nlm_file *file) | |||
280 | static inline int __nlm_privileged_request4(const struct sockaddr *sap) | 291 | static inline int __nlm_privileged_request4(const struct sockaddr *sap) |
281 | { | 292 | { |
282 | const struct sockaddr_in *sin = (struct sockaddr_in *)sap; | 293 | const struct sockaddr_in *sin = (struct sockaddr_in *)sap; |
283 | return (sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK)) && | 294 | |
284 | (ntohs(sin->sin_port) < 1024); | 295 | if (ntohs(sin->sin_port) > 1023) |
296 | return 0; | ||
297 | |||
298 | return ipv4_is_loopback(sin->sin_addr.s_addr); | ||
285 | } | 299 | } |
286 | 300 | ||
287 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 301 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
288 | static inline int __nlm_privileged_request6(const struct sockaddr *sap) | 302 | static inline int __nlm_privileged_request6(const struct sockaddr *sap) |
289 | { | 303 | { |
290 | const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap; | 304 | const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap; |
291 | return (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK) && | 305 | |
292 | (ntohs(sin6->sin6_port) < 1024); | 306 | if (ntohs(sin6->sin6_port) > 1023) |
307 | return 0; | ||
308 | |||
309 | if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_MAPPED) | ||
310 | return ipv4_is_loopback(sin6->sin6_addr.s6_addr32[3]); | ||
311 | |||
312 | return ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK; | ||
293 | } | 313 | } |
294 | #else /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | 314 | #else /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ |
295 | static inline int __nlm_privileged_request6(const struct sockaddr *sap) | 315 | static inline int __nlm_privileged_request6(const struct sockaddr *sap) |
diff --git a/include/linux/lockd/sm_inter.h b/include/linux/lockd/sm_inter.h deleted file mode 100644 index 5a5448bdb17d..000000000000 --- a/include/linux/lockd/sm_inter.h +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/linux/lockd/sm_inter.h | ||
3 | * | ||
4 | * Declarations for the kernel statd client. | ||
5 | * | ||
6 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> | ||
7 | */ | ||
8 | |||
9 | #ifndef LINUX_LOCKD_SM_INTER_H | ||
10 | #define LINUX_LOCKD_SM_INTER_H | ||
11 | |||
12 | #define SM_PROGRAM 100024 | ||
13 | #define SM_VERSION 1 | ||
14 | #define SM_STAT 1 | ||
15 | #define SM_MON 2 | ||
16 | #define SM_UNMON 3 | ||
17 | #define SM_UNMON_ALL 4 | ||
18 | #define SM_SIMU_CRASH 5 | ||
19 | #define SM_NOTIFY 6 | ||
20 | |||
21 | #define SM_MAXSTRLEN 1024 | ||
22 | #define SM_PRIV_SIZE 16 | ||
23 | |||
24 | /* | ||
25 | * Arguments for all calls to statd | ||
26 | */ | ||
27 | struct nsm_args { | ||
28 | __be32 addr; /* remote address */ | ||
29 | u32 prog; /* RPC callback info */ | ||
30 | u32 vers; | ||
31 | u32 proc; | ||
32 | |||
33 | char * mon_name; | ||
34 | }; | ||
35 | |||
36 | /* | ||
37 | * Result returned by statd | ||
38 | */ | ||
39 | struct nsm_res { | ||
40 | u32 status; | ||
41 | u32 state; | ||
42 | }; | ||
43 | |||
44 | int nsm_monitor(struct nlm_host *); | ||
45 | int nsm_unmonitor(struct nlm_host *); | ||
46 | extern int nsm_local_state; | ||
47 | |||
48 | #endif /* LINUX_LOCKD_SM_INTER_H */ | ||
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h index d6b3a802c046..7dc5b6cb44cd 100644 --- a/include/linux/lockd/xdr.h +++ b/include/linux/lockd/xdr.h | |||
@@ -13,6 +13,13 @@ | |||
13 | #include <linux/nfs.h> | 13 | #include <linux/nfs.h> |
14 | #include <linux/sunrpc/xdr.h> | 14 | #include <linux/sunrpc/xdr.h> |
15 | 15 | ||
16 | #define SM_MAXSTRLEN 1024 | ||
17 | #define SM_PRIV_SIZE 16 | ||
18 | |||
19 | struct nsm_private { | ||
20 | unsigned char data[SM_PRIV_SIZE]; | ||
21 | }; | ||
22 | |||
16 | struct svc_rqst; | 23 | struct svc_rqst; |
17 | 24 | ||
18 | #define NLM_MAXCOOKIELEN 32 | 25 | #define NLM_MAXCOOKIELEN 32 |
@@ -77,10 +84,10 @@ struct nlm_res { | |||
77 | * statd callback when client has rebooted | 84 | * statd callback when client has rebooted |
78 | */ | 85 | */ |
79 | struct nlm_reboot { | 86 | struct nlm_reboot { |
80 | char * mon; | 87 | char *mon; |
81 | unsigned int len; | 88 | unsigned int len; |
82 | u32 state; | 89 | u32 state; |
83 | __be32 addr; | 90 | struct nsm_private priv; |
84 | }; | 91 | }; |
85 | 92 | ||
86 | /* | 93 | /* |