Re: Local-only (non-ip) rpcbind(8)?

2022-11-18 Thread Michael van Elst
h...@spg.tu-darmstadt.de (Hauke Fath) writes:

>>  if (ipv6_only == 1 && 

>And here is where I naively would insert a commandline option flag to 
>disable all things non-local. Unless something like that already exists, 
>and I just didn't see it.

>>  strcmp(nconf->nc_protofmly,"inet") == 0) {
>>  /* DO NOTHING */

Nope, just the commandline option that filters out IPv4.



Re: Local-only (non-ip) rpcbind(8)?

2022-11-18 Thread Hauke Fath

On 11/18/22 6:54 PM, Michael van Elst wrote:

When you specify hosts, rpcbind automatically adds 127.0.0.1 to the
list of addresses, thus the duplicate.


Yes, I got about that far, before coming here.  ;)


Here is what rpbind does:

-> bind to local transport
 nconf = getnetconfigent("local");
 init_transport(nconf);

-> bind to all visible transports configured
 while ((nconf = getnetconfig(nc_handle))) {
 if (nconf->nc_flag & NC_VISIBLE) {
 if (ipv6_only == 1 && 


And here is where I naively would insert a commandline option flag to 
disable all things non-local. Unless something like that already exists, 
and I just didn't see it.



 strcmp(nconf->nc_protofmly,"inet") == 0) {
 /* DO NOTHING */
 } else
 init_transport(nconf);
 }
 }
 endnetconfig(nc_handle);


Thanks,
Hauke

--
 The ASCII Ribbon CampaignHauke Fath
() No HTML/RTF in email Institut für Nachrichtentechnik
/\ No Word docs in email TU Darmstadt
 Respect for open standards  Ruf +49-6151-16-21344


Re: Local-only (non-ip) rpcbind(8)?

2022-11-18 Thread Michael van Elst
h...@spg.tu-darmstadt.de (Hauke Fath) writes:

>Hi,

>can rpcbind(8) be set up to only use local transport, as opposed to 
>binding to interfaces?

>The closest I seem to come to that goal is by specifying '-h 127.0.0.1', 
>which results in a pointless

>Nov 18 15:45:05 HOST rpcbind: cannot bind 127.0.0.1 on udp: Address 
>already in use
>Nov 18 15:45:05 HOST rpcbind: cannot bind 127.0.0.1 on tcp: Address 
>already in use

When you specify hosts, rpcbind automatically adds 127.0.0.1 to the
list of addresses, thus the duplicate.

Here is what rpbind does:

-> bind to local transport
nconf = getnetconfigent("local");
init_transport(nconf);

-> bind to all visible transports configured
while ((nconf = getnetconfig(nc_handle))) {
if (nconf->nc_flag & NC_VISIBLE) {
if (ipv6_only == 1 && strcmp(nconf->nc_protofmly,
"inet") == 0) {
/* DO NOTHING */
} else
init_transport(nconf);
}
}
endnetconfig(nc_handle);

The configuration is in /etc/netconfig:

udp6   tpi_clts  v inet6udp -   -
tcp6   tpi_cots_ord  v inet6tcp -   -
udptpi_clts  v inet udp -   -
tcptpi_cots_ord  v inet tcp -   -
rawip  tpi_raw   - inet  -  -   -
local  tpi_cots_ord  - loopback  -  -   -

where 'v' is the NC_VISIBLE flag.

Of course that's a global setting and RPC clients use is too.