Menu

make rpcbind be able to use fixed port

Help
lirongqing
2014-09-18
2021-03-27
  • lirongqing

    lirongqing - 2014-09-18

    I have the below patch, which make rpcbind be able to use fixed port, do you think it is suitable?

    Subject: [PATCH] add option to make customer able to use fixed port number

    Signed-off-by: Li Wang li.wang@windriver.com
    Signed-off-by: Roy Li rongqing.li@windriver.com


    src/rpcb_svc_com.c | 17 +++++++++++++++++
    src/rpcbind.c | 6 +++++-
    2 files changed, 22 insertions(+), 1 deletion(-)

    diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
    index f6bd6bd..0bbd6e4 100644
    --- a/src/rpcb_svc_com.c
    +++ b/src/rpcb_svc_com.c
    @@ -48,6 +48,7 @@
    #include <rpc rpc.h="">
    #include <rpc rpcb_prot.h="">
    #include <rpc svc_dg.h="">
    +#include <rpc rpc_com.h="">
    #include <netconfig.h>
    #include <errno.h>
    #include <syslog.h>
    @@ -496,6 +497,7 @@ xdr_opaque_parms(XDR xdrs, struct r_rmtcall_args cap)</syslog.h></errno.h></netconfig.h></rpc></rpc></rpc></rpc>

    static struct rmtcallfd_list rmthead;
    static struct rmtcallfd_list
    rmttail;
    +extern unsigned short fixed_port;

    int
    create_rmtcall_fd(struct netconfig nconf)
    @@ -503,6 +505,8 @@ create_rmtcall_fd(struct netconfig
    nconf)
    int fd;
    struct rmtcallfd_list rmt;
    SVCXPRT
    xprt;

    • struct __rpc_sockinfo si;
    • struct t_bind taddr;

      if ((fd = __rpc_nconf2fd(nconf)) == -1) {
      if (debugging)
      @@ -511,6 +515,19 @@ create_rmtcall_fd(struct netconfig *nconf)
      nconf->nc_device, errno);
      return (-1);
      }
      +

    • if (fixed_port) {

    • __rpc_fd2sockinfo(fd, &si);
    • memset(&taddr, 0, sizeof(taddr));
    • taddr.addr.maxlen = taddr.addr.len = si.si_alen;
    • taddr.addr.buf = malloc(si.si_alen);
    • if (taddr.addr.buf == NULL) {
    • return -1;
    • }
    • (unsigned short )(&(taddr.addr.buf[0])) = si.si_af;
    • (unsigned short )(&(taddr.addr.buf[2])) = htons(fixed_port);
    • xprt = svc_tli_create(fd, nconf, &taddr, RPC_MAXDATASIZE, RPC_MAXDATASIZE);
    • } else
      xprt = svc_tli_create(fd, 0, (struct t_bind *) 0, 0, 0);
      if (xprt == NULL) {
      if (debugging)
      diff --git a/src/rpcbind.c b/src/rpcbind.c
      index 83dbe93..a2caa32 100644
      --- a/src/rpcbind.c
      +++ b/src/rpcbind.c
      @@ -99,6 +99,7 @@ int runasdaemon = 0;
      int insecure = 0;
      int oldstyle_local = 0;
      int verboselog = 0;
      +unsigned short fixed_port = 0;

    char *hosts = NULL;
    int nhosts = 0;
    @@ -748,7 +749,7 @@ parseargs(int argc, char
    argv[])
    {
    int c;
    oldstyle_local = 1;

    • while ((c = getopt(argc, argv, "adh:ilswf")) != -1) {
    • while ((c = getopt(argc, argv, "adh:p:ilswf")) != -1) {
      switch (c) {
      case 'a':
      doabort = 1; / when debugging, do an abort on /
      @@ -766,6 +767,9 @@ parseargs(int argc, char *argv[])
      if (hosts[nhosts - 1] == NULL)
      errx(1, "Out of memory");
      break;
    • case 'p':
    • fixed_port = atoi(optarg);
    • break;
      case 'i':
      insecure = 1;
      break;
      --
      1.7.10.4
     
  • steve bez

    steve bez - 2021-03-27

    unix/solaris/sunos[& many other networked machines] use rpc or reference of rmt /remote[unix 'rje/uucp/rpc/gopher] ,usually windows www internetworked isp-ip-tcp machines contuinue rpc protocols as included from 'unix&c' synthesis of interactive computes. Usually[for sun/dec/hp]the port is & has always been 111. For numbered isp ip-tcp 'parallels'[lack of pport printer usage&c]windows 'finds by number'offering no access,inclusion or understanding as novell[lack of]or other, remote 'ibmpc dos typical'networking'[client/server]has long been eroded into windows'mouse click'indifferences, why now'writing too rpcbind'is 'logical'termed[even too 'english word']alied 'networking'which sun&c inherently wouldnt use & many individual machines[in there networkings]become 'anchored'too 'lazed statics of windows'subsided 'termed'bored puzzel maze of 'no code of any use't&c applied,encrypted rubrics used to end useless apparances of communications 'of or about'dazed confused'useless use'?[sim p.a.y.g'act2pay4air'was initial blame?]phonetic en-soundedsink!

     

Log in to post a comment.

MongoDB Logo MongoDB