Bug 1013468 - [rpc.mountd] -n|--no-tcp option cannot work with -N 4
Summary: [rpc.mountd] -n|--no-tcp option cannot work with -N 4
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: nfs-utils
Version: 7.0
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Steve Dickson
QA Contact: JianHong Yin
URL:
Whiteboard:
Depends On: 984824 1127955 1127957
Blocks: 859078 1011909
TreeView+ depends on / blocked
 
Reported: 2013-09-30 07:17 UTC by JianHong Yin
Modified: 2016-11-18 10:36 UTC (History)
5 users (show)

Fixed In Version: nfs-utils-1.2.9-0.0.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 984824
Environment:
Last Closed: 2014-06-13 09:38:08 UTC
Target Upstream Version:


Attachments (Terms of Use)

Comment 1 JianHong Yin 2013-09-30 07:22:10 UTC
[root@dhcp-13-136 ~]# lsb_release -sir; rpm -q nfs-utils
RedHatEnterpriseWorkstation 7.0
nfs-utils-1.2.8-4.1.el7.x86_64
[root@dhcp-13-136 ~]# ps axf | grep mountd
17585 pts/1    S+     0:00          \_ grep --color=auto mountd
17511 ?        Ss     0:00 rpc.mountd --no-tcp
[root@dhcp-13-136 ~]# rpcinfo -s 
   program version(s) netid(s)                         service     owner
    100000  2,3,4     local,udp,tcp,udp6,tcp6          portmapper  superuser
    100024  1         tcp6,udp6,tcp,udp                status      29
    100005  3,2,1     tcp6,udp6,tcp,udp                mountd      superuser

   <<<---  -n or --no-tcp can not work

Comment 4 JianHong Yin 2013-10-08 01:57:13 UTC
[root@dhcp-13-136 ~]# rpc.mountd -n -N 4
[root@dhcp-13-136 ~]# rpcinfo -s 
   program version(s) netid(s)                         service     owner
    100000  2,3,4     local,udp,tcp,udp6,tcp6          portmapper  superuser
    100024  1         tcp6,udp6,tcp,udp                status      29
    100005  3,2,1     tcp6,udp6,tcp,udp                mountd      superuser
[root@dhcp-13-136 ~]# ps axf | grep rpc.mountd
14057 pts/2    S+     0:00          \_ grep --color=auto rpc.mountd
14054 ?        Ss     0:00 rpc.mountd -n -N 4

even with -N 4 rpc.mountd still can not turn off tcp port;

Comment 5 Steve Dickson 2013-10-17 12:19:54 UTC
I have take a look at as to why -n no longer works. It happen when nfs-utils 
switched from the glibc RPC code to the libtirpc RPC code, a few years
back... 

I personally believe, not being able to turn off TCP mount is a good thing! I 
think the bug should be you can't turn of UDP mounts because that's
what we really want... 

With that said... there actually is ways to turn of both UDP and TCP mount.
Simply comment out the 
     "udp        tpi_clts      v     inet     udp"
     "tcp        tpi_cots_ord  v     inet     tcp"

lines in the /etc/netconfig, at least in theory... 

So, I'm going to close this bug as WONTFIX and work with upstream 
to eliminate this flag completely...

