Project

General

Profile

Actions

Bug #951

closed

mount_nfs(8) rejects certain hostnames

Added by frank almost 17 years ago. Updated over 16 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

It is currently not possible to mount a NFS file system if the first
character in the remote server's hostname is a digit. For example,

mount -t nfs 6pack:/ /mnt

will fail and issue a warning about bad net address 6pack. There is a
patch below which might be helpful for fixing this.

Regards,
Frank Josellis

--- patch begins here ---
--- sbin/mount_nfs/mount_nfs.c.orig 2006-03-27 18:18:13.000000000 0200
++ sbin/mount_nfs/mount_nfs.c 2008-02-16 18:29:13.000000000 +0100
@ -559,6 +559,7 @ {
struct hostent *hp;
struct sockaddr_in saddr;
+ struct in_addr iaddr;
enum tryret ret;
int speclen, remoteerr;
char *hostp, *delimp, *errstr;
@ -630,12 +631,16 @
_res.retrans = 3;
break;
}
- if (isdigit(*hostp)) {
- saddr.sin_addr.s_addr = inet_addr(hostp);
- if (saddr.sin_addr.s_addr == INADDR_NONE) {
- warnx("bad net address %s", hostp);
- haserror = EAI_FAIL;
- }
+ if (inet_aton(hostp, &iaddr)) {
+ if ((hp = gethostbyaddr((char *) &iaddr,
+ sizeof(iaddr),
+ AF_INET)) != NULL) {
+ memmove(&saddr.sin_addr, hp->h_addr,
+ MINsizeof(saddr.sin_addr)));
+ } else {
+ warnx("bad net address %s", hostp);
+ haserror = EAI_FAIL;
+ }
} else if ((hp = gethostbyname(hostp)) != NULL) {
memmove(&saddr.sin_addr, hp->h_addr,
MINsizeof(saddr.sin_addr)));
--- patch ends here ---

Actions #1

Updated by dillon almost 17 years ago

:It is currently not possible to mount a NFS file system if the first
:character in the remote server's hostname is a digit. For example,
:
:mount -t nfs 6pack:/ /mnt
:
:will fail and issue a warning about bad net address 6pack. There is a
:patch below which might be helpful for fixing this.
:
:Regards,
:Frank Josellis

Committed!
-Matt
Matthew Dillon
<>
Actions

Also available in: Atom PDF