Remove special case socket sharing code in order to allow nfsd to
bind IP addresses to udp/cltp sockets separately. PR: kern/13049 Reviewed by: David Malone <dwmalone@maths.tcd.ie>, freebsd-current
This commit is contained in:
parent
ec22663bed
commit
a6aa6d9137
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53095
@ -138,7 +138,6 @@ int nqnfs_piggy[NFS_NPROCS] = {
|
||||
|
||||
extern nfstype nfsv2_type[9];
|
||||
extern nfstype nfsv3_type[9];
|
||||
extern struct nfssvc_sock *nfs_udpsock, *nfs_cltpsock;
|
||||
extern int nfsd_waiting;
|
||||
extern struct nfsstats nfsstats;
|
||||
|
||||
@ -380,18 +379,24 @@ nqsrv_addhost(lph, slp, nam)
|
||||
struct nfssvc_sock *slp;
|
||||
struct sockaddr *nam;
|
||||
{
|
||||
register struct sockaddr_in *saddr;
|
||||
struct sockaddr_in *saddr;
|
||||
struct socket *nsso;
|
||||
|
||||
if (slp == NQLOCALSLP)
|
||||
if (slp == NQLOCALSLP) {
|
||||
lph->lph_flag |= (LC_VALID | LC_LOCAL);
|
||||
else if (slp == nfs_udpsock) {
|
||||
return;
|
||||
}
|
||||
nsso = slp->ns_so;
|
||||
if (nsso && nsso->so_proto->pr_protocol == IPPROTO_UDP) {
|
||||
saddr = (struct sockaddr_in *)nam;
|
||||
lph->lph_flag |= (LC_VALID | LC_UDP);
|
||||
lph->lph_inetaddr = saddr->sin_addr.s_addr;
|
||||
lph->lph_port = saddr->sin_port;
|
||||
} else if (slp == nfs_cltpsock) {
|
||||
#ifdef ISO
|
||||
} else if (nsso && nsso->so_proto->pr_protocol == ISOPROTO_CLTP) {
|
||||
lph->lph_nam = dup_sockaddr(nam, 1);
|
||||
lph->lph_flag |= (LC_VALID | LC_CLTP);
|
||||
#endif
|
||||
} else {
|
||||
lph->lph_flag |= (LC_VALID | LC_SREF);
|
||||
lph->lph_slp = slp;
|
||||
@ -450,6 +455,7 @@ nqsrv_cmpnam(slp, nam, lph)
|
||||
register struct sockaddr_in *saddr;
|
||||
struct sockaddr *addr;
|
||||
union nethostaddr lhaddr;
|
||||
struct socket *nsso;
|
||||
int ret;
|
||||
|
||||
if (slp == NQLOCALSLP) {
|
||||
@ -458,15 +464,21 @@ nqsrv_cmpnam(slp, nam, lph)
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
if (slp == nfs_udpsock || slp == nfs_cltpsock)
|
||||
nsso = slp->ns_so;
|
||||
if (nsso && nsso->so_proto->pr_protocol == IPPROTO_UDP) {
|
||||
addr = nam;
|
||||
else
|
||||
#ifdef ISO
|
||||
} else if (nsso && nsso->so_proto->pr_protocol == ISOPROTO_CLTP) {
|
||||
addr = nam;
|
||||
#endif
|
||||
} else {
|
||||
addr = slp->ns_nam;
|
||||
if (lph->lph_flag & LC_UDP)
|
||||
}
|
||||
if (lph->lph_flag & LC_UDP) {
|
||||
ret = netaddr_match(AF_INET, &lph->lph_haddr, addr);
|
||||
else if (lph->lph_flag & LC_CLTP)
|
||||
} else if (lph->lph_flag & LC_CLTP) {
|
||||
ret = netaddr_match(AF_ISO, &lph->lph_claddr, addr);
|
||||
else {
|
||||
} else {
|
||||
if ((lph->lph_slp->ns_flag & SLP_VALID) == 0)
|
||||
return (0);
|
||||
saddr = (struct sockaddr_in *)lph->lph_slp->ns_nam;
|
||||
@ -517,10 +529,10 @@ nqsrv_send_eviction(vp, lp, slp, nam, cred)
|
||||
saddr->sin_family = AF_INET;
|
||||
saddr->sin_addr.s_addr = lph->lph_inetaddr;
|
||||
saddr->sin_port = lph->lph_port;
|
||||
so = nfs_udpsock->ns_so;
|
||||
so = lph->lph_slp->ns_so;
|
||||
} else if (lph->lph_flag & LC_CLTP) {
|
||||
nam2 = lph->lph_nam;
|
||||
so = nfs_cltpsock->ns_so;
|
||||
so = lph->lph_slp->ns_so;
|
||||
} else if (lph->lph_slp->ns_flag & SLP_VALID) {
|
||||
nam2 = (struct sockaddr *)0;
|
||||
so = lph->lph_slp->ns_so;
|
||||
|
@ -86,7 +86,6 @@ extern int nfsrtton;
|
||||
extern struct nfsstats nfsstats;
|
||||
extern int nfsrvw_procrastinate;
|
||||
extern int nfsrvw_procrastinate_v3;
|
||||
struct nfssvc_sock *nfs_udpsock, *nfs_cltpsock;
|
||||
static int nuidhash_max = NFS_MAXUIDHASH;
|
||||
|
||||
#ifndef NFS_NOSERVER
|
||||
@ -323,10 +322,10 @@ nfssvc_addsock(fp, mynam, p)
|
||||
register int siz;
|
||||
register struct nfssvc_sock *slp;
|
||||
register struct socket *so;
|
||||
struct nfssvc_sock *tslp;
|
||||
int error, s;
|
||||
|
||||
so = (struct socket *)fp->f_data;
|
||||
#if 0
|
||||
tslp = (struct nfssvc_sock *)0;
|
||||
/*
|
||||
* Add it to the list, as required.
|
||||
@ -348,6 +347,7 @@ nfssvc_addsock(fp, mynam, p)
|
||||
}
|
||||
#endif /* ISO */
|
||||
}
|
||||
#endif
|
||||
if (so->so_type == SOCK_STREAM)
|
||||
siz = NFS_MAXPACKET + sizeof (u_long);
|
||||
else
|
||||
@ -393,16 +393,14 @@ nfssvc_addsock(fp, mynam, p)
|
||||
so->so_rcv.sb_timeo = 0;
|
||||
so->so_snd.sb_flags &= ~SB_NOINTR;
|
||||
so->so_snd.sb_timeo = 0;
|
||||
if (tslp)
|
||||
slp = tslp;
|
||||
else {
|
||||
slp = (struct nfssvc_sock *)
|
||||
malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK);
|
||||
bzero((caddr_t)slp, sizeof (struct nfssvc_sock));
|
||||
STAILQ_INIT(&slp->ns_rec);
|
||||
TAILQ_INIT(&slp->ns_uidlruhead);
|
||||
TAILQ_INSERT_TAIL(&nfssvc_sockhead, slp, ns_chain);
|
||||
}
|
||||
|
||||
slp = (struct nfssvc_sock *)
|
||||
malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK);
|
||||
bzero((caddr_t)slp, sizeof (struct nfssvc_sock));
|
||||
STAILQ_INIT(&slp->ns_rec);
|
||||
TAILQ_INIT(&slp->ns_uidlruhead);
|
||||
TAILQ_INSERT_TAIL(&nfssvc_sockhead, slp, ns_chain);
|
||||
|
||||
slp->ns_so = so;
|
||||
slp->ns_nam = mynam;
|
||||
fp->f_count++;
|
||||
@ -861,6 +859,7 @@ nfsrv_init(terminating)
|
||||
TAILQ_INIT(&nfsd_head);
|
||||
nfsd_head_flag &= ~NFSD_CHECKSLP;
|
||||
|
||||
#if 0
|
||||
nfs_udpsock = (struct nfssvc_sock *)
|
||||
malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK);
|
||||
bzero((caddr_t)nfs_udpsock, sizeof (struct nfssvc_sock));
|
||||
@ -874,6 +873,7 @@ nfsrv_init(terminating)
|
||||
STAILQ_INIT(&nfs_cltpsock->ns_rec);
|
||||
TAILQ_INIT(&nfs_cltpsock->ns_uidlruhead);
|
||||
TAILQ_INSERT_TAIL(&nfssvc_sockhead, nfs_cltpsock, ns_chain);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -86,7 +86,6 @@ extern int nfsrtton;
|
||||
extern struct nfsstats nfsstats;
|
||||
extern int nfsrvw_procrastinate;
|
||||
extern int nfsrvw_procrastinate_v3;
|
||||
struct nfssvc_sock *nfs_udpsock, *nfs_cltpsock;
|
||||
static int nuidhash_max = NFS_MAXUIDHASH;
|
||||
|
||||
#ifndef NFS_NOSERVER
|
||||
@ -323,10 +322,10 @@ nfssvc_addsock(fp, mynam, p)
|
||||
register int siz;
|
||||
register struct nfssvc_sock *slp;
|
||||
register struct socket *so;
|
||||
struct nfssvc_sock *tslp;
|
||||
int error, s;
|
||||
|
||||
so = (struct socket *)fp->f_data;
|
||||
#if 0
|
||||
tslp = (struct nfssvc_sock *)0;
|
||||
/*
|
||||
* Add it to the list, as required.
|
||||
@ -348,6 +347,7 @@ nfssvc_addsock(fp, mynam, p)
|
||||
}
|
||||
#endif /* ISO */
|
||||
}
|
||||
#endif
|
||||
if (so->so_type == SOCK_STREAM)
|
||||
siz = NFS_MAXPACKET + sizeof (u_long);
|
||||
else
|
||||
@ -393,16 +393,14 @@ nfssvc_addsock(fp, mynam, p)
|
||||
so->so_rcv.sb_timeo = 0;
|
||||
so->so_snd.sb_flags &= ~SB_NOINTR;
|
||||
so->so_snd.sb_timeo = 0;
|
||||
if (tslp)
|
||||
slp = tslp;
|
||||
else {
|
||||
slp = (struct nfssvc_sock *)
|
||||
malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK);
|
||||
bzero((caddr_t)slp, sizeof (struct nfssvc_sock));
|
||||
STAILQ_INIT(&slp->ns_rec);
|
||||
TAILQ_INIT(&slp->ns_uidlruhead);
|
||||
TAILQ_INSERT_TAIL(&nfssvc_sockhead, slp, ns_chain);
|
||||
}
|
||||
|
||||
slp = (struct nfssvc_sock *)
|
||||
malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK);
|
||||
bzero((caddr_t)slp, sizeof (struct nfssvc_sock));
|
||||
STAILQ_INIT(&slp->ns_rec);
|
||||
TAILQ_INIT(&slp->ns_uidlruhead);
|
||||
TAILQ_INSERT_TAIL(&nfssvc_sockhead, slp, ns_chain);
|
||||
|
||||
slp->ns_so = so;
|
||||
slp->ns_nam = mynam;
|
||||
fp->f_count++;
|
||||
@ -861,6 +859,7 @@ nfsrv_init(terminating)
|
||||
TAILQ_INIT(&nfsd_head);
|
||||
nfsd_head_flag &= ~NFSD_CHECKSLP;
|
||||
|
||||
#if 0
|
||||
nfs_udpsock = (struct nfssvc_sock *)
|
||||
malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK);
|
||||
bzero((caddr_t)nfs_udpsock, sizeof (struct nfssvc_sock));
|
||||
@ -874,6 +873,7 @@ nfsrv_init(terminating)
|
||||
STAILQ_INIT(&nfs_cltpsock->ns_rec);
|
||||
TAILQ_INIT(&nfs_cltpsock->ns_uidlruhead);
|
||||
TAILQ_INSERT_TAIL(&nfssvc_sockhead, nfs_cltpsock, ns_chain);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -86,7 +86,6 @@ extern int nfsrtton;
|
||||
extern struct nfsstats nfsstats;
|
||||
extern int nfsrvw_procrastinate;
|
||||
extern int nfsrvw_procrastinate_v3;
|
||||
struct nfssvc_sock *nfs_udpsock, *nfs_cltpsock;
|
||||
static int nuidhash_max = NFS_MAXUIDHASH;
|
||||
|
||||
#ifndef NFS_NOSERVER
|
||||
@ -323,10 +322,10 @@ nfssvc_addsock(fp, mynam, p)
|
||||
register int siz;
|
||||
register struct nfssvc_sock *slp;
|
||||
register struct socket *so;
|
||||
struct nfssvc_sock *tslp;
|
||||
int error, s;
|
||||
|
||||
so = (struct socket *)fp->f_data;
|
||||
#if 0
|
||||
tslp = (struct nfssvc_sock *)0;
|
||||
/*
|
||||
* Add it to the list, as required.
|
||||
@ -348,6 +347,7 @@ nfssvc_addsock(fp, mynam, p)
|
||||
}
|
||||
#endif /* ISO */
|
||||
}
|
||||
#endif
|
||||
if (so->so_type == SOCK_STREAM)
|
||||
siz = NFS_MAXPACKET + sizeof (u_long);
|
||||
else
|
||||
@ -393,16 +393,14 @@ nfssvc_addsock(fp, mynam, p)
|
||||
so->so_rcv.sb_timeo = 0;
|
||||
so->so_snd.sb_flags &= ~SB_NOINTR;
|
||||
so->so_snd.sb_timeo = 0;
|
||||
if (tslp)
|
||||
slp = tslp;
|
||||
else {
|
||||
slp = (struct nfssvc_sock *)
|
||||
malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK);
|
||||
bzero((caddr_t)slp, sizeof (struct nfssvc_sock));
|
||||
STAILQ_INIT(&slp->ns_rec);
|
||||
TAILQ_INIT(&slp->ns_uidlruhead);
|
||||
TAILQ_INSERT_TAIL(&nfssvc_sockhead, slp, ns_chain);
|
||||
}
|
||||
|
||||
slp = (struct nfssvc_sock *)
|
||||
malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK);
|
||||
bzero((caddr_t)slp, sizeof (struct nfssvc_sock));
|
||||
STAILQ_INIT(&slp->ns_rec);
|
||||
TAILQ_INIT(&slp->ns_uidlruhead);
|
||||
TAILQ_INSERT_TAIL(&nfssvc_sockhead, slp, ns_chain);
|
||||
|
||||
slp->ns_so = so;
|
||||
slp->ns_nam = mynam;
|
||||
fp->f_count++;
|
||||
@ -861,6 +859,7 @@ nfsrv_init(terminating)
|
||||
TAILQ_INIT(&nfsd_head);
|
||||
nfsd_head_flag &= ~NFSD_CHECKSLP;
|
||||
|
||||
#if 0
|
||||
nfs_udpsock = (struct nfssvc_sock *)
|
||||
malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK);
|
||||
bzero((caddr_t)nfs_udpsock, sizeof (struct nfssvc_sock));
|
||||
@ -874,6 +873,7 @@ nfsrv_init(terminating)
|
||||
STAILQ_INIT(&nfs_cltpsock->ns_rec);
|
||||
TAILQ_INIT(&nfs_cltpsock->ns_uidlruhead);
|
||||
TAILQ_INSERT_TAIL(&nfssvc_sockhead, nfs_cltpsock, ns_chain);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user