Skip to contentSkip to conversation

nfsd: use correct byte order on rdma port.

PATCH In review Steve Dickson 3 participants 4 messages Feb 22, 2016 – Mar 1, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfsd: use correct byte order on rdma port.

The returned port from getservbyname() is in network order. Convert the port to host order before writing it to the portlist file.

---
 utils/nfsd/nfssvc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
utils/nfsd/nfssvc.c +1 -1
index e8efd06..dcb430a 100644
@@ -282,7 +282,7 @@ nfssvc_set_rdmaport(const char *port)
 	int fd;
 
 	if (sv)
-		nport = sv->s_port;
+		nport = ntohs(sv->s_port);
 	else {
 		char *ep;
 		nport = strtol(port, &ep, 10);
Signature · 1 line
2.5.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Steve Dickson

The returned port from getservbyname() is in
network order. Convert the port to host order
before writing it to the portlist file.

/etc/services has:

nfsrdma    20049/tcp
nfsrdma    20049/udp
nfsrdma    20049/sctp

which RFC 5666 defines, but I couldn't find in the IANA protocols registry.

struct servent *sv = getservbyname("nfsrdma", "tcp");

Is weird.

Quoted 26 lines

---
utils/nfsd/nfssvc.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
utils/nfsd/nfssvc.c +1 -1
index e8efd06..dcb430a 100644
@@ -282,7 +282,7 @@ nfssvc_set_rdmaport(const char *port)
 	int fd;
 
 	if (sv)
-		nport = sv->s_port;
+		nport = ntohs(sv->s_port);
 	else {
 		char *ep;
 		nport = strtol(port, &ep, 10);
Signature · 6 lines
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Chuck Lever

reviewer
#2 lore raw
Quoted 9 lines · Chuck Lever
Quoted 6 lines · Steve Dickson

The returned port from getservbyname() is in
network order. Convert the port to host order
before writing it to the portlist file.

Quoted 8 lines

/etc/services has:

nfsrdma    20049/tcp
nfsrdma    20049/udp
nfsrdma    20049/sctp

which RFC 5666 defines, but I couldn't find in the IANA protocols registry.

They're there:

http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt

nfsrdma 20049 tcp Network File System (NFS)

                                                              [RFC5666]
                                      over RDMA

nfsrdma 20049 udp Network File System (NFS)

                                                              [RFC5666]
                                      over RDMA

nfsrdma 20049 sctp Network File System (NFS)

                                                              [RFC5666]
                                      over RDMA
Quoted 45 lines
  struct servent *sv = getservbyname("nfsrdma", "tcp");

Is weird.

Quoted 22 lines

---
utils/nfsd/nfssvc.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
utils/nfsd/nfssvc.c +1 -2
index e8efd06..dcb430a 100644
@@ -282,7 +282,7 @@ nfssvc_set_rdmaport(const char *port)
 	int fd;
 
 	if (sv)
-		nport = sv->s_port;
+		nport = ntohs(sv->s_port);
 	else {
 		char *ep;
 		nport = strtol(port, &ep, 10);
--

2.5.0

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Chuck Lever

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Steve Dickson
Quoted 6 lines · Steve Dickson

The returned port from getservbyname() is in network order. Convert the port to host order before writing it to the portlist file.

Committed..

steved.

Quoted 18 lines
---
 utils/nfsd/nfssvc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
utils/nfsd/nfssvc.c +1 -1
index e8efd06..dcb430a 100644
@@ -282,7 +282,7 @@ nfssvc_set_rdmaport(const char *port)
 	int fd;
 
 	if (sv)
-		nport = sv->s_port;
+		nport = ntohs(sv->s_port);
 	else {
 		char *ep;
 		nport = strtol(port, &ep, 10);