Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109302405
D12505.id33486.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D12505.id33486.diff
View Options
Index: head/sys/kern/vfs_export.c
===================================================================
--- head/sys/kern/vfs_export.c
+++ head/sys/kern/vfs_export.c
@@ -448,44 +448,46 @@
vfs_export_lookup(struct mount *mp, struct sockaddr *nam)
{
struct netexport *nep;
- struct netcred *np;
+ struct netcred *np = NULL;
struct radix_node_head *rnh;
struct sockaddr *saddr;
nep = mp->mnt_export;
if (nep == NULL)
return (NULL);
- np = NULL;
- if (mp->mnt_flag & MNT_EXPORTED) {
- /*
- * Lookup in the export list first.
- */
- if (nam != NULL) {
- saddr = nam;
- rnh = NULL;
- switch (saddr->sa_family) {
- case AF_INET:
- rnh = nep->ne4;
- break;
- case AF_INET6:
- rnh = nep->ne6;
- break;
- }
- if (rnh != NULL) {
- RADIX_NODE_HEAD_RLOCK(rnh);
- np = (struct netcred *)
- (*rnh->rnh_matchaddr)(saddr, &rnh->rh);
- RADIX_NODE_HEAD_RUNLOCK(rnh);
- if (np && np->netc_rnodes->rn_flags & RNF_ROOT)
- np = NULL;
- }
- }
- /*
- * If no address match, use the default if it exists.
- */
- if (np == NULL && mp->mnt_flag & MNT_DEFEXPORTED)
- np = &nep->ne_defexported;
+ if ((mp->mnt_flag & MNT_EXPORTED) == 0)
+ return (NULL);
+
+ /*
+ * If no address is provided, use the default if it exists.
+ */
+ if (nam == NULL) {
+ if ((mp->mnt_flag & MNT_DEFEXPORTED) != 0)
+ return (&nep->ne_defexported);
+ return (NULL);
}
+
+ /*
+ * Lookup in the export list
+ */
+ saddr = nam;
+ rnh = NULL;
+ switch (saddr->sa_family) {
+ case AF_INET:
+ rnh = nep->ne4;
+ break;
+ case AF_INET6:
+ rnh = nep->ne6;
+ break;
+ }
+ if (rnh != NULL) {
+ RADIX_NODE_HEAD_RLOCK(rnh);
+ np = (struct netcred *) (*rnh->rnh_matchaddr)(saddr, &rnh->rh);
+ RADIX_NODE_HEAD_RUNLOCK(rnh);
+ if (np != NULL && (np->netc_rnodes->rn_flags & RNF_ROOT) != 0)
+ return (NULL);
+ }
+
return (np);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 4, 7:11 AM (20 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16447901
Default Alt Text
D12505.id33486.diff (1 KB)
Attached To
Mode
D12505: vfs_export: Simplify vfs_export_lookup
Attached
Detach File
Event Timeline
Log In to Comment