Skip to contentSkip to conversation

Possible bug in nfs-utils source.

DISCUSSION Ben Greear 3 participants 5 messages Jan 21, 2009 – Mar 4, 2009

Subsystems (2)
lore
Share & tools
lore

Ben Greear

author
#0 lore raw

I'm working on adding support to bind to local addresses, and I noticed this code in nfs/getport.c

I believe the sizeof should probably be sizeof(*lb_addr) ?

unsigned short nfs_getlocalport(const rpcprot_t program,
const rpcvers_t version, const unsigned short protocol)

{
	struct sockaddr_storage address;
	struct sockaddr *lb_addr = (struct sockaddr *)&address;
	socklen_t lb_len = sizeof(lb_addr);
	unsigned short port = 0;

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#1 lore raw
Quoted 4 lines · Ben Greear

I'm working on adding support to bind to local addresses, and I noticed this code in nfs/getport.c

I believe the sizeof should probably be sizeof(*lb_addr) ?

Yes. Can you submit a patch to Steve and copy the list?

Quoted 20 lines

unsigned short nfs_getlocalport(const rpcprot_t program,
const rpcvers_t version, const unsigned short protocol)

{
	struct sockaddr_storage address;
	struct sockaddr *lb_addr = (struct sockaddr *)&address;
	socklen_t lb_len = sizeof(lb_addr);
	unsigned short port = 0;

Thanks,
Ben

Signature · 7 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com

--
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
Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
author
#2 lore raw
Quoted 7 lines · Chuck Lever
Quoted 4 lines · Ben Greear

I'm working on adding support to bind to local addresses, and I noticed this code in nfs/getport.c

I believe the sizeof should probably be sizeof(*lb_addr) ?

Yes. Can you submit a patch to Steve and copy the list?

Sure, but will be a bit...I'm half through passing local_address everywhere so I can bind to local IP addresses explicitly on multi-homed devices....

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
author
#3 lore raw
In reply to Chuck Lever
Quoted 7 lines · Chuck Lever
Quoted 4 lines · Ben Greear

I'm working on adding support to bind to local addresses, and I noticed this code in nfs/getport.c

I believe the sizeof should probably be sizeof(*lb_addr) ?

Yes. Can you submit a patch to Steve and copy the list?

The patch is attached.

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
support/nfs/getport.c +1 -1
index 47824a2..f5f7049 100644
@@ -836,7 +836,7 @@ unsigned short nfs_getlocalport(const rpcprot_t program,
 {
 	struct sockaddr_storage address;
 	struct sockaddr *lb_addr = (struct sockaddr *)&address;
-	socklen_t lb_len = sizeof(lb_addr);
+	socklen_t lb_len = sizeof(*lb_addr);
 	unsigned short port = 0;
 
 #ifdef NFS_GP_LOCAL
#4 lore raw
Quoted 5 lines · Ben Greear
Quoted 4 lines · Chuck Lever
Quoted 3 lines · Ben Greear

I'm working on adding support to bind to local addresses, and I noticed this code in nfs/getport.c

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

I believe the sizeof should probably be sizeof(*lb_addr) ?

Yes. Can you submit a patch to Steve and copy the list?

The patch is attached.

Committed...

steved.