8246 snoop(1m) clobbers status for the NFSv4 SETATTR operation

Review Request #521 — Created May 17, 2017 and submitted

marcel
illumos-gate
master
8246
dd8f718...
general
This fixes the snoop(1m) output for the NFSv4 SETATTR operation where the
returned status was not printed, even the code to do that was already there.
Without the fix:

$ /usr/sbin/snoop -ta -r -i nfs4_setattr.cap
  1 16:27:54.69663    10.0.2.15 -> 10.0.0.7     NFS C 4 (setattr     ) PUTFH FH=9294 SETATTR ST=SPC0 GETATTR 10011a b0a23a 
  2 16:27:54.69668     10.0.0.7 -> 10.0.2.15    TCP D=1018 S=2049 Ack=3747778077 Seq=2732201278 Len=0 Win=65535
  3 16:27:54.77984     10.0.0.7 -> 10.0.2.15    NFS R 4 (setattr     ) NFS4_OK PUTFH NFS4_OK SETATTR 0 410000 GETATTR NFS4_OK 
$


With the fix:

$ $ROOT/usr/sbin/snoop -ta -r -i nfs4_setattr.cap
  1 16:27:54.69663    10.0.2.15 -> 10.0.0.7     NFS C 4 (setattr     ) PUTFH FH=9294 SETATTR ST=SPC0 GETATTR 10011a b0a23a 
  2 16:27:54.69668     10.0.0.7 -> 10.0.2.15    TCP D=1018 S=2049 Ack=3747778077 Seq=2732201278 Len=0 Win=65535
  3 16:27:54.77984     10.0.0.7 -> 10.0.2.15    NFS R 4 (setattr     ) NFS4_OK PUTFH NFS4_OK SETATTR NFS4_OK 0 410000 GETATTR NFS4_OK 
$
  • 0
  • 0
  • 0
  • 1
  • 1
Description From Last Updated
jbk
  1. Ship It!
  2. 
      
vgusev
  1. 
      
  2. If @buflen is zero, snprintf(buf) doesn't write '\0' to @buf and therefore strlen(buf) can return garbage.

    Of course, this case can be ignored if we rely that @buflen is > 0 or buf[0] is 0 initially.

    1. Similar problems are scattered here and there in this source file, for example in sumarg_cb_getattr(). The similar problem seems to be every strncpy() call in this file too. The good news is that the buflen value is high enough (1024) so we can safely ignore this bug for now. It deserves a fix, but as a followup work. Any volunteer? :-)

  3. 
      
tsoome
  1. Ship It!
  2. 
      
vgusev
  1. Ship It!
  2. 
      
seb@delphix.com
  1. Ship It!
  2. 
      
marcel
Review request changed

Status: Closed (submitted)

Change Summary:

commit be656d98a8733cd77d5106da969b7d5044b295c0
Author:     Marcel Telka <marcel@telka.sk>
AuthorDate: Wed May 17 17:03:28 2017 +0200
Commit:     Gordon Ross <gwr@nexenta.com>
CommitDate: Mon May 22 21:07:48 2017 -0400

    8246 snoop(1m) clobbers status for the NFSv4 SETATTR operation
    Reviewed by: Jason King <jason.brian.king+illumos@gmail.com>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Reviewed by: Vitaliy Gusev <gusev.vitaliy@icloud.com>
    Reviewed by: Sebastien Roy <seb@delphix.com>
    Approved by: Gordon Ross <gordon.w.ross@gmail.com>

:100644 100644 70b95a5... 40a169e... M	usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nfs4.c
Loading...