Comment 6 JianHong Yin 2013-10-18 02:58:57 UTC
(In reply to Steve Dickson from comment #5)
> I have take a look at as to why -n no longer works. It happen when nfs-utils 
> switched from the glibc RPC code to the libtirpc RPC code, a few years
> back... 
> 
> I personally believe, not being able to turn off TCP mount is a good thing!
> I 
> think the bug should be you can't turn of UDP mounts because that's
> what we really want... 
So strange reason...
Fix this problem is difficult to do?

> 
> With that said... there actually is ways to turn of both UDP and TCP mount.
> Simply comment out the 
>      "udp        tpi_clts      v     inet     udp"
>      "tcp        tpi_cots_ord  v     inet     tcp"
> 
> lines in the /etc/netconfig, at least in theory... 
> 
> So, I'm going to close this bug as WONTFIX and work with upstream 
> to eliminate this flag completely...

I think ..  we should from user perspective.
  If it can not turn off TCP, At least please delete the -n|--no-tcp option,
  and add description in man pages.

please think if you are a user of the tools;

Comment 7 Ric Wheeler 2013-10-31 13:47:15 UTC
The test is invalid, I would not flag this as a beta blocker or a test blocker (which holds up beta).

We can certainly look at updating documentation and removing the option, but I suggest that is relatively low priority (although I do agree we should clean it up for users).

Thanks!

Comment 8 JianHong Yin 2013-11-01 05:14:19 UTC
(In reply to Ric Wheeler from comment #7)
> The test is invalid, I would not flag this as a beta blocker or a test
> blocker (which holds up beta).
Agreed to remove testblocker, if you insist;
   (I try other method to close tcp to reproduce ...)
But Do not agree WONTFIX.
> 
> We can certainly look at updating documentation and removing the option, but
> I suggest that is relatively low priority (although I do agree we should
> clean it up for users).
Low priority is ok, unimportant.
But for backward compatibility, not suggest delete the option.
better fix it in RC, or more later if you have not time.

> 
> Thanks!

And.. I try the the follow patch, it works; you can and other condition:
    if ((-n) and (-N 4) and (netconfig is tcp)) continue;
It is easy to fix.

diff --git a/support/nfs/svc_create.c b/support/nfs/svc_create.c
index c159fc8..3bbeefc 100644
--- a/support/nfs/svc_create.c
+++ b/support/nfs/svc_create.c
@@ -416,6 +416,9 @@ nfs_svc_create(char *name, const rpcprog_t program, const rpcvers_t version,
        while ((nconf = getnetconfig(handlep)) != NULL) {
                if (!(nconf->nc_flag & NC_VISIBLE))
                        continue;
+               if (_rpcfdtype == SOCK_DGRAM && !strncmp(nconf->nc_proto,"tcp", 3)) {
+                       continue;
+               }
                visible++;
                if (port == 0)
                        servport = getservport(program, nconf->nc_proto);

Comment 9 JianHong Yin 2013-11-01 06:36:30 UTC
Although the -n option is not often used, but user can use it for debug/test and so on; and since it has not been deleted, please ensure that it functions available;

And Please refer the rpc.nfsd implement:
    if can not turn off give reason for user. if no reason fix it.
# rpc.nfsd -T
rpc.nfsd: version 4 requires the TCP protocol
[root@dhcp12-241 mountd]# rpc.nfsd --no-tcp
rpc.nfsd: version 4 requires the TCP protocol
[root@dhcp12-241 mountd]# echo $?
1

In fact nfs4 need not rpc.mountd as a rpc server, just as a userland daemon listen on the local rpc cache file; right?

Comment 14 JianHong Yin 2013-11-15 06:57:38 UTC
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: /CoreOS/nfs-utils/commands/utils/rpc-mountd::Test ==- rpc.mountd -n --no-tcp
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


================================================================================
[01:38:31 root@ /mnt/tests/CoreOS/nfs-utils/commands/utils/rpc-mountd]# rpc.mountd -n -N 4
:: [   PASS   ] :: Running 'rpc.mountd -n -N 4' (Expected 0, got 0)
--------------------------------------------------------------------------------

================================================================================
[01:38:31 root@ /mnt/tests/CoreOS/nfs-utils/commands/utils/rpc-mountd]# ps axf | grep -v grep | grep "rpc.mountd -n"
11046 ?        Ss     0:00 rpc.mountd -n -N 4
:: [   PASS   ] :: Running 'ps axf | grep -v grep | grep "rpc.mountd -n"' (Expected 0, got 0)
--------------------------------------------------------------------------------

================================================================================
[01:38:32 root@ /mnt/tests/CoreOS/nfs-utils/commands/utils/rpc-mountd]# rpcinfo -p | grep -w mountd | grep -w tcp
:: [   PASS   ] :: Running 'rpcinfo -p | grep -w mountd | grep -w tcp' (Expected 1, got 1)
--------------------------------------------------------------------------------

================================================================================
[01:38:32 root@ /mnt/tests/CoreOS/nfs-utils/commands/utils/rpc-mountd]# pkill rpc.mountd
:: [   PASS   ] :: Running 'pkill rpc.mountd' (Expected 0, got 0)
--------------------------------------------------------------------------------

================================================================================
[01:38:32 root@ /mnt/tests/CoreOS/nfs-utils/commands/utils/rpc-mountd]# rpc.mountd --no-tcp -N 4
:: [   PASS   ] :: Running 'rpc.mountd --no-tcp -N 4' (Expected 0, got 0)
--------------------------------------------------------------------------------

================================================================================
[01:38:32 root@ /mnt/tests/CoreOS/nfs-utils/commands/utils/rpc-mountd]# ps axf | grep -v grep | grep "rpc.mountd --no-tcp"
11107 ?        Ss     0:00 rpc.mountd --no-tcp -N 4
:: [   PASS   ] :: Running 'ps axf | grep -v grep | grep "rpc.mountd --no-tcp"' (Expected 0, got 0)
--------------------------------------------------------------------------------

================================================================================
[01:38:32 root@ /mnt/tests/CoreOS/nfs-utils/commands/utils/rpc-mountd]# rpcinfo -p | grep -w mountd | grep -w tcp
:: [   PASS   ] :: Running 'rpcinfo -p | grep -w mountd | grep -w tcp' (Expected 1, got 1)
--------------------------------------------------------------------------------

================================================================================
[01:38:32 root@ /mnt/tests/CoreOS/nfs-utils/commands/utils/rpc-mountd]# pkill rpc.mountd
:: [   PASS   ] :: Running 'pkill rpc.mountd' (Expected 0, got 0)
--------------------------------------------------------------------------------

Comment 15 Ludek Smid 2014-06-13 09:38:08 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

Comment 17 JianHong Yin 2016-11-18 10:36:02 UTC
Additional info:

fixed in upstream:
commit a80482157632584ee03df58ed1eef3cefd95bbcb
Author: Steve Dickson <steved@redhat.com>
Date:   Tue Nov 5 14:10:05 2013 -0500

    mountd: Use protocol bit fields to turn protocols off.
    
    Convert the current code to used the NFSCTL_XXX macros
    to turn off the TCP listener.
    
    Signed-off-by: Steve Dickson <steved@redhat.com>


Note You need to log in before you can comment on or make changes to this bug.