- for (i = 0; i <= NETHASHSZ; i++) {
- np = ump->um_netaddr[i];
- ump->um_netaddr[i] = (struct netaddrhash *)0;
- while (np) {
- onp = np;
- np = np->neth_next;
- if (onp->neth_family != AF_INET) {
- m_freem(onp->neth_nam);
- m_freem(onp->neth_msk);
- }
- free((caddr_t)onp, M_NETADDR);
+ for (i = 0; i <= AF_MAX; i++)
+ if (rnh = ump->um_rtable[i]) {
+ (*rnh->rnh_walk)(rnh->rnh_treetop,
+ ufs_free_netcred, (caddr_t)0);
+ free((caddr_t)rnh, M_RTABLE);
+ ump->um_rtable[i] = 0;
+ }
+}
+
+/*
+ * This is the generic part of fhtovp called after the underlying
+ * filesystem has validated the file handle.
+ *
+ * Verify that a host should have access to a filesystem, and if so
+ * return a vnode for the presented file handle.
+ */
+int
+ufs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp)
+ register struct mount *mp;
+ struct ufid *ufhp;
+ struct mbuf *nam;
+ struct vnode **vpp;
+ int *exflagsp;
+ struct ucred **credanonp;
+{
+ register struct inode *ip;
+ register struct netcred *np;
+ register struct ufsmount *ump = VFSTOUFS(mp);
+ register struct radix_node_head *rnh;
+ struct vnode *nvp;
+ struct sockaddr *saddr;
+ int error;
+
+ /*
+ * Get the export permission structure for this <mp, client> tuple.
+ */
+ if ((mp->mnt_flag & MNT_EXPORTED) == 0)
+ return (EACCES);
+ if (nam == NULL) {
+ np = NULL;
+ } else {
+ saddr = mtod(nam, struct sockaddr *);
+ rnh = ump->um_rtable[saddr->sa_family];
+ if (rnh == NULL) {
+ np = NULL;
+ } else {
+ np = (struct netcred *)
+ (*rnh->rnh_match)((caddr_t)saddr, rnh->rnh_treetop);
+ if (np->netc_rnodes->rn_flags & RNF_ROOT)
+ np = NULL;