When famd starts, it gets assigned a random reserved port by calling bindservport(). Due to it getting a random service port, any lookups with netstat show a numbered port OR a mislabled port for famd. Reproducible: Always Steps to Reproduce: 1. Start famd 2. run netstat -ta 3. run lsof -i 4. compare the port used by famd with that show in netstat output Actual Results: I usualy see a numeric number for the port. Sometimes the port assigned is allocated in the services db, and if that port is allocated, fam shows up using another services port. Expected Results: famd should search for a service entry in /etc/services using getservbyname. It should bind to a port matching the entry (if any) here is a patch file for famd source: --- fam-2.7.0-r2/src/Listener.c++ 2003-01-19 17:37:29.000000000 -0700 +++ fam-2.7.0-r3/src/Listener.c++ 2004-11-05 06:25:25.059037488 -0700 @@ -35,6 +35,7 @@ #include <sys/stat.h> #include <sys/un.h> #include <unistd.h> +#include <netdb.h> #include <errno.h> @@ -68,6 +69,7 @@ _ugly_sock(-1), local_only(lo) { + struct servent *se; if (started_by_inetd) { // Portmapper already knows about @@ -91,8 +93,13 @@ memset(&addr, 0, sizeof addr); addr.sin_family = AF_INET; addr.sin_addr.s_addr = local_only ? htonl(INADDR_LOOPBACK) : 0; - addr.sin_port = htons(0); - if (bindresvport(sock, &addr) < 0) + se = getservbyname("fam","tcp"); + if(se) { + addr.sin_port = se->s_port; + } else { + addr.sin_port = htons(0); + } + if (bind(sock, (struct sockaddr *)&addr, sizeof(struct sockaddr)) < 0) { Log::perror("can't bind to reserved port"); exit(1);
Created attachment 43335 [details, diff] patches Lisenter.c++ to check for a service entry patches cleaning to 2.7.0-r2 source
Comment on attachment 43335 [details, diff] patches Lisenter.c++ to check for a service entry patches cleanly to fam-2.7.0-r2
Created attachment 43336 [details] ebuild for revision 3 new ebuild file for revision 3 of famd
this supplied patch and ebuild fixes everything