8250 libnsl: Raw RPC client sends unlimited data

Review Request #524 — Created May 19, 2017 and submitted

marcel
illumos-gate
master
8250
807c3a7...
general
This fixes the raw RPC transport in libnsl to properly notify the other party
about the size of the transferred data between client and server.

Please note that the raw RPC transport is primarily used for testing purposes
only.
I tested using the test attached to the bug report:

$ ./test 
Raw:
Server received: 12345678
Server received: 12345678

Door:
Server received: 12345678
clnt_send #2 failed: RPC: Server can't decode arguments
$



$ LD_PRELOAD=$ROOT/lib/libnsl.so.1 ./test 
Raw:
Server received: 12345678
clnt_send #2 failed: RPC: Server can't decode arguments

Door:
Server received: 12345678
clnt_send #2 failed: RPC: Server can't decode arguments
$
  • 0
  • 0
  • 0
  • 6
  • 6
Description From Last Updated
yuripv
  1. 
      
  2. usr/src/lib/libnsl/rpc/clnt_raw.c (Diff revision 1)
     
     

    Hopefully, this won't cause newer gcc versions to be too smart and whine about possible typoes here.

    1. This is pretty common in other libnsl sources too, for example in clnt_door.c, so if we will need to fix it it won't be just here :-).

  3. usr/src/lib/libnsl/rpc/clnt_raw.c (Diff revision 1)
     
     

    So this is still used to cause overhead? Leaving the comment would help.

    1. Honestly, I do not understand what kind of overhead the previous comment was referring to. IIRC, all XDR_GETPOS() implementations for all XDR stream types just do not modify the XDR stream. So basically calling XDR_GETPOS() with throwing away the return value is just a complete no-op.

      OTOH, here I use the return value to let the other party to know the size of transferred data. But I still do not see any overhead there :-).

  4. usr/src/lib/libnsl/rpc/clnt_raw.c (Diff revision 1)
     
     

    As you are fixing other comments, "pseudo" :-)

  5. 
      
marcel
yuripv
  1. Obviously, I'm not an expert here, but don't see anything wrong.

  2. 
      
jbk
  1. 
      
  2. usr/src/lib/libnsl/rpc/clnt_raw.c (Diff revision 2)
     
     

    Does any other code use this style? I can't say I'm a fan of it--it seems like it could easily get mixed up with ==. I'd rather spend the extra few bytes and be a bit more explicit.

    1. This is common in other libnsl sources too, for example in clnt_door.c, clnt_dg.c, and clnt_vc.c.

  3. usr/src/lib/libnsl/rpc/clnt_raw.c (Diff revision 2)
     
     

    Same as above

  4. usr/src/lib/libnsl/rpc/clnt_raw.c (Diff revision 2)
     
     

    Same as above

  5. usr/src/lib/libnsl/rpc/clnt_raw.c (Diff revision 2)
     
     

    Same comment as above

  6. usr/src/lib/libnsl/rpc/clnt_raw.c (Diff revision 2)
     
     

    Same as above

  7. usr/src/lib/libnsl/rpc/clnt_raw.c (Diff revision 2)
     
     

    Same as above

  8. 
      
jbk
  1. Ship It!
  2. 
      
marcel
Review request changed

Status: Closed (submitted)

Change Summary:

commit 2a6fb28d0877f35efb94c09cc03e8088426d0c30
Author:     Marcel Telka <marcel@telka.sk>
AuthorDate: Fri May 19 12:59:57 2017 +0200
Commit:     Dan McDonald <danmcd@joyent.com>
CommitDate: Thu Jun 8 10:25:31 2017 -0400

    8250 libnsl: Raw RPC client sends unlimited data
    Reviewed by: Yuri Pankov <yuripv@gmx.com>
    Reviewed by: Jason King <jason.brian.king+illumos@gmail.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

:100644 100644 c8fa67b... 3f31af2... M	usr/src/lib/libnsl/common/mapfile-vers
:100644 100644 8f1766c... 805e41c... M	usr/src/lib/libnsl/rpc/clnt_raw.c
:100644 100644 a3e9e9c... 1fe2ad7... M	usr/src/lib/libnsl/rpc/svc_raw.c
:100644 100644 4e135e7... 9082061... M	usr/src/pkg/manifests/system-header.mf
:100644 100644 c300261... f0c54d2... M	usr/src/uts/common/rpc/Makefile
:100644 000000 d58396b... 0000000... D	usr/src/uts/common/rpc/raw.h
Loading...