Bug 30235

Summary: /usr/sbin/portmap cannot listen to localhost UDP only (patch)
Product: Base System Reporter: Rasputin <rasputnik>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.4-PRERELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Rasputin 2001-08-31 14:20:00 UTC
	portmap(8) states that the -h commandline flag specifies
	specific IP addresses to listen on for UDP. It also states that 127.0.0.1
	is added to the list automatically.
	This causes portmap to attmept to bind twice to 127.0.0.1 if given
	'-h 127.0.0.1', preventing it from starting.

	Without this flag, there is no way to bind only to localhost
	(omitting -h causes portmap to bind to INADDR_ANY).

	The folllowing patch brings portmap into line with its manpage
	(i.e the behaviour of tcp ports has not been changed)

How-To-Repeat: 	portmap -h 127.0.0.1
Comment 1 Frank Tobin 2001-10-23 17:14:05 UTC
The patch seems to work.

Bug 31393 (submitted by me) should be marked as a duplicate.

-- 
Frank Tobin		http://www.neverending.org/~ftobin/
Comment 2 Bruce M Simpson freebsd_committer freebsd_triage 2004-06-14 22:04:42 UTC
State Changed
From-To: open->closed

Fixed by design. Both -CURRENT and -STABLE now use rpcbind which 
has the -h option implemented.
Comment 3 Bruce M Simpson freebsd_committer freebsd_triage 2004-06-15 23:41:13 UTC
State Changed
From-To: closed->patched

Doh! This is only fixed in -CURRENT.
Comment 4 robert 2004-11-16 20:01:53 UTC
Could we get this patch applied to stable, please?

Robert
Comment 5 Rasputin 2004-11-16 22:14:30 UTC
* Robert Faulds <robert@mongonet.net> [1102 20:02]:
> Could we get this patch applied to stable, please?

Please don't, it would be embarassing. I sent that patch 3 years ago,
when I was only halfway through K&R. I can't believe it's taken that
long to be looked at. I suspect no-one had the heart to close it,
saying 'this is ugly as sin, I'm not committing this')..


It was a kludge at the time (there *must* be a saner way to check an
IP than to use strcmp) and it's not right to commit such a mess.

A better fix would be to backport rpcbind to 4.* - I just checked that
on a 5.3 system and it works as documented - then the portmap code could
be taken out and shot.

NB: this doesn't work for tcp ports in any case, and I don't know enough
about NFS to know why '-h' only applies to udp. So a firewall would be a 
safer option if you are concerned about exposing ports. But feel free to 
use the patch if it's any use to you.

-- 
With that big new contract, I've been able to make those government mandated
upgrades you've all been suing me about. - Prof. Farnsworth
Rasputin :: Jack of All Trades - Master of Nuns
Comment 6 Matteo Riondato freebsd_committer freebsd_triage 2005-07-31 13:05:38 UTC
State Changed
From-To: patched->closed

Fixed but will not be MFCed to RELENG_4