Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-27005

RPC servers binding to ports outside ip_local_port_range

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • rhel-8.10.z
    • rhel-8.9.0
    • libtirpc
    • None
    • libtirpc-1.1.4-12.el8_10
    • Normal
    • sst_filesystems
    • ssg_filesystems_storage_and_HA
    • False
    • Hide

      None

      Show
      None
    • Red Hat Enterprise Linux
    • All

      net.ipv4.ip_local_port_range default should be 32768 60999

      User uses a custom value and has code in the pattern.

        transp = svcudp_create(RPC_ANYSOCK);

      But the value frequently is out of the range of net.ipv4.ip_local_port_range

        This should be a side effect of possibly non related behavior.

        User did rely on it working on RHEL6, where glibc did choose the value with:

             if ((sock = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)

      but {{libtirpc }}basically has the code:

       /*
       * Dynamic port range as defined in RFC 6335 Section 6.
       * This range avoids all IANA-assigned service port
       * numbers.
       */
      enum {
      	LOWPORT		= 49152,
      	ENDPORT		= 65534,
      	NPORTS		= ENDPORT - LOWPORT + 1,
      };
      
      ...
      	port = (rand_r(&seed) % NPORTS) + LOWPORT;
      	for (i = 0; i < NPORTS; ++i) {
      		*portp = htons(port++);
      		res = bind(fd, sap, salen);

      in src/binddynport.c

        There is no easy workaround. The RHEL8 libtirpc package does not include the patch, or variant of  https://sourceforge.net/p/libtirpc/mailman/message/37667337/ that could be used as a way to set the ports to not be used.

        The proper fix might be to adapt the logic in the above patch to respect  net.ipv4.ip_local_port_range assuming this is the correct or expected behavior, otherwise, a different approach might be required.

            stevedatrhn Steve Dickson
            rhn-support-pandrade Paulo Andrade
            Steve Dickson Steve Dickson
            Zhi Li Zhi Li
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: