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

Error message "cannot setsockopt IPV6_RECVPKTINFO Protocol not available" when disabling IPv6

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Minor Minor
    • rhel-9.4
    • rhel-8.9.0, rhel-9.3.0
    • tftp
    • None
    • tftp-5.2-38.el9
    • None
    • Low
    • rhel-sst-cs-plumbers
    • ssg_core_services
    • 19
    • 22
    • 2
    • False
    • Hide

      None

      Show
      None
    • None
    • Red Hat Enterprise Linux
    • None
    • All
    • None

      What were you trying to do that didn't work?

      When configuring tftp socket to bind on an IPv4 address and IPv6 is disabled through sysctl settings, the following error message is seen:

      [...] in.tftpd[11511]: cannot setsockopt IPV6_RECVPKTINFO Protocol not available

      This is harmless but annoying.

      Digging into the code, it looks like to me the code is broken:

        95 static union sock_addr from;
       :
      
       356 int main(int argc, char **argv)
       357 {          
       :
       894         fromlen = sizeof(from);
       895         n = myrecvfrom(fd, buf, sizeof(buf), 0,
       896                        (struct sockaddr *)&from, &fromlen, &myaddr);
       :
      ---
      
      117 int
      118 myrecvfrom(int s, void *buf, int len, unsigned int flags,
      119            struct sockaddr *from, socklen_t * fromlen,
      120            union sock_addr *myaddr)
      121 {
       :
      162 #ifdef HAVE_IPV6
      163 #ifdef IPV6_RECVPKTINFO
      164     if (from->sa_family == AF_INET6 || !from->sa_family)
      165         if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on)) == -1)
      166             syslog(LOG_ERR, "cannot setsockopt IPV6_RECVPKTINFO %m");
      167 #endif
      168 #endif
      

      Here above the myrecvfrom() function is always called with from->sa_family being 0 because it's zero-initialized memory (line 95) which never got modified at the time the function gets called (line 895 in main() function).

      Please provide the package NVR for which bug is seen:

      tftp-server-5.2-37.el9.x86_64

      How reproducible:

      Always

      Steps to reproduce

      1. Disable IPv6 in /etc/sysctl.conf and reboot
        net.ipv6.conf.all.disable_ipv6 = 1
        net.ipv6.conf.default.disable_ipv6 = 1
        net.ipv6.conf.lo.disable_ipv6 = 1
      2. Collect system's IPv4 address
      3. Edit tftp.socket to bind to IPv4 address
        # systemctl edit tftp.socket --full
        [...]
        ListenDatagram=192.168.122.157:69
        [...]
      4. Connect to tftp
        # ncat -u 192.168.122.157 69
        foo

      Expected results

      No error message in the journal

      Actual results

      Error message:

      [...] in.tftpd[11511]: cannot setsockopt IPV6_RECVPKTINFO Protocol not available

              fsumsalrh Frantisek Sumsal
              rhn-support-rmetrich Renaud Métrich
              Lukáš Zaoral Lukáš Zaoral
              Frantisek Sumsal Frantisek Sumsal
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